]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/alarmtimer.h
alarmtimers: Push rearming peroidic timers down into alamrtimer handler
[mirror_ubuntu-artful-kernel.git] / include / linux / alarmtimer.h
CommitLineData
ff3ead96
JS
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
9enum alarmtimer_type {
10 ALARM_REALTIME,
11 ALARM_BOOTTIME,
12
13 ALARM_NUMTYPE,
14};
15
4b41308d
JS
16enum alarmtimer_restart {
17 ALARMTIMER_NORESTART,
18 ALARMTIMER_RESTART,
19};
20
180bf812
JS
21/**
22 * struct alarm - Alarm timer structure
23 * @node: timerqueue node for adding to the event list this value
24 * also includes the expiration time.
25 * @period: Period for recuring alarms
26 * @function: Function pointer to be executed when the timer fires.
27 * @type: Alarm type (BOOTTIME/REALTIME)
28 * @enabled: Flag that represents if the alarm is set to fire or not
29 * @data: Internal data value.
30 */
ff3ead96
JS
31struct alarm {
32 struct timerqueue_node node;
33 ktime_t period;
4b41308d 34 enum alarmtimer_restart (*function)(struct alarm *, ktime_t now);
ff3ead96 35 enum alarmtimer_type type;
180bf812 36 bool enabled;
ff3ead96
JS
37 void *data;
38};
39
40void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
4b41308d 41 enum alarmtimer_restart (*function)(struct alarm *, ktime_t));
ff3ead96
JS
42void alarm_start(struct alarm *alarm, ktime_t start, ktime_t period);
43void alarm_cancel(struct alarm *alarm);
44
45#endif