• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved.
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 #ifndef __HWTIMER_LIST_H__
16 #define __HWTIMER_LIST_H__
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 typedef void *HWTIMER_ID;
23 
24 typedef void (*HWTIMER_CALLBACK_T)(void *param);
25 
26 enum E_HWTIMER_T {
27     E_HWTIMER_OK = 0,
28     E_HWTIMER_FAILED,
29     E_HWTIMER_INVAL_ID,
30     E_HWTIMER_INVAL_ST,
31     E_HWTIMER_IN_CALLBACK,
32     E_HWTIMER_NOT_FOUND,
33 };
34 
35 void hwtimer_init(void);
36 
37 HWTIMER_ID hwtimer_alloc(HWTIMER_CALLBACK_T callback, void *param);
38 
39 enum E_HWTIMER_T hwtimer_free(HWTIMER_ID id);
40 
41 enum E_HWTIMER_T hwtimer_start(HWTIMER_ID id, unsigned int ticks);
42 
43 enum E_HWTIMER_T hwtimer_update_then_start(HWTIMER_ID id, HWTIMER_CALLBACK_T callback, void *param, unsigned int ticks);
44 
45 enum E_HWTIMER_T hwtimer_update(HWTIMER_ID id, HWTIMER_CALLBACK_T callback, void *param);
46 
47 enum E_HWTIMER_T hwtimer_stop(HWTIMER_ID id);
48 
49 int hwtimer_active(HWTIMER_ID id);
50 
51 #ifdef __cplusplus
52 }
53 #endif
54 
55 #endif
56 
57