00001 00014 #ifndef TIMERS_H_ 00015 #define TIMERS_H_ 00016 00020 #define MSIM_FREQUENCY_USEC 1 //ticks per usec // was 7 00021 00025 #define MSIM_FREQUENCY (MSIM_FREQUENCY_USEC*1000000) //ticks per second 00026 00030 struct _timer_list { 00032 struct timer *head; 00034 struct timer *tail; 00035 }; 00037 typedef struct _timer_list timer_list; 00039 typedef struct timer_list timer_list_t; 00040 00044 struct timer { 00046 unsigned int usec; 00048 unsigned int stop_cycle; 00050 void (* handler) (struct timer *, void *); 00052 void * data; 00054 struct timer *next; 00056 struct timer *prev; 00057 }; 00059 typedef struct timer timer_t; 00060 00061 int timer_init (timer_t * tmr, const unsigned int usec, void (* handler) (timer_t *, void *), void * data); 00062 void timer_start (timer_t * tmr); 00063 void timer_destroy (timer_t * tmr); 00064 int timer_pending (timer_t * tmr); 00065 void timer_check (); 00066 unsigned get_sysutime (); 00067 int init_timers (); 00068 void timer_debug (void); 00069 00070 #endif /*TIMERS_H_*/