0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef _UAPI_LINUX_RTC_H_
0013 #define _UAPI_LINUX_RTC_H_
0014
0015 #include <linux/const.h>
0016 #include <linux/ioctl.h>
0017 #include <linux/types.h>
0018
0019
0020
0021
0022
0023
0024
0025 struct rtc_time {
0026 int tm_sec;
0027 int tm_min;
0028 int tm_hour;
0029 int tm_mday;
0030 int tm_mon;
0031 int tm_year;
0032 int tm_wday;
0033 int tm_yday;
0034 int tm_isdst;
0035 };
0036
0037
0038
0039
0040
0041 struct rtc_wkalrm {
0042 unsigned char enabled;
0043 unsigned char pending;
0044 struct rtc_time time;
0045 };
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 struct rtc_pll_info {
0061 int pll_ctrl;
0062 int pll_value;
0063 int pll_max;
0064 int pll_min;
0065 int pll_posmult;
0066 int pll_negmult;
0067 long pll_clock;
0068 };
0069
0070 struct rtc_param {
0071 __u64 param;
0072 union {
0073 __u64 uvalue;
0074 __s64 svalue;
0075 __u64 ptr;
0076 };
0077 __u32 index;
0078 __u32 __pad;
0079 };
0080
0081
0082
0083
0084
0085
0086 #define RTC_AIE_ON _IO('p', 0x01)
0087 #define RTC_AIE_OFF _IO('p', 0x02)
0088 #define RTC_UIE_ON _IO('p', 0x03)
0089 #define RTC_UIE_OFF _IO('p', 0x04)
0090 #define RTC_PIE_ON _IO('p', 0x05)
0091 #define RTC_PIE_OFF _IO('p', 0x06)
0092 #define RTC_WIE_ON _IO('p', 0x0f)
0093 #define RTC_WIE_OFF _IO('p', 0x10)
0094
0095 #define RTC_ALM_SET _IOW('p', 0x07, struct rtc_time)
0096 #define RTC_ALM_READ _IOR('p', 0x08, struct rtc_time)
0097 #define RTC_RD_TIME _IOR('p', 0x09, struct rtc_time)
0098 #define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time)
0099 #define RTC_IRQP_READ _IOR('p', 0x0b, unsigned long)
0100 #define RTC_IRQP_SET _IOW('p', 0x0c, unsigned long)
0101 #define RTC_EPOCH_READ _IOR('p', 0x0d, unsigned long)
0102 #define RTC_EPOCH_SET _IOW('p', 0x0e, unsigned long)
0103
0104 #define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)
0105 #define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)
0106
0107 #define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info)
0108 #define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info)
0109
0110 #define RTC_PARAM_GET _IOW('p', 0x13, struct rtc_param)
0111 #define RTC_PARAM_SET _IOW('p', 0x14, struct rtc_param)
0112
0113 #define RTC_VL_DATA_INVALID _BITUL(0)
0114 #define RTC_VL_BACKUP_LOW _BITUL(1)
0115 #define RTC_VL_BACKUP_EMPTY _BITUL(2)
0116 #define RTC_VL_ACCURACY_LOW _BITUL(3)
0117 #define RTC_VL_BACKUP_SWITCH _BITUL(4)
0118
0119 #define RTC_VL_READ _IOR('p', 0x13, unsigned int)
0120 #define RTC_VL_CLR _IO('p', 0x14)
0121
0122
0123 #define RTC_IRQF 0x80
0124 #define RTC_PF 0x40
0125 #define RTC_AF 0x20
0126 #define RTC_UF 0x10
0127
0128
0129 #define RTC_FEATURE_ALARM 0
0130 #define RTC_FEATURE_ALARM_RES_MINUTE 1
0131 #define RTC_FEATURE_NEED_WEEK_DAY 2
0132 #define RTC_FEATURE_ALARM_RES_2S 3
0133 #define RTC_FEATURE_UPDATE_INTERRUPT 4
0134 #define RTC_FEATURE_CORRECTION 5
0135 #define RTC_FEATURE_BACKUP_SWITCH_MODE 6
0136 #define RTC_FEATURE_ALARM_WAKEUP_ONLY 7
0137 #define RTC_FEATURE_CNT 8
0138
0139
0140 #define RTC_PARAM_FEATURES 0
0141 #define RTC_PARAM_CORRECTION 1
0142 #define RTC_PARAM_BACKUP_SWITCH_MODE 2
0143
0144 #define RTC_BSM_DISABLED 0
0145 #define RTC_BSM_DIRECT 1
0146 #define RTC_BSM_LEVEL 2
0147 #define RTC_BSM_STANDBY 3
0148
0149 #define RTC_MAX_FREQ 8192
0150
0151
0152 #endif