summaryrefslogtreecommitdiff
path: root/include/linux/alarmtimer.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-19 17:45:08 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-19 17:45:08 -0700
commit78c4def67e8eebe602655a3dec9aa08f0e2f7c4b (patch)
tree8c0c756bbff7325f5c2a773f8cc64d8390ebe5b5 /include/linux/alarmtimer.h
parent7e6628e4bcb3b3546c625ec63ca724f28ab14f0c (diff)
parent942c3c5c329274fa6de5998cb911cf3d0a42d0b1 (diff)
downloadlwn-78c4def67e8eebe602655a3dec9aa08f0e2f7c4b.tar.gz
lwn-78c4def67e8eebe602655a3dec9aa08f0e2f7c4b.zip
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: hrtimer: Make lookup table const RTC: Disable CONFIG_RTC_CLASS from being built as a module timers: Fix alarmtimer build issues when CONFIG_RTC_CLASS=n timers: Remove delayed irqwork from alarmtimers implementation timers: Improve alarmtimer comments and minor fixes timers: Posix interface for alarm-timers timers: Introduce in-kernel alarm-timer interface timers: Add rb_init_node() to allow for stack allocated rb nodes time: Add timekeeping_inject_sleeptime
Diffstat (limited to 'include/linux/alarmtimer.h')
-rw-r--r--include/linux/alarmtimer.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
new file mode 100644
index 000000000000..c5d6095b46f8
--- /dev/null
+++ b/include/linux/alarmtimer.h
@@ -0,0 +1,40 @@
+#ifndef _LINUX_ALARMTIMER_H
+#define _LINUX_ALARMTIMER_H
+
+#include <linux/time.h>
+#include <linux/hrtimer.h>
+#include <linux/timerqueue.h>
+#include <linux/rtc.h>
+
+enum alarmtimer_type {
+ ALARM_REALTIME,
+ ALARM_BOOTTIME,
+
+ ALARM_NUMTYPE,
+};
+
+/**
+ * struct alarm - Alarm timer structure
+ * @node: timerqueue node for adding to the event list this value
+ * also includes the expiration time.
+ * @period: Period for recuring alarms
+ * @function: Function pointer to be executed when the timer fires.
+ * @type: Alarm type (BOOTTIME/REALTIME)
+ * @enabled: Flag that represents if the alarm is set to fire or not
+ * @data: Internal data value.
+ */
+struct alarm {
+ struct timerqueue_node node;
+ ktime_t period;
+ void (*function)(struct alarm *);
+ enum alarmtimer_type type;
+ bool enabled;
+ void *data;
+};
+
+void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
+ void (*function)(struct alarm *));
+void alarm_start(struct alarm *alarm, ktime_t start, ktime_t period);
+void alarm_cancel(struct alarm *alarm);
+
+#endif