1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef __HWTIMER_LIST_H__ 5 #define __HWTIMER_LIST_H__ 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 typedef void *HWTIMER_ID; 12 13 typedef void (*HWTIMER_CALLBACK_T)(void *param); 14 15 enum E_HWTIMER_T { 16 E_HWTIMER_OK = 0, 17 E_HWTIMER_FAILED, 18 E_HWTIMER_INVAL_ID, 19 E_HWTIMER_INVAL_ST, 20 E_HWTIMER_IN_CALLBACK, 21 E_HWTIMER_NOT_FOUND, 22 }; 23 24 void hwtimer_init(void); 25 26 HWTIMER_ID hwtimer_alloc(HWTIMER_CALLBACK_T callback, void *param); 27 28 enum E_HWTIMER_T hwtimer_free(HWTIMER_ID id); 29 30 enum E_HWTIMER_T hwtimer_start(HWTIMER_ID id, unsigned int ticks); 31 32 enum E_HWTIMER_T hwtimer_update_then_start(HWTIMER_ID id, HWTIMER_CALLBACK_T callback, void *param, unsigned int ticks); 33 34 enum E_HWTIMER_T hwtimer_update(HWTIMER_ID id, HWTIMER_CALLBACK_T callback, void *param); 35 36 enum E_HWTIMER_T hwtimer_stop(HWTIMER_ID id); 37 38 #ifdef __cplusplus 39 } 40 #endif 41 42 #endif 43 44