1 /* 2 * Copyright (C) 2015-2021 Alibaba Group Holding Limited 3 */ 4 5 #ifndef _IO_TIMER_H_ 6 #define _IO_TIMER_H_ 7 8 #include <stdbool.h> 9 10 #define IOC_TIMER_BASE 'T' 11 #define IOC_TIMER_IRQP_SET IOC_TIMER_BASE + 1 // set timer parameters 12 #define IOC_TIMER_IRQP_GET IOC_TIMER_BASE + 2 // get timer parameters 13 #define IOC_TIMER_CONTROL IOC_TIMER_BASE + 3 // start/stop timer 14 #define IOC_TIMER_RELOAD IOC_TIMER_BASE + 4 // auto reload timer or not 15 16 #define IO_TIMER_START 1 17 #define IO_TIMER_STOP 0 18 19 typedef void (*alarm_timer_cb_t)(void *arg); 20 21 typedef struct timer_alarm { 22 void *arg; 23 alarm_timer_cb_t cb; 24 unsigned long period; 25 bool auto_reload; 26 } timer_alarm_t; 27 28 int vfs_timer_drv_init (void); 29 30 #endif //_IO_TIMER_H_ 31