1 /* 2 * linux/include/asm-cris/fasttimer.h 3 * 4 * Fast timers for ETRAX100LX 5 * This may be useful in other OS than Linux so use 2 space indentation... 6 * Copyright (C) 2000, 2001, 2002, 2003 Axis Communications AB 7 */ 8 9 #include <linux/config.h> 10 #include <linux/time.h> /* struct timeval */ 11 #include <linux/timex.h> 12 13 /* The timer0 values gives 52us resolution (1/19200) or higher 14 * but interrupts at HZ 15 */ 16 /* We use timer1 to generate interrupts at desired times. */ 17 18 #ifdef CONFIG_ETRAX_FAST_TIMER 19 20 typedef void fast_timer_function_type(unsigned long); 21 22 struct fast_timer { /* Close to timer_list */ 23 struct fast_timer *next; 24 struct fast_timer *prev; 25 struct timeval tv_set; 26 struct timeval tv_expires; 27 unsigned long delay_us; 28 fast_timer_function_type *function; 29 unsigned long data; 30 const char *name; 31 }; 32 33 extern struct fast_timer *fast_timer_list; 34 35 void start_one_shot_timer(struct fast_timer *t, 36 fast_timer_function_type *function, 37 unsigned long data, 38 unsigned long delay_us, 39 const char *name); 40 41 int del_fast_timer(struct fast_timer * t); 42 /* return 1 if deleted */ 43 fast_timer_pending(const struct fast_timer * t)44extern inline int fast_timer_pending (const struct fast_timer * t) 45 { 46 return (t->next != NULL) || (t->prev != NULL) || (t == fast_timer_list); 47 } 48 49 void schedule_usleep(unsigned long us); 50 51 52 void fast_timer_init(void); 53 54 #endif 55