Home | History | Annotate | Download | only in linux
      1 /* linux/android_alarm.h
      2 **
      3 ** Copyright 2006, The Android Open Source Project
      4 ** Author: Arve Hjnnevg
      5 **
      6 ** This file is dual licensed.  It may be redistributed and/or modified
      7 ** under the terms of the Apache 2.0 License OR version 2 of the GNU
      8 ** General Public License.
      9 */
     10 
     11 #ifndef _LINUX_ANDROID_ALARM_H
     12 #define _LINUX_ANDROID_ALARM_H
     13 
     14 #include <asm/ioctl.h>
     15 #include <linux/time.h>
     16 
     17 typedef enum {
     18 	// return code bit numbers or set alarm arg
     19 	ANDROID_ALARM_RTC_WAKEUP,
     20 	ANDROID_ALARM_RTC,
     21 	ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
     22 	ANDROID_ALARM_ELAPSED_REALTIME,
     23 	ANDROID_ALARM_SYSTEMTIME,
     24 	//
     25 	ANDROID_ALARM_TYPE_COUNT,
     26 
     27 	// return code bit numbers
     28 //	ANDROID_ALARM_TIME_CHANGE = 16
     29 } android_alarm_type_t;
     30 
     31 typedef enum {
     32 	ANDROID_ALARM_RTC_WAKEUP_MASK = 1U << ANDROID_ALARM_RTC_WAKEUP,
     33 	ANDROID_ALARM_RTC_MASK = 1U << ANDROID_ALARM_RTC,
     34 	ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK = 1U << ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
     35 	ANDROID_ALARM_ELAPSED_REALTIME_MASK = 1U << ANDROID_ALARM_ELAPSED_REALTIME,
     36 	ANDROID_ALARM_SYSTEMTIME_MASK = 1U << ANDROID_ALARM_SYSTEMTIME,
     37 	ANDROID_ALARM_TIME_CHANGE_MASK = 1U << 16
     38 } android_alarm_return_flags_t;
     39 
     40 #define ANDROID_ALARM_CLEAR(type)           _IO('a', 0 | ((type) << 4)) // diasable alarm
     41 #define ANDROID_ALARM_WAIT                  _IO('a', 1) // ack last alarm and wait for next
     42 #define ANDROID_ALARM_SET(type)             _IOW('a', 2 | ((type) << 4), struct timespec) // set alarm
     43 #define ANDROID_ALARM_SET_AND_WAIT(type)    _IOW('a', 3 | ((type) << 4), struct timespec)
     44 #define ANDROID_ALARM_GET_TIME(type)        _IOW('a', 4 | ((type) << 4), struct timespec)
     45 #define ANDROID_ALARM_SET_RTC               _IOW('a', 5, struct timespec)
     46 #define ANDROID_ALARM_SET_TIMEZONE          _IOW('a', 6, struct timezone)
     47 
     48 #define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0)))
     49 #define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4)
     50 
     51 #endif
     52