diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-02-15 08:19:23 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-02-15 08:19:23 -0600 |
commit | 214bc50965d7074213db4dbab8e1b3105ba72b3c (patch) | |
tree | 275fc436e05d9e436a76de219f6b29befbf801d2 /nuttx/drivers | |
parent | 2724d87aed90a1735fec74fb4d7afffef443ca48 (diff) | |
download | px4-nuttx-214bc50965d7074213db4dbab8e1b3105ba72b3c.tar.gz px4-nuttx-214bc50965d7074213db4dbab8e1b3105ba72b3c.tar.bz2 px4-nuttx-214bc50965d7074213db4dbab8e1b3105ba72b3c.zip |
RTC: A little more clean-up of the RTC driver
Diffstat (limited to 'nuttx/drivers')
-rw-r--r-- | nuttx/drivers/timers/Kconfig | 42 | ||||
-rw-r--r-- | nuttx/drivers/timers/rtc.c | 14 |
2 files changed, 51 insertions, 5 deletions
diff --git a/nuttx/drivers/timers/Kconfig b/nuttx/drivers/timers/Kconfig index cf05db345..af0fb3e42 100644 --- a/nuttx/drivers/timers/Kconfig +++ b/nuttx/drivers/timers/Kconfig @@ -61,6 +61,16 @@ config RTC_FREQUENCY endif # !RTC_DATETIME +config RTC_DRIVER + bool "RTC Driver Support" + default n + ---help--- + This selection enables building of the "upper-half" RTC + driver. See include/nuttx/rtc.h for further RTC driver + information. + +if RTC_DRIVER + config RTC_ALARM bool "RTC Alarm Support" default n @@ -68,14 +78,36 @@ config RTC_ALARM Enable if the RTC hardware supports setting of an alarm. A callback function will be executed when the alarm goes off. -config RTC_DRIVER - bool "RTC Driver Support" +config RTC_PERIODIC + bool "RTC Periodic Interrupts" default n + depends on EXPERIMENTAL ---help--- - This selection enables building of the "upper-half" RTC - driver. See include/nuttx/rtc.h for further RTC driver - information. + Add interrupt controls for RTCs that support periodic interrupts. + +config RTC_ONESEC + bool "RTC Once-per-second interrupts" + default n + depends on EXPERIMENTAL + ---help--- + Add interrupt controls for RTCs that support once-per-second interrupts. + +config RTC_EPOCHYEAR + bool "RTC epoch year" + default n + depends on EXPERIMENTAL + ---help--- + Add controls for RTCs that support epoch year settings. + + Many RTCs encode the year in an 8-bit register which is either interpreted + as an 8-bit binary number or as a BCD number. In both cases, the number is + interpreted relative to this RTC's Epoch. The RTC's Epoch is initialized to + 1900 on most systems but on Alpha and MIPS it might also be initialized to + 1952, 1980, or 2000, depending on the value of an RTC register for the year. + With some RTCs, these operations can be used to read or to set the RTC's + Epoch, respectively. +endif # RTC_DRIVER endif # RTC menuconfig WATCHDOG diff --git a/nuttx/drivers/timers/rtc.c b/nuttx/drivers/timers/rtc.c index 74f041c8c..1d4a0c827 100644 --- a/nuttx/drivers/timers/rtc.c +++ b/nuttx/drivers/timers/rtc.c @@ -264,6 +264,7 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } break; +#ifdef CONFIG_RTC_ALARM /* RTC_ALM_READ reads the alarm time (for RTCs that support alarms) * * Argument: A writeable reference to a struct rtc_time to receive the @@ -298,7 +299,9 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } } break; +#endif /* CONFIG_RTC_ALARM */ +#ifdef CONFIG_RTC_PERIODIC /* RTC_IRQP_READ read the frequency for periodic interrupts (for RTCs * that support periodic interrupts) * @@ -331,7 +334,9 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } } break; +#endif /* CONFIG_RTC_PERIODIC */ +#ifdef CONFIG_RTC_ALARM /* RTC_AIE_ON enable alarm interrupts (for RTCs that support alarms) * * Argument: None @@ -360,7 +365,9 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } } break; +#endif /* CONFIG_RTC_ALARM */ +#ifdef CONFIG_RTC_ONESEC /* RTC_UIE_ON enable the interrupt on every clock update (for RTCs that * support this once-per-second interrupt). * @@ -390,7 +397,9 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } } break; +#endif /* CONFIG_RTC_ONESEC */ +#ifdef CONFIG_RTC_PERIODIC /* RTC_PIE_ON enable the periodic interrupt (for RTCs that support these * periodic interrupts). * @@ -420,7 +429,9 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } } break; +#endif /* CONFIG_RTC_PERIODIC */ +#ifdef CONFIG_RTC_EPOCHYEAR /* RTC_EPOCH_READ read the Epoch. * * Argument: A reference to a writeable unsigned low variable that will @@ -452,7 +463,9 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } } break; +#endif /* CONFIG_RTC_EPOCHYEAR */ +#ifdef CONFIG_RTC_ALARM /* RTC_WKALM_RD read the current alarm * * Argument: A writeable reference to struct rtc_wkalrm to receive the @@ -487,6 +500,7 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } } break; +#endif /* CONFIG_RTC_ALARM */ default: ret = -ENOTTY; |