1 /* drivers/staging/android/uapi/android_alarm.h
3 * Copyright (C) 2006-2007 Google, Inc.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
16 #ifndef _UAPI_LINUX_ANDROID_ALARM_H
17 #define _UAPI_LINUX_ANDROID_ALARM_H
19 #include <linux/ioctl.h>
20 #include <linux/time.h>
22 enum android_alarm_type {
23 /* return code bit numbers or set alarm arg */
24 ANDROID_ALARM_RTC_WAKEUP,
26 ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
27 ANDROID_ALARM_ELAPSED_REALTIME,
28 ANDROID_ALARM_POWER_OFF_WAKEUP,
29 ANDROID_ALARM_SYSTEMTIME,
30 ANDROID_ALARM_POWER_OFF_ALARM,
32 ANDROID_ALARM_TYPE_COUNT,
34 /* return code bit numbers */
35 /* ANDROID_ALARM_TIME_CHANGE = 16 */
38 enum android_alarm_return_flags {
39 ANDROID_ALARM_RTC_WAKEUP_MASK = 1U << ANDROID_ALARM_RTC_WAKEUP,
40 ANDROID_ALARM_RTC_MASK = 1U << ANDROID_ALARM_RTC,
41 ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK =
42 1U << ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
43 ANDROID_ALARM_ELAPSED_REALTIME_MASK =
44 1U << ANDROID_ALARM_ELAPSED_REALTIME,
45 ANDROID_ALARM_POWER_OFF_WAKEUP_MASK =
46 1U << ANDROID_ALARM_POWER_OFF_WAKEUP,
47 ANDROID_ALARM_POWER_OFF_ALARM_MASK =
48 1U << ANDROID_ALARM_POWER_OFF_ALARM,
49 ANDROID_ALARM_SYSTEMTIME_MASK = 1U << ANDROID_ALARM_SYSTEMTIME,
50 ANDROID_ALARM_TIME_CHANGE_MASK = 1U << 16
54 #define ANDROID_ALARM_CLEAR(type) _IO('a', 0 | ((type) << 4))
56 /* Ack last alarm and wait for next */
57 #define ANDROID_ALARM_WAIT _IO('a', 1)
59 #define ALARM_IOW(c, type, size) _IOW('a', (c) | ((type) << 4), size)
61 #define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec)
62 #define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec)
63 #define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec)
64 #define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec)
65 #define ANDROID_ALARM_WAIT_CHANGE _IOW('a', 10, int)
66 #define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0)))
67 #define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4)