Root/
1 | #ifndef _LINUX_ALARMTIMER_H |
2 | #define _LINUX_ALARMTIMER_H |
3 | |
4 | #include <linux/time.h> |
5 | #include <linux/hrtimer.h> |
6 | #include <linux/timerqueue.h> |
7 | #include <linux/rtc.h> |
8 | |
9 | enum alarmtimer_type { |
10 | ALARM_REALTIME, |
11 | ALARM_BOOTTIME, |
12 | |
13 | ALARM_NUMTYPE, |
14 | }; |
15 | |
16 | enum alarmtimer_restart { |
17 | ALARMTIMER_NORESTART, |
18 | ALARMTIMER_RESTART, |
19 | }; |
20 | |
21 | |
22 | #define ALARMTIMER_STATE_INACTIVE 0x00 |
23 | #define ALARMTIMER_STATE_ENQUEUED 0x01 |
24 | |
25 | /** |
26 | * struct alarm - Alarm timer structure |
27 | * @node: timerqueue node for adding to the event list this value |
28 | * also includes the expiration time. |
29 | * @period: Period for recuring alarms |
30 | * @function: Function pointer to be executed when the timer fires. |
31 | * @type: Alarm type (BOOTTIME/REALTIME) |
32 | * @enabled: Flag that represents if the alarm is set to fire or not |
33 | * @data: Internal data value. |
34 | */ |
35 | struct alarm { |
36 | struct timerqueue_node node; |
37 | struct hrtimer timer; |
38 | enum alarmtimer_restart (*function)(struct alarm *, ktime_t now); |
39 | enum alarmtimer_type type; |
40 | int state; |
41 | void *data; |
42 | }; |
43 | |
44 | void alarm_init(struct alarm *alarm, enum alarmtimer_type type, |
45 | enum alarmtimer_restart (*function)(struct alarm *, ktime_t)); |
46 | int alarm_start(struct alarm *alarm, ktime_t start); |
47 | int alarm_start_relative(struct alarm *alarm, ktime_t start); |
48 | void alarm_restart(struct alarm *alarm); |
49 | int alarm_try_to_cancel(struct alarm *alarm); |
50 | int alarm_cancel(struct alarm *alarm); |
51 | |
52 | u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval); |
53 | u64 alarm_forward_now(struct alarm *alarm, ktime_t interval); |
54 | ktime_t alarm_expires_remaining(const struct alarm *alarm); |
55 | |
56 | /* Provide way to access the rtc device being used by alarmtimers */ |
57 | struct rtc_device *alarmtimer_get_rtcdev(void); |
58 | |
59 | #endif |
60 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9