May 2024 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
001: /* 002: * Generic RTC interface. 003: * This version contains the part of the user interface to the Real Time Clock 004: * service. It is used with both the legacy mc146818 and also EFI 005: * Struct rtc_time and first 12 ioctl by Paul Gortmaker, 1996 - separated out 006: * from <linux/mc146818rtc.h> to this file for 2.4 kernels. 007: * 008: * Copyright (C) 1999 Hewlett-Packard Co. 009: * Copyright (C) 1999 Stephane Eranian <eranian@hpl.hp.com> 010: */ 011: #ifndef _LINUX_RTC_H_ 012: #define _LINUX_RTC_H_ 013: 014: /* 015: * The struct used to pass data via the following ioctl. Similar to the 016: * struct tm in <time.h>, but it needs to be here so that the kernel 017: * source is self contained, allowing cross-compiles, etc. etc. 018: */ 019: 020: struct rtc_time { 021: int tm_sec; 022: int tm_min; 023: int tm_hour; 024: int tm_mday; 025: int tm_mon; 026: int tm_year; 027: int tm_wday; 028: int tm_yday; 029: int tm_isdst; 030: }; 031: 032: /* 033: * This data structure is inspired by the EFI (v0.92) wakeup 034: * alarm API. 035: */ 036: struct rtc_wkalrm { 037: unsigned char enabled; /* 0 = alarm disabled, 1 = alarm enabled */ 038: unsigned char pending; /* 0 = alarm not pending, 1 = alarm pending */ 039: struct rtc_time time; /* time the alarm is set to */ 040: }; 041: 042: /* 043: * Data structure to control PLL correction some better RTC feature 044: * pll_value is used to get or set current value of correction, 045: * the rest of the struct is used to query HW capabilities. 046: * This is modeled after the RTC used in Q40/Q60 computers but 047: * should be sufficiently flexible for other devices 048: * 049: * +ve pll_value means clock will run faster by 050: * pll_value*pll_posmult/pll_clock 051: * -ve pll_value means clock will run slower by 052: * pll_value*pll_negmult/pll_clock 053: */ 054: 055: struct rtc_pll_info { 056: int pll_ctrl; /* placeholder for fancier control */ 057: int pll_value; /* get/set correction value */ 058: int pll_max; /* max +ve (faster) adjustment value */ 059: int pll_min; /* max -ve (slower) adjustment value */ 060: int pll_posmult; /* factor for +ve correction */ 061: int pll_negmult; /* factor for -ve correction */ 062: long pll_clock; /* base PLL frequency */ 063: }; 064: 065: /* 066: * ioctl calls that are permitted to the /dev/rtc interface, if 067: * any of the RTC drivers are enabled. 068: */ 069: 070: #define RTC_AIE_ON _IO('p', 0x01) /* Alarm int. enable on */ 071: #define RTC_AIE_OFF _IO('p', 0x02) /* ... off */ 072: #define RTC_UIE_ON _IO('p', 0x03) /* Update int. enable on */ 073: #define RTC_UIE_OFF _IO('p', 0x04) /* ... off */ 074: #define RTC_PIE_ON _IO('p', 0x05) /* Periodic int. enable on */ 075: #define RTC_PIE_OFF _IO('p', 0x06) /* ... off */ 076: #define RTC_WIE_ON _IO('p', 0x0f) /* Watchdog int. enable on */ 077: #define RTC_WIE_OFF _IO('p', 0x10) /* ... off */ 078: 079: #define RTC_ALM_SET _IOW('p', 0x07, struct rtc_time) /* Set alarm time */ 080: #define RTC_ALM_READ _IOR('p', 0x08, struct rtc_time) /* Read alarm time */ 081: #define RTC_RD_TIME _IOR('p', 0x09, struct rtc_time) /* Read RTC time */ 082: #define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) /* Set RTC time */ 083: #define RTC_IRQP_READ _IOR('p', 0x0b, unsigned long) /* Read IRQ rate */ 084: #define RTC_IRQP_SET _IOW('p', 0x0c, unsigned long) /* Set IRQ rate */ 085: #define RTC_EPOCH_READ _IOR('p', 0x0d, unsigned long) /* Read epoch */ 086: #define RTC_EPOCH_SET _IOW('p', 0x0e, unsigned long) /* Set epoch */ 087: 088: #define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)/* Set wakeup alarm*/ 089: #define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)/* Get wakeup alarm*/ 090: 091: #define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */ 092: #define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */ 093: 094: /* interrupt flags */ 095: #define RTC_IRQF 0x80 /* Any of the following is active */ 096: #define RTC_PF 0x40 /* Periodic interrupt */ 097: #define RTC_AF 0x20 /* Alarm interrupt */ 098: #define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */ 099: 100: 101: #define RTC_MAX_FREQ 8192 102: 103: 104: #endif /* _LINUX_RTC_H_ */ 105: