]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/alarmtimer.h
1 #ifndef _LINUX_ALARMTIMER_H
2 #define _LINUX_ALARMTIMER_H
4 #include <linux/time.h>
5 #include <linux/hrtimer.h>
6 #include <linux/timerqueue.h>
16 enum alarmtimer_restart
{
22 #define ALARMTIMER_STATE_INACTIVE 0x00
23 #define ALARMTIMER_STATE_ENQUEUED 0x01
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.
36 struct timerqueue_node node
;
38 enum alarmtimer_restart (*function
)(struct alarm
*, ktime_t now
);
39 enum alarmtimer_type type
;
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
);
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
);
56 /* Provide way to access the rtc device being used by alarmtimers */
57 struct rtc_device
*alarmtimer_get_rtcdev(void);