• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HI_GV_TIMER_H
17 #define HI_GV_TIMER_H
18 
19 #include "hi_type.h"
20 #include "hi_gv_conf.h"
21 
22 #ifdef __cplusplus
23 #if __cplusplus
24 extern "C" {
25 #endif
26 #endif /* __cplusplus */
27 
28 /* * The timer Max number */
29 #define TIMER_MAX_NUM 0x40
30 
31 /*
32 * brief Create timer.
33 * param[in] widgetHandle Widget handle.
34 * param[in] timerId Timer ID.
35 * param[in] speed  Timer interval.
36 * retval ::HI_SUCCESS
37 * retval ::HI_ERR_COMM_EXIST
38 * retval ::HI_ERR_COMM_INVAL
39 * retval ::HI_ERR_COMM_NORES
40 * see ::HI_GV_Timer_Destroy
41 */
42 HI_S32 HI_GV_Timer_Create(HIGV_HANDLE widgetHandle, HI_U32 timerId, HI_U32 speed);
43 
44 /*
45 * brief Destroy timer.
46 * param[in] widgetHandle Widget handle.
47 * param[in] timerId Timer ID.
48 * retval ::HI_SUCCESS
49 * retval ::HI_ERR_COMM_LOST
50 * retval ::HI_ERR_COMM_NOOP Couldn't stop timer.
51 * see ::HI_GV_Timer_Create
52 */
53 HI_S32 HI_GV_Timer_Destroy(HIGV_HANDLE widgetHandle, HI_U32 timerId);
54 
55 /*
56 * brief Start timer.
57 * param[in] widgetHandle Widget handle.
58 * param[in] timerId  Timer ID.
59 * retval ::HI_SUCCESS
60 * retval ::HI_ERR_COMM_LOST
61 * retval ::HI_ERR_COMM_NOOP
62 * see ::HI_GV_Timer_Stop
63 */
64 HI_S32 HI_GV_Timer_Start(HIGV_HANDLE widgetHandle, HI_U32 timerId);
65 
66 /*
67 * brief Stop timer.
68 * param[in] widgetHandle Widget handle.
69 * param[in] timerId  Timer ID.
70 * retval ::HI_SUCCESS
71 * retval ::HI_ERR_COMM_LOST
72 * retval ::HI_ERR_COMM_NOOP Couldn't stop timer.
73 * see::HI_GV_Timer_Start
74 */
75 HI_S32 HI_GV_Timer_Stop(HIGV_HANDLE widgetHandle, HI_U32 timerId);
76 
77 /*
78 * brief Reset timer.
79 * param[in] widgetHandle  Widget handle.
80 * param[in] timerId  Timer ID.
81 * retval ::HI_SUCCESS
82 * retval ::HI_ERR_COMM_LOST
83 * retval ::HI_ERR_COMM_NOOP Couldn't stop timer.
84 */
85 HI_S32 HI_GV_Timer_Reset(HIGV_HANDLE widgetHandle, HI_U32 timerId);
86 
87 /*
88 * brief Set timer speed.
89 * param[in] widgetHandle  Widget handle.
90 * param[in] timerId  Timer ID.
91 * param[in] speed  Timer speed(unit: ms).
92 * retval ::HI_SUCCESS
93 * retval ::HI_ERR_COMM_LOST
94 */
95 HI_S32 HI_GV_Timer_SetSpeed(HIGV_HANDLE widgetHandle, HI_U32 timerId, HI_U32 speed);
96 
97 #ifdef __cplusplus
98 #if __cplusplus
99 }
100 #endif
101 #endif /* __cplusplus */
102 #endif /* HI_GV_TIMER_H */
103