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#include <linux/stddef.h>
8
9struct tvec_t_base_s;
10
11struct timer_list {
12 struct list_head entry;
13 unsigned long expires;
14
15 spinlock_t lock;
16 unsigned long magic;
17
18 void (*function)(unsigned long);
19 unsigned long data;
20
21 struct tvec_t_base_s *base;
22};
23
24#define TIMER_MAGIC 0x4b87ad6e
25
26#define TIMER_INITIALIZER(_function, _expires, _data) { \
27 .function = (_function), \
28 .expires = (_expires), \
29 .data = (_data), \
30 .base = NULL, \
31 .magic = TIMER_MAGIC, \
32 .lock = SPIN_LOCK_UNLOCKED, \
33 }
34
35
36
37
38
39
40
41
42static inline void init_timer(struct timer_list * timer)
43{
44 timer->base = NULL;
45 timer->magic = TIMER_MAGIC;
46 spin_lock_init(&timer->lock);
47}
48
49
50
51
52
53
54
55
56
57
58
59static inline int timer_pending(const struct timer_list * timer)
60{
61 return timer->base != NULL;
62}
63
64extern void add_timer_on(struct timer_list *timer, int cpu);
65extern int del_timer(struct timer_list * timer);
66extern int __mod_timer(struct timer_list *timer, unsigned long expires);
67extern int mod_timer(struct timer_list *timer, unsigned long expires);
68
69extern unsigned long next_timer_interrupt(void);
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85static inline void add_timer(struct timer_list * timer)
86{
87 __mod_timer(timer, timer->expires);
88}
89
90#ifdef CONFIG_SMP
91 extern int del_timer_sync(struct timer_list *timer);
92 extern int del_singleshot_timer_sync(struct timer_list *timer);
93#else
94# define del_timer_sync(t) del_timer(t)
95# define del_singleshot_timer_sync(t) del_timer(t)
96#endif
97
98extern void init_timers(void);
99extern void run_local_timers(void);
100extern void it_real_fn(unsigned long);
101
102#endif
103