Rev 494 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | #ifndef _LINUX_TIMER_H |
2 | #define _LINUX_TIMER_H |
||
3 | |||
4 | #include <linux/config.h> |
||
5 | #include <linux/list.h> |
||
6 | #include <linux/spinlock.h> |
||
7 | |||
8 | struct tvec_t_base_s; |
||
9 | |||
10 | struct timer_list { |
||
11 | struct list_head entry; |
||
12 | unsigned long expires; |
||
13 | |||
14 | spinlock_t lock; |
||
15 | unsigned long magic; |
||
16 | |||
17 | void (*function)(unsigned long); |
||
18 | unsigned long data; |
||
19 | |||
20 | struct tvec_t_base_s *base; |
||
494 | giacomo | 21 | |
22 | /* Added by Nino */ |
||
23 | int event_timer; |
||
422 | giacomo | 24 | }; |
25 | |||
26 | #define TIMER_MAGIC 0x4b87ad6e |
||
27 | |||
28 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ |
||
29 | .function = (_function), \ |
||
30 | .expires = (_expires), \ |
||
31 | .data = (_data), \ |
||
32 | .base = NULL, \ |
||
33 | .magic = TIMER_MAGIC, \ |
||
34 | .lock = SPIN_LOCK_UNLOCKED, \ |
||
35 | } |
||
36 | |||
37 | /*** |
||
38 | * init_timer - initialize a timer. |
||
39 | * @timer: the timer to be initialized |
||
40 | * |
||
41 | * init_timer() must be done to a timer prior calling *any* of the |
||
42 | * other timer functions. |
||
43 | */ |
||
494 | giacomo | 44 | /*static inline void init_timer(struct timer_list * timer) |
422 | giacomo | 45 | { |
46 | timer->base = NULL; |
||
47 | timer->magic = TIMER_MAGIC; |
||
48 | spin_lock_init(&timer->lock); |
||
494 | giacomo | 49 | }*/ |
50 | extern void init_timer(struct timer_list * timer); |
||
422 | giacomo | 51 | |
52 | /*** |
||
53 | * timer_pending - is a timer pending? |
||
54 | * @timer: the timer in question |
||
55 | * |
||
56 | * timer_pending will tell whether a given timer is currently pending, |
||
57 | * or not. Callers must ensure serialization wrt. other operations done |
||
58 | * to this timer, eg. interrupt contexts, or other CPUs on SMP. |
||
59 | * |
||
60 | * return value: 1 if the timer is pending, 0 if not. |
||
61 | */ |
||
494 | giacomo | 62 | /*static inline int timer_pending(const struct timer_list * timer) |
422 | giacomo | 63 | { |
64 | return timer->base != NULL; |
||
494 | giacomo | 65 | }*/ |
66 | extern int timer_pending(struct timer_list * timer); |
||
422 | giacomo | 67 | |
68 | extern void add_timer_on(struct timer_list *timer, int cpu); |
||
69 | extern int del_timer(struct timer_list * timer); |
||
70 | extern int __mod_timer(struct timer_list *timer, unsigned long expires); |
||
71 | extern int mod_timer(struct timer_list *timer, unsigned long expires); |
||
72 | |||
73 | /*** |
||
74 | * add_timer - start a timer |
||
75 | * @timer: the timer to be added |
||
76 | * |
||
77 | * The kernel will do a ->function(->data) callback from the |
||
78 | * timer interrupt at the ->expired point in the future. The |
||
79 | * current time is 'jiffies'. |
||
80 | * |
||
81 | * The timer's ->expired, ->function (and if the handler uses it, ->data) |
||
82 | * fields must be set prior calling this function. |
||
83 | * |
||
84 | * Timers with an ->expired field in the past will be executed in the next |
||
85 | * timer tick. |
||
86 | */ |
||
494 | giacomo | 87 | /*static inline void add_timer(struct timer_list * timer) |
422 | giacomo | 88 | { |
89 | __mod_timer(timer, timer->expires); |
||
494 | giacomo | 90 | }*/ |
91 | extern void add_timer(struct timer_list * timer); |
||
422 | giacomo | 92 | |
93 | #ifdef CONFIG_SMP |
||
94 | extern int del_timer_sync(struct timer_list * timer); |
||
95 | #else |
||
96 | # define del_timer_sync(t) del_timer(t) |
||
97 | #endif |
||
98 | |||
99 | extern void init_timers(void); |
||
100 | extern void run_local_timers(void); |
||
101 | extern void it_real_fn(unsigned long); |
||
102 | |||
103 | #endif |