From 05988ab6d7bd07be7f874e78a89fea1e6e7cf9c3 Mon Sep 17 00:00:00 2001
From: Gregory Nutt
Date: Wed, 1 Apr 2015 12:37:44 -0600
Subject: Move include/nuttx/timer.h, rtc.h and watchdog.h to
include/nuttx/timers/.
---
nuttx/Documentation/NuttxPortingGuide.html | 6 +-
nuttx/arch/arm/src/c5471/c5471_watchdog.c | 2 +-
nuttx/arch/arm/src/sam34/sam_rtt.c | 2 +-
nuttx/arch/arm/src/sam34/sam_tc.c | 2 +-
nuttx/arch/arm/src/sam34/sam_wdt.c | 2 +-
nuttx/arch/arm/src/sama5/sam_wdt.c | 2 +-
nuttx/arch/arm/src/stm32/stm32_iwdg.c | 2 +-
nuttx/arch/arm/src/stm32/stm32_rtc.h | 2 +-
nuttx/arch/arm/src/stm32/stm32_rtc_lowerhalf.c | 4 +-
nuttx/arch/arm/src/stm32/stm32_rtcounter.c | 2 +-
nuttx/arch/arm/src/stm32/stm32_wwdg.c | 2 +-
nuttx/arch/arm/src/tiva/tiva_timerlow32.c | 2 +-
nuttx/configs/cloudctrl/src/stm32_watchdog.c | 2 +-
nuttx/configs/fire-stm32v2/src/stm32_watchdog.c | 2 +-
nuttx/configs/hymini-stm32v/src/stm32_watchdog.c | 2 +-
nuttx/configs/maple/src/stm32_watchdog.c | 2 +-
nuttx/configs/mikroe-stm32f4/src/stm32_watchdog.c | 2 +-
nuttx/configs/sam4s-xplained-pro/src/sam_boot.c | 2 +-
nuttx/configs/sam4s-xplained-pro/src/sam_nsh.c | 2 +-
nuttx/configs/sam4s-xplained-pro/src/sam_tc.c | 2 +-
nuttx/configs/sam4s-xplained-pro/src/sam_wdt.c | 2 +-
nuttx/configs/shenzhou/src/stm32_watchdog.c | 2 +-
nuttx/configs/spark/src/stm32_watchdog.c | 2 +-
nuttx/configs/stm3210e-eval/src/stm32_watchdog.c | 2 +-
nuttx/configs/stm3220g-eval/src/stm32_watchdog.c | 2 +-
nuttx/configs/stm3240g-eval/src/stm32_watchdog.c | 2 +-
nuttx/configs/stm32_tiny/src/stm32_watchdog.c | 2 +-
.../configs/stm32f3discovery/src/stm32_watchdog.c | 2 +-
nuttx/configs/stm32f4discovery/src/stm32_bringup.c | 2 +-
.../configs/stm32f4discovery/src/stm32_watchdog.c | 2 +-
nuttx/configs/stm32ldiscovery/src/stm32_watchdog.c | 2 +-
nuttx/drivers/README.txt | 4 +-
nuttx/drivers/timers/Kconfig | 8 +-
nuttx/drivers/timers/rtc.c | 2 +-
nuttx/drivers/timers/timer.c | 2 +-
nuttx/drivers/timers/watchdog.c | 2 +-
nuttx/include/nuttx/rtc.h | 490 ---------------------
nuttx/include/nuttx/timer.h | 265 -----------
nuttx/include/nuttx/timers/rtc.h | 490 +++++++++++++++++++++
nuttx/include/nuttx/timers/timer.h | 265 +++++++++++
nuttx/include/nuttx/timers/watchdog.h | 294 +++++++++++++
nuttx/include/nuttx/watchdog.h | 294 -------------
nuttx/include/time.h | 2 +-
43 files changed, 1093 insertions(+), 1093 deletions(-)
delete mode 100644 nuttx/include/nuttx/rtc.h
delete mode 100644 nuttx/include/nuttx/timer.h
create mode 100644 nuttx/include/nuttx/timers/rtc.h
create mode 100644 nuttx/include/nuttx/timers/timer.h
create mode 100644 nuttx/include/nuttx/timers/watchdog.h
delete mode 100644 nuttx/include/nuttx/watchdog.h
(limited to 'nuttx')
diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html
index 8695be591..2f6c63f2c 100644
--- a/nuttx/Documentation/NuttxPortingGuide.html
+++ b/nuttx/Documentation/NuttxPortingGuide.html
@@ -4598,7 +4598,7 @@ void board_led_off(int led);
- Interface Definition.
- The header file for the NuttX timer driver reside at
include/nuttx/timer.h
.
+ The header file for the NuttX timer driver reside at include/nuttx/timers/timer.h
.
This header file includes both the application level interface to the timer driver as well as the interface between the "upper half" and "lower half" drivers.
The timer driver uses a standard character driver framework.
@@ -4627,7 +4627,7 @@ void board_led_off(int led);
- Interface Definition.
- The header file for the NuttX RTC driver reside at
include/nuttx/rtc.h
.
+ The header file for the NuttX RTC driver reside at include/nuttx/timers/rtc.h
.
This header file includes both the application level interface to the RTC driver as well as the interface between the "upper half" and "lower half" drivers.
The RTC driver uses a standard character driver framework.
@@ -4656,7 +4656,7 @@ void board_led_off(int led);
- Interface Definition.
- The header file for the NuttX watchdog timer driver reside at
include/nuttx/watchdog.h
.
+ The header file for the NuttX watchdog timer driver reside at include/nuttx/timers/watchdog.h
.
This header file includes both the application level interface to the watchdog timer driver as well as the interface between the "upper half" and "lower half" drivers.
The watchdog timer driver uses a standard character driver framework.
diff --git a/nuttx/arch/arm/src/c5471/c5471_watchdog.c b/nuttx/arch/arm/src/c5471/c5471_watchdog.c
index a77ed6d8b..e09cfbdae 100644
--- a/nuttx/arch/arm/src/c5471/c5471_watchdog.c
+++ b/nuttx/arch/arm/src/c5471/c5471_watchdog.c
@@ -48,7 +48,7 @@
#include
#include
-#include
+#include
#include
#include "chip.h"
diff --git a/nuttx/arch/arm/src/sam34/sam_rtt.c b/nuttx/arch/arm/src/sam34/sam_rtt.c
index da223e211..9e0293fcb 100644
--- a/nuttx/arch/arm/src/sam34/sam_rtt.c
+++ b/nuttx/arch/arm/src/sam34/sam_rtt.c
@@ -46,7 +46,7 @@
#include
#include
#include
-#include
+#include
#include
#include "up_arch.h"
diff --git a/nuttx/arch/arm/src/sam34/sam_tc.c b/nuttx/arch/arm/src/sam34/sam_tc.c
index 470c7c77c..9b55d9c5c 100644
--- a/nuttx/arch/arm/src/sam34/sam_tc.c
+++ b/nuttx/arch/arm/src/sam34/sam_tc.c
@@ -47,7 +47,7 @@
#include
#include
-#include
+#include
#include
#include "up_arch.h"
diff --git a/nuttx/arch/arm/src/sam34/sam_wdt.c b/nuttx/arch/arm/src/sam34/sam_wdt.c
index 7ed5d9dd5..f60b58661 100644
--- a/nuttx/arch/arm/src/sam34/sam_wdt.c
+++ b/nuttx/arch/arm/src/sam34/sam_wdt.c
@@ -47,7 +47,7 @@
#include
#include
-#include
+#include
#include
#include "up_arch.h"
diff --git a/nuttx/arch/arm/src/sama5/sam_wdt.c b/nuttx/arch/arm/src/sama5/sam_wdt.c
index 706f8e8a3..b04e13260 100644
--- a/nuttx/arch/arm/src/sama5/sam_wdt.c
+++ b/nuttx/arch/arm/src/sama5/sam_wdt.c
@@ -44,7 +44,7 @@
#include
#include
-#include
+#include
#include
#include "up_arch.h"
diff --git a/nuttx/arch/arm/src/stm32/stm32_iwdg.c b/nuttx/arch/arm/src/stm32/stm32_iwdg.c
index ad5ae7819..a4e80b8dd 100644
--- a/nuttx/arch/arm/src/stm32/stm32_iwdg.c
+++ b/nuttx/arch/arm/src/stm32/stm32_iwdg.c
@@ -45,7 +45,7 @@
#include
#include
-#include
+#include
#include
#include "up_arch.h"
diff --git a/nuttx/arch/arm/src/stm32/stm32_rtc.h b/nuttx/arch/arm/src/stm32/stm32_rtc.h
index 19ea7621b..f873bd28f 100644
--- a/nuttx/arch/arm/src/stm32/stm32_rtc.h
+++ b/nuttx/arch/arm/src/stm32/stm32_rtc.h
@@ -189,7 +189,7 @@ int stm32_rtc_cancelalarm(void);
* Description:
* Instantiate the RTC lower half driver for the STM32. General usage:
*
- * #include
+ * #include
* #include "stm32_rtc.h>
*
* struct rtc_lowerhalf_s *lower;
diff --git a/nuttx/arch/arm/src/stm32/stm32_rtc_lowerhalf.c b/nuttx/arch/arm/src/stm32/stm32_rtc_lowerhalf.c
index ecc64f47a..aff1575be 100644
--- a/nuttx/arch/arm/src/stm32/stm32_rtc_lowerhalf.c
+++ b/nuttx/arch/arm/src/stm32/stm32_rtc_lowerhalf.c
@@ -44,7 +44,7 @@
#include
#include
-#include
+#include
#include "chip.h"
#include "stm32_rtc.h"
@@ -265,7 +265,7 @@ static int stm32_settime(FAR struct rtc_lowerhalf_s *lower,
* Description:
* Instantiate the RTC lower half driver for the STM32. General usage:
*
- * #include
+ * #include
* #include "stm32_rtc.h>
*
* struct rtc_lowerhalf_s *lower;
diff --git a/nuttx/arch/arm/src/stm32/stm32_rtcounter.c b/nuttx/arch/arm/src/stm32/stm32_rtcounter.c
index e27f5a54d..c5842f2af 100644
--- a/nuttx/arch/arm/src/stm32/stm32_rtcounter.c
+++ b/nuttx/arch/arm/src/stm32/stm32_rtcounter.c
@@ -61,7 +61,7 @@
#include
#include
#include
-#include
+#include
#include
#include
diff --git a/nuttx/arch/arm/src/stm32/stm32_wwdg.c b/nuttx/arch/arm/src/stm32/stm32_wwdg.c
index 2f5208aa3..3b056af6c 100644
--- a/nuttx/arch/arm/src/stm32/stm32_wwdg.c
+++ b/nuttx/arch/arm/src/stm32/stm32_wwdg.c
@@ -44,7 +44,7 @@
#include
#include
-#include
+#include
#include
#include "up_arch.h"
diff --git a/nuttx/arch/arm/src/tiva/tiva_timerlow32.c b/nuttx/arch/arm/src/tiva/tiva_timerlow32.c
index a4226c62e..458ab8fa0 100644
--- a/nuttx/arch/arm/src/tiva/tiva_timerlow32.c
+++ b/nuttx/arch/arm/src/tiva/tiva_timerlow32.c
@@ -48,7 +48,7 @@
#include
#include
-#include
+#include
#include
diff --git a/nuttx/configs/cloudctrl/src/stm32_watchdog.c b/nuttx/configs/cloudctrl/src/stm32_watchdog.c
index 04a8b5fe2..0497c9aa0 100644
--- a/nuttx/configs/cloudctrl/src/stm32_watchdog.c
+++ b/nuttx/configs/cloudctrl/src/stm32_watchdog.c
@@ -43,7 +43,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/fire-stm32v2/src/stm32_watchdog.c b/nuttx/configs/fire-stm32v2/src/stm32_watchdog.c
index ce1e3ec16..dd420c342 100644
--- a/nuttx/configs/fire-stm32v2/src/stm32_watchdog.c
+++ b/nuttx/configs/fire-stm32v2/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/hymini-stm32v/src/stm32_watchdog.c b/nuttx/configs/hymini-stm32v/src/stm32_watchdog.c
index 386efd8d6..db143f67b 100644
--- a/nuttx/configs/hymini-stm32v/src/stm32_watchdog.c
+++ b/nuttx/configs/hymini-stm32v/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/maple/src/stm32_watchdog.c b/nuttx/configs/maple/src/stm32_watchdog.c
index 9110efac4..af65f057d 100644
--- a/nuttx/configs/maple/src/stm32_watchdog.c
+++ b/nuttx/configs/maple/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/mikroe-stm32f4/src/stm32_watchdog.c b/nuttx/configs/mikroe-stm32f4/src/stm32_watchdog.c
index 3d59646e2..71cf65061 100644
--- a/nuttx/configs/mikroe-stm32f4/src/stm32_watchdog.c
+++ b/nuttx/configs/mikroe-stm32f4/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/sam4s-xplained-pro/src/sam_boot.c b/nuttx/configs/sam4s-xplained-pro/src/sam_boot.c
index 607bc3557..981b2d7ce 100644
--- a/nuttx/configs/sam4s-xplained-pro/src/sam_boot.c
+++ b/nuttx/configs/sam4s-xplained-pro/src/sam_boot.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "sam4s-xplained-pro.h"
diff --git a/nuttx/configs/sam4s-xplained-pro/src/sam_nsh.c b/nuttx/configs/sam4s-xplained-pro/src/sam_nsh.c
index 8c9293455..a3025f98d 100644
--- a/nuttx/configs/sam4s-xplained-pro/src/sam_nsh.c
+++ b/nuttx/configs/sam4s-xplained-pro/src/sam_nsh.c
@@ -60,7 +60,7 @@
#endif
#ifdef CONFIG_TIMER
-# include
+# include
#endif
#ifdef CONFIG_SYSTEM_USBMONITOR
diff --git a/nuttx/configs/sam4s-xplained-pro/src/sam_tc.c b/nuttx/configs/sam4s-xplained-pro/src/sam_tc.c
index bad80cc3e..8d228f3b8 100755
--- a/nuttx/configs/sam4s-xplained-pro/src/sam_tc.c
+++ b/nuttx/configs/sam4s-xplained-pro/src/sam_tc.c
@@ -49,7 +49,7 @@
#include
#include
-#include
+#include
#include
#include
diff --git a/nuttx/configs/sam4s-xplained-pro/src/sam_wdt.c b/nuttx/configs/sam4s-xplained-pro/src/sam_wdt.c
index 4df566c98..c43fb1b8e 100644
--- a/nuttx/configs/sam4s-xplained-pro/src/sam_wdt.c
+++ b/nuttx/configs/sam4s-xplained-pro/src/sam_wdt.c
@@ -48,7 +48,7 @@
#include
#include
-#include
+#include
#include
#include
diff --git a/nuttx/configs/shenzhou/src/stm32_watchdog.c b/nuttx/configs/shenzhou/src/stm32_watchdog.c
index 8c689f0a9..ba14425cf 100644
--- a/nuttx/configs/shenzhou/src/stm32_watchdog.c
+++ b/nuttx/configs/shenzhou/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/spark/src/stm32_watchdog.c b/nuttx/configs/spark/src/stm32_watchdog.c
index a27261ce8..1c41b1ddc 100644
--- a/nuttx/configs/spark/src/stm32_watchdog.c
+++ b/nuttx/configs/spark/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/stm3210e-eval/src/stm32_watchdog.c b/nuttx/configs/stm3210e-eval/src/stm32_watchdog.c
index c44d74bdd..5aab00353 100644
--- a/nuttx/configs/stm3210e-eval/src/stm32_watchdog.c
+++ b/nuttx/configs/stm3210e-eval/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/stm3220g-eval/src/stm32_watchdog.c b/nuttx/configs/stm3220g-eval/src/stm32_watchdog.c
index 215092a04..a00a4b91a 100644
--- a/nuttx/configs/stm3220g-eval/src/stm32_watchdog.c
+++ b/nuttx/configs/stm3220g-eval/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/stm3240g-eval/src/stm32_watchdog.c b/nuttx/configs/stm3240g-eval/src/stm32_watchdog.c
index ef93c86c1..3583db2cf 100644
--- a/nuttx/configs/stm3240g-eval/src/stm32_watchdog.c
+++ b/nuttx/configs/stm3240g-eval/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/stm32_tiny/src/stm32_watchdog.c b/nuttx/configs/stm32_tiny/src/stm32_watchdog.c
index a722dd737..a2ae5963f 100644
--- a/nuttx/configs/stm32_tiny/src/stm32_watchdog.c
+++ b/nuttx/configs/stm32_tiny/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/stm32f3discovery/src/stm32_watchdog.c b/nuttx/configs/stm32f3discovery/src/stm32_watchdog.c
index ff8072f31..72bc6b548 100644
--- a/nuttx/configs/stm32f3discovery/src/stm32_watchdog.c
+++ b/nuttx/configs/stm32f3discovery/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/stm32f4discovery/src/stm32_bringup.c b/nuttx/configs/stm32f4discovery/src/stm32_bringup.c
index 0e4f55b43..30caca3e7 100644
--- a/nuttx/configs/stm32f4discovery/src/stm32_bringup.c
+++ b/nuttx/configs/stm32f4discovery/src/stm32_bringup.c
@@ -62,7 +62,7 @@
*/
#ifdef HAVE_RTC_DRIVER
-# include
+# include
# include "stm32_rtc.h"
#endif
diff --git a/nuttx/configs/stm32f4discovery/src/stm32_watchdog.c b/nuttx/configs/stm32f4discovery/src/stm32_watchdog.c
index c1a659d0e..79809f284 100644
--- a/nuttx/configs/stm32f4discovery/src/stm32_watchdog.c
+++ b/nuttx/configs/stm32f4discovery/src/stm32_watchdog.c
@@ -42,7 +42,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/configs/stm32ldiscovery/src/stm32_watchdog.c b/nuttx/configs/stm32ldiscovery/src/stm32_watchdog.c
index ec6a569ee..d4faf0e6a 100644
--- a/nuttx/configs/stm32ldiscovery/src/stm32_watchdog.c
+++ b/nuttx/configs/stm32ldiscovery/src/stm32_watchdog.c
@@ -43,7 +43,7 @@
#include
#include
-#include
+#include
#include
#include "stm32_wdg.h"
diff --git a/nuttx/drivers/README.txt b/nuttx/drivers/README.txt
index 9c8c4d9b7..39b461092 100644
--- a/nuttx/drivers/README.txt
+++ b/nuttx/drivers/README.txt
@@ -38,7 +38,7 @@ ramdisk.c
timer.c
Provides the "upper half" for a generic timer driver. See
- include/nuttx/timer.h for more information.
+ include/nuttx/timers/timer.h for more information.
rwbuffer.c
A facility that can be use by any block driver in-order to add
@@ -46,7 +46,7 @@ rwbuffer.c
watchdog.c
Provides the "upper half" for a generic watchdog driver. See
- include/nuttx/watchdog.h for more information.
+ include/nuttx/timers/watchdog.h for more information.
Subdirectories of this directory:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/nuttx/drivers/timers/Kconfig b/nuttx/drivers/timers/Kconfig
index 5e918b65b..2502b1d8d 100644
--- a/nuttx/drivers/timers/Kconfig
+++ b/nuttx/drivers/timers/Kconfig
@@ -8,7 +8,7 @@ menuconfig TIMER
default n
---help---
This selection enables building of the "upper-half" timer
- driver. See include/nuttx/timer.h for further timer driver
+ driver. See include/nuttx/timers/timer.h for further timer driver
information.
menuconfig RTC
@@ -16,7 +16,7 @@ menuconfig RTC
default n
---help---
This selection enables configuration of a real time clock (RTCdriver.
- See include/nuttx/rtc.h for further RTC driver information.
+ See include/nuttx/timers/rtc.h for further RTC driver information.
Most RTC drivers are MCU specific and may require other specific
settings.
@@ -73,7 +73,7 @@ config RTC_DRIVER
default n
---help---
This selection enables building of the "upper-half" RTC
- driver. See include/nuttx/rtc.h for further RTC driver
+ driver. See include/nuttx/timers/rtc.h for further RTC driver
information.
if RTC_DRIVER
@@ -122,7 +122,7 @@ menuconfig WATCHDOG
default n
---help---
This selection enables building of the "upper-half" watchdog timer
- driver. See include/nuttx/watchdog.h for further watchdog timer driver
+ driver. See include/nuttx/timers/watchdog.h for further watchdog timer driver
information.
if WATCHDOG
diff --git a/nuttx/drivers/timers/rtc.c b/nuttx/drivers/timers/rtc.c
index 68f7366af..6d39b6c99 100644
--- a/nuttx/drivers/timers/rtc.c
+++ b/nuttx/drivers/timers/rtc.c
@@ -47,7 +47,7 @@
#include
#include
-#include
+#include
/****************************************************************************
* Private Types
diff --git a/nuttx/drivers/timers/timer.c b/nuttx/drivers/timers/timer.c
index fe81fc44f..57c2c0eca 100644
--- a/nuttx/drivers/timers/timer.c
+++ b/nuttx/drivers/timers/timer.c
@@ -53,7 +53,7 @@
#include
#include
#include
-#include
+#include
#ifdef CONFIG_TIMER
diff --git a/nuttx/drivers/timers/watchdog.c b/nuttx/drivers/timers/watchdog.c
index d46f7f99e..e6bef99ac 100644
--- a/nuttx/drivers/timers/watchdog.c
+++ b/nuttx/drivers/timers/watchdog.c
@@ -52,7 +52,7 @@
#include
#include
#include
-#include
+#include
#ifdef CONFIG_WATCHDOG
diff --git a/nuttx/include/nuttx/rtc.h b/nuttx/include/nuttx/rtc.h
deleted file mode 100644
index 5f7b40778..000000000
--- a/nuttx/include/nuttx/rtc.h
+++ /dev/null
@@ -1,490 +0,0 @@
-/****************************************************************************
- * include/nuttx/rtc.h
- *
- * Copyright(C) 2011 Uros Platise. All rights reserved.
- * Author: Uros Platise
- *
- * With extensions, modifications by:
- *
- * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
- * Author: Gregroy Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-#ifndef __INCLUDE_NUTTX_RTC_H
-#define __INCLUDE_NUTTX_RTC_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-#include
-
-#include
-
-#ifdef CONFIG_RTC
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-/* Configuration ************************************************************/
-/* CONFIG_RTC - Enables general support for a hardware RTC. Specific
- * architectures may require other specific settings.
- *
- * CONFIG_RTC_DATETIME - There are two general types of RTC: (1) A simple
- * battery backed counter that keeps the time when power is down, and (2)
- * A full date / time RTC the provides the date and time information, often
- * in BCD format. If CONFIG_RTC_DATETIME is selected, it specifies this
- * second kind of RTC. In this case, the RTC is used to "seed" the normal
- * NuttX timer and the NuttX system timer provides for higher resolution
- * time.
- *
- * CONFIG_RTC_HIRES - If CONFIG_RTC_DATETIME not selected, then the simple,
- * battery backed counter is used. There are two different implementations
- * of such simple counters based on the time resolution of the counter:
- * The typical RTC keeps time to resolution of 1 second, usually
- * supporting a 32-bit time_t value. In this case, the RTC is used to
- * "seed" the normal NuttX timer and the NuttX timer provides for higher
- * resolution time.
- *
- * If CONFIG_RTC_HIRES is enabled in the NuttX configuration, then the
- * RTC provides higher resolution time and completely replaces the system
- * timer for purpose of date and time.
- *
- * CONFIG_RTC_FREQUENCY - If CONFIG_RTC_HIRES is defined, then the frequency
- * of the high resolution RTC must be provided. If CONFIG_RTC_HIRES is
- * not defined, CONFIG_RTC_FREQUENCY is assumed to be one.
- *
- * 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 - Enable building the upper-half RTC driver
- */
-
-#ifdef CONFIG_RTC_HIRES
-# ifdef CONFIG_RTC_DATETIME
-# error "CONFIG_RTC_HIRES and CONFIG_RTC_DATETIME are both defined"
-# endif
-# ifndef CONFIG_RTC_FREQUENCY
-# error "CONFIG_RTC_FREQUENCY is required for CONFIG_RTC_HIRES"
-# endif
-#else
-# ifndef CONFIG_RTC_FREQUENCY
-# define CONFIG_RTC_FREQUENCY 1
-# endif
-# if CONFIG_RTC_FREQUENCY != 1
-# error "The low resolution RTC must have frequency 1Hz"
-# endif
-#endif
-
-/* The remainder of the contain of this header file is only valid if the
- * RTC upper half driver is built.
- */
-
-#if CONFIG_RTC_DRIVER
-
-/* IOCTL Commands ***********************************************************/
-/* RTC driver IOCTL commands. These are Linux compatible command names, not
- * all of these commands are supported by all RTC drivers, however.
- */
-
-/* RTC_RD_TIME returns the current RTC time.
- *
- * Argument: A writeable reference to a struct rtc_time to receive the RTC's
- * time.
- */
-
-#define RTC_RD_TIME _RTCIOC(0x0001)
-
-/* RTC_SET_TIME sets the RTC's time
- *
- * Argument: A read-only reference to a struct rtc_time containing the
- * new time to be set.
- */
-
-#define RTC_SET_TIME _RTCIOC(0x0002)
-
-/* RTC_ALM_READ reads the alarm time (for RTCs that support alarms)
- *
- * Argument: A writeable reference to a struct rtc_time to receive the RTC's
- * alarm time.
- */
-
-#define RTC_ALM_READ _RTCIOC(0x0003)
-
-/* RTC_ALM_SET sets the alarm time (for RTCs that support alarms).
- *
- * Argument: A read-only reference to a struct rtc_time containing the
- * new alarm time to be set.
- */
-
-#define RTC_ALM_SET _RTCIOC(0x0004)
-
-/* RTC_IRQP_READ read the frequency for periodic interrupts (for RTCs that
- * support periodic interrupts)
- *
- * Argument: A pointer to a writeable unsigned long value in which to
- * receive the frequency value.
- */
-
-#define RTC_IRQP_READ _RTCIOC(0x0005)
-
-/* RTC_IRQP_SET set the frequency for periodic interrupts (for RTCs that
- * support periodic interrupts)
- *
- * Argument: An unsigned long value providing the new periodic frequency
- */
-
-#define RTC_IRQP_SET _RTCIOC(0x0006)
-
-/* RTC_AIE_ON enable alarm interrupts (for RTCs that support alarms)
- *
- * Argument: None
- */
-
-#define RTC_AIE_ON _RTCIOC(0x0007)
-
-/* RTC_AIE_OFF disable the alarm interrupt (for RTCs that support alarms)
- *
- * Argument: None
- */
-
-#define RTC_AIE_OFF _RTCIOC(0x0008)
-
-/* RTC_UIE_ON enable the interrupt on every clock update (for RTCs that
- * support this once-per-second interrupt).
- *
- * Argument: None
- */
-
-#define RTC_UIE_ON _RTCIOC(0x0009)
-
-/* RTC_UIE_OFF disable the interrupt on every clock update (for RTCs that
- * support this once-per-second interrupt).
- *
- * Argument: None
- */
-
-#define RTC_UIE_OFF _RTCIOC(0x000a)
-
-/* RTC_PIE_ON enable the periodic interrupt (for RTCs that support these
- * periodic interrupts).
- *
- * Argument: None
- */
-
-#define RTC_PIE_ON _RTCIOC(0x000b)
-
-/* RTC_PIE_OFF disable the periodic interrupt (for RTCs that support these
- * periodic interrupts).
- *
- * Argument: None
- */
-
-#define RTC_PIE_OFF _RTCIOC(0x000c)
-
-/* RTC_EPOCH_READ and RTC_EPOCH_SET.
- *
- * 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.
- */
-
-/* RTC_EPOCH_READ read the Epoch.
- *
- * Argument: A reference to a writeable unsigned low variable that will
- * receive the Epoch value.
- */
-
-#define RTC_EPOCH_READ _RTCIOC(0x000d)
-
-/* RTC_EPOCH_SET set the Epoch
- *
- * Argument: An unsigned long value containing the new Epoch value to be set.
- */
-
-#define RTC_EPOCH_SET _RTCIOC(0x000e)
-
-/* RTC_WKALM_RD and RTC_WKALM_SET.
- *
- * Some RTCs support a more powerful alarm interface, using these ioctls to
- * read or write the RTC's alarm time (respectively) with the rtc_wkalrm.
- */
-
-/* RTC_WKALM_RD read the current alarm
- *
- * Argument: A writeable reference to struct rtc_wkalrm to receive the
- * current alarm settings.
- */
-
-#define RTC_WKALM_RD _RTCIOC(0x000f)
-
-/* RTC_WKALM_SET set the alarm.
- *
- * Argument: A read-only reference to struct rtc_wkalrm containing the
- * new alarm settings.
- */
-
-#define RTC_WKALM_SET _RTCIOC(0x0010)
-
-/* Architecture-specific RTC IOCTLS should begin at RTC_USER_IOCBASE. For
- * example:
- *
- * #define MY_RTC_IOCTL1 _RTCIOC(RTC_USER_IOCBASE);
- * #define MY_RTC_IOCTL2 _RTCIOC(RTC_USER_IOCBASE + 1);
- * etc.
- */
-
-#define RTC_USER_IOCBASE 0x0011
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-/* IOCTL data structures */
-
-/* Broken-out time representation used with RTC IOCTL commands:
- *
- * The fields in this structure have the same meaning and ranges as for the
- * tm structure described in gmtime(). Further, it is REQUIRED that the
- * structure be cast compatible with struct tm! They must be interchangeable.
- */
-
-struct rtc_time
-{
- int tm_sec; /* Seconds (0-61, allows for leap seconds) */
- int tm_min; /* Minutes (0-59) */
- int tm_hour; /* Hours (0-23) */
- int tm_mday; /* Day of the month (1-31) */
- int tm_mon; /* Month (0-11) */
- int tm_year; /* Years since 1900 */
-#ifdef CONFIG_LIBC_LOCALTIME
- int tm_wday; /* Day of the week (0-6) (unused) */
- int tm_yday; /* Day of the year (0-365) (unused) */
- int tm_isdst; /* Non-0 if daylight savings time is in effect (unused) */
-#endif
-};
-
-#ifdef CONFIG_RTC_ALARM
-/* Structure used with the RTC_WKALM_RD and RTC_WKALM_SET IOCTL commands.
- *
- * The enabled flag is used to enable or disable the alarm interrupt, or to
- * read its current status; when using these calls, RTC_AIE_ON and
- * RTC_AIE_OFF are not used. The pending flag is used by RTC_WKALM_RD to
- * report a pending interrupt . The time field is as used with RTC_ALM_READ
- * and RTC_ALM_SET except that the tm_mday, tm_mon, and tm_year fields are
- * also valid.
- */
-
-struct rtc_wkalrm
-{
- unsigned char enabled;
- unsigned char pending;
- struct rtc_time time;
-};
-#endif
-
-/* The RTC driver is implemented as a common, upper-half character driver
- * that provides the RTC driver structure and a lower-level, hardware
- * specific implementation that performs the actual RTC operations.
- *
- * struct rtc_ops_s defines the callable interface from the common upper-
- * half driver into lower half implementation. Each method in this
- * structure corresponds to one of the RTC IOCTL commands. All IOCTL
- * command logic is implemented in the lower-half driver.
- *
- * A NULL value should be provided for any unsupported methods.
- */
-
-struct rtc_lowerhalf_s;
-struct rtc_ops_s
-{
- /* rdtime() returns the current RTC time. */
-
- CODE int (*rdtime)(FAR struct rtc_lowerhalf_s *lower,
- FAR struct rtc_time *rtctime);
-
- /* settime sets the RTC's time */
-
- CODE int (*settime)(FAR struct rtc_lowerhalf_s *lower,
- FAR const struct rtc_time *rtctime);
-
-#ifdef CONFIG_RTC_ALARM
- /* almread reads the alarm time (for RTCs that support alarms) */
-
- CODE int (*almread)(FAR struct rtc_lowerhalf_s *lower,
- FAR struct rtc_time *almtime);
-
- /* almset sets the alarm time (for RTCs that support alarms). */
-
- CODE int (*almset)(FAR struct rtc_lowerhalf_s *lower,
- FAR const struct rtc_time *almtime);
-#endif
-
-#ifdef CONFIG_RTC_PERIODIC
- /* irqpread the frequency for periodic interrupts (for RTCs that support
- * periodic interrupts)
- */
-
- CODE int (*irqpread)(FAR struct rtc_lowerhalf_s *lower,
- FAR unsigned long *irqpfreq);
-
- /* irqpset set the frequency for periodic interrupts (for RTCs that
- * support periodic interrupts)
- */
-
- CODE int (*irqpset)(FAR struct rtc_lowerhalf_s *lower,
- unsigned long irqpfreq);
-#endif
-
-#ifdef CONFIG_RTC_ALARM
- /* aie enable/disable alarm interrupts (for RTCs that support alarms) */
-
- CODE int (*aie)(FAR struct rtc_lowerhalf_s *lower, bool enable);
-#endif
-
-#ifdef CONFIG_RTC_ONESEC
- /* uie enable/disable the interrupt on every clock update (for RTCs that
- * support this once-per-second interrupt).
- */
-
- CODE int (*uie)(FAR struct rtc_lowerhalf_s *lower, bool enable);
-#endif
-
-#ifdef CONFIG_RTC_PERIODIC
- /* pie enable the periodic interrupt (for RTCs that support these periodic
- * interrupts).
- */
-
- CODE int (*pie)(FAR struct rtc_lowerhalf_s *lower, bool enable);
-#endif
-
-#ifdef CONFIG_RTC_EPOCHYEAR
- /* rdepoch read the Epoch. */
-
- CODE int (*rdepoch)(FAR struct rtc_lowerhalf_s *lower,
- FAR unsigned long *epoch);
-
- /* setepoch set the Epoch */
-
- CODE int (*setepoch)(FAR struct rtc_lowerhalf_s *lower,
- unsigned long epoch);
-#endif
-
-#ifdef CONFIG_RTC_ALARM
- /* rdwkalm read the current alarm */
-
- CODE int (*rdwkalm)(FAR struct rtc_lowerhalf_s *lower,
- FAR struct rtc_wkalrm *wkalrm);
-
- /* setwkalm set the alarm. */
-
- CODE int (*setwkalm)(FAR struct rtc_lowerhalf_s *lower,
- FAR const struct rtc_wkalrm *wkalrm);
-#endif
-
-#ifdef CONFIG_RTC_IOCTL
- /* Support for architecture-specific RTC operations */
-
- CODE int (*ioctl)(FAR struct rtc_lowerhalf_s *lower, int cmd,
- unsigned long arg);
-#endif
-
-#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
- /* The driver has been unlinked and there are no further open references
- * to the driver.
- */
-
- CODE int (*destroy)(FAR struct rtc_lowerhalf_s *lower);
-#endif
-};
-
-/* When the RTC driver is instantiated, a reference to struct
- * rtc_lowerhalf_s is passed to the initialization function and bound to
- * the driver. The actual content of the state structure used by different
- * lower half drivers will vary from implementation to implementation. But
- * each implementation must be cast compatible with this definition of
- * struct rtc_lowerhalf_s that is understood by the upper half driver.
- */
-
-struct rtc_lowerhalf_s
-{
- /* This is the contained reference to the read-only, lower-half
- * operations vtable (which may lie in FLASH or ROM)
- */
-
- FAR const struct rtc_ops_s *ops;
-
- /* Data following this can vary from RTC driver-to-driver */
-};
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-#undef EXTERN
-#if defined(__cplusplus)
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: rtc_initialize
- *
- * Description:
- * Create an RTC driver by binding to the lower half RTC driver instance
- * provided to this function. The resulting RTC driver will be registered
- * at /dev/rtcN where N is the minor number provided to this function.
- *
- ****************************************************************************/
-
-int rtc_initialize(int minor, FAR struct rtc_lowerhalf_s *lower);
-
-#undef EXTERN
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* CONFIG_RTC_DRIVER */
-#endif /* CONFIG_RTC */
-#endif /* __INCLUDE_NUTTX_RTC_H */
diff --git a/nuttx/include/nuttx/timer.h b/nuttx/include/nuttx/timer.h
deleted file mode 100644
index bc090f365..000000000
--- a/nuttx/include/nuttx/timer.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/****************************************************************************
- * include/nuttx/timer.h
- *
- * Copyright (C) 2014 Gregory Nutt. All rights reserved.
- * Authors: Gregory Nutt
- * Bob Doiron
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-#ifndef __INCLUDE_NUTTX_TIMER_H
-#define __INCLUDE_NUTTX_TIMER_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-#include
-
-#ifdef CONFIG_TIMER
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-/* IOCTL Commands ***********************************************************/
-/* The timer driver uses a standard character driver framework. However,
- * since the timer driver is a device control interface and not a data
- * transfer interface, the majority of the functionality is implemented in
- * driver ioctl calls. The timer ioctl commands are listed below:
- *
- * These are detected and handled by the "upper half" timer driver.
- *
- * TCIOC_START - Start the timer
- * Argument: Ignored
- * TCIOC_STOP - Stop the timer
- * Argument: Ignored
- * TCIOC_GETSTATUS - Get the status of the timer.
- * Argument: A writeable pointer to struct timer_status_s.
- * TCIOC_SETTIMEOUT - Reset the timer timeout to this value
- * Argument: A 32-bit timeout value in microseconds.
- * TCIOC_SETHANDLER - Call this handler on timer expiration
- * Argument: A pointer to struct timer_sethandler_s.
- *
- * WARNING: May change TCIOC_SETTIMEOUT to pass pointer to 64bit nanoseconds
- * or timespec structure.
- *
- * NOTE: The TCIOC_SETHANDLER ioctl cannot be supported in the kernel build
- * mode. In that case direct callbacks from kernel space into user space is
- * forbidden.
- */
-
-#define TCIOC_START _TCIOC(0x001)
-#define TCIOC_STOP _TCIOC(0x002)
-#define TCIOC_GETSTATUS _TCIOC(0x003)
-#define TCIOC_SETTIMEOUT _TCIOC(0x004)
-#define TCIOC_SETHANDLER _TCIOC(0x005)
-
-/* Bit Settings *************************************************************/
-/* Bit settings for the struct timer_status_s flags field */
-
-#define TCFLAGS_ACTIVE (1 << 0) /* 1=The timer is running */
-#define TCFLAGS_HANDLER (1 << 1) /* 1=Call the user function when the
- * timer expires */
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-/* User function prototype. Returns true to reload the timer, and the
- * function can modify the next interval if desired.
- */
-
-typedef bool (*tccb_t)(FAR uint32_t *next_interval_us);
-
-/* This is the type of the argument passed to the TCIOC_SETHANDLER ioctl */
-
-struct timer_sethandler_s
-{
- CODE tccb_t newhandler; /* The new timer interrupt handler */
- CODE tccb_t oldhandler; /* The previous timer interrupt handler (if any) */
-};
-
-/* This is the type of the argument passed to the TCIOC_GETSTATUS ioctl and
- * and returned by the "lower half" getstatus() method.
- */
-
-struct timer_status_s
-{
- uint32_t flags; /* See TCFLAGS_* definitions above */
- uint32_t timeout; /* The current timeout setting (in microseconds) */
- uint32_t timeleft; /* Time left until the timer expiration
- * (in microseconds) */
-};
-
-/* This structure provides the "lower-half" driver operations available to
- * the "upper-half" driver.
- */
-
-struct timer_lowerhalf_s;
-struct timer_ops_s
-{
- /* Required methods ********************************************************/
- /* Start the timer, resetting the time to the current timeout */
-
- CODE int (*start)(FAR struct timer_lowerhalf_s *lower);
-
- /* Stop the timer */
-
- CODE int (*stop)(FAR struct timer_lowerhalf_s *lower);
-
- /* Get the current timer status */
-
- CODE int (*getstatus)(FAR struct timer_lowerhalf_s *lower,
- FAR struct timer_status_s *status);
-
- /* Set a new timeout value (and reset the timer) */
-
- CODE int (*settimeout)(FAR struct timer_lowerhalf_s *lower,
- uint32_t timeout);
-
- /* Call this user provider timeout handler on timeout.
- * NOTE: Providing handler==NULL disable.
- */
-
- CODE tccb_t (*sethandler)(FAR struct timer_lowerhalf_s *lower,
- CODE tccb_t handler);
-
- /* Any ioctl commands that are not recognized by the "upper-half" driver
- * are forwarded to the lower half driver through this method.
- */
-
- CODE int (*ioctl)(FAR struct timer_lowerhalf_s *lower, int cmd,
- unsigned long arg);
-};
-
-/* This structure provides the publicly visible representation of the
- * "lower-half" driver state structure. "lower half" drivers will have an
- * internal structure definition that will be cast-compatible with this
- * structure definitions.
- */
-
-struct timer_lowerhalf_s
-{
- /* Publicly visible portion of the "lower-half" driver state structure. */
-
- FAR const struct timer_ops_s *ops; /* Lower half operations */
-
- /* The remainder of the structure is used by the "lower-half" driver
- * for whatever state storage that it may need.
- */
-};
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-#ifdef __cplusplus
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * "Upper-Half" Timer Driver Interfaces
- ****************************************************************************/
-/****************************************************************************
- * Name: timer_register
- *
- * Description:
- * This function binds an instance of a "lower half" timer driver with the
- * "upper half" timer device and registers that device so that can be used
- * by application code.
- *
- * When this function is called, the "lower half" driver should be in the
- * disabled state (as if the stop() method had already been called).
- *
- * NOTE: Normally, this function would not be called by application code.
- * Rather it is called indirectly through the architecture-specific
- * initialization.
- *
- * Input parameters:
- * dev path - The full path to the driver to be registers in the NuttX
- * pseudo-filesystem. The recommended convention is to name all timer
- * drivers as "/dev/timer0", "/dev/timer1", etc. where the driver
- * path differs only in the "minor" number at the end of the device name.
- * lower - A pointer to an instance of lower half timer driver. This
- * instance is bound to the timer driver and must persists as long as
- * the driver persists.
- *
- * Returned Value:
- * On success, a non-NULL handle is returned to the caller. In the event
- * of any failure, a NULL value is returned.
- *
- ****************************************************************************/
-
-FAR void *timer_register(FAR const char *path,
- FAR struct timer_lowerhalf_s *lower);
-
-/****************************************************************************
- * Name: timer_unregister
- *
- * Description:
- * This function can be called to disable and unregister the timer
- * device driver.
- *
- * Input parameters:
- * handle - This is the handle that was returned by timer_register()
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-void timer_unregister(FAR void *handle);
-
-/****************************************************************************
- * Platform-Independent "Lower-Half" Timer Driver Interfaces
- ****************************************************************************/
-
-/****************************************************************************
- * Architecture-specific Application Interfaces
- ****************************************************************************/
-
-#undef EXTERN
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* CONFIG_TIMER */
-#endif /* __INCLUDE_NUTTX_TIMER_H */
diff --git a/nuttx/include/nuttx/timers/rtc.h b/nuttx/include/nuttx/timers/rtc.h
new file mode 100644
index 000000000..d714e040f
--- /dev/null
+++ b/nuttx/include/nuttx/timers/rtc.h
@@ -0,0 +1,490 @@
+/****************************************************************************
+ * include/nuttx/timers/rtc.h
+ *
+ * Copyright(C) 2011 Uros Platise. All rights reserved.
+ * Author: Uros Platise
+ *
+ * With extensions, modifications by:
+ *
+ * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
+ * Author: Gregroy Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_NUTTX_TIMERS_RTC_H
+#define __INCLUDE_NUTTX_TIMERS_RTC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+#include
+
+#include
+
+#include
+
+#ifdef CONFIG_RTC
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/* Configuration ************************************************************/
+/* CONFIG_RTC - Enables general support for a hardware RTC. Specific
+ * architectures may require other specific settings.
+ *
+ * CONFIG_RTC_DATETIME - There are two general types of RTC: (1) A simple
+ * battery backed counter that keeps the time when power is down, and (2)
+ * A full date / time RTC the provides the date and time information, often
+ * in BCD format. If CONFIG_RTC_DATETIME is selected, it specifies this
+ * second kind of RTC. In this case, the RTC is used to "seed" the normal
+ * NuttX timer and the NuttX system timer provides for higher resolution
+ * time.
+ *
+ * CONFIG_RTC_HIRES - If CONFIG_RTC_DATETIME not selected, then the simple,
+ * battery backed counter is used. There are two different implementations
+ * of such simple counters based on the time resolution of the counter:
+ * The typical RTC keeps time to resolution of 1 second, usually
+ * supporting a 32-bit time_t value. In this case, the RTC is used to
+ * "seed" the normal NuttX timer and the NuttX timer provides for higher
+ * resolution time.
+ *
+ * If CONFIG_RTC_HIRES is enabled in the NuttX configuration, then the
+ * RTC provides higher resolution time and completely replaces the system
+ * timer for purpose of date and time.
+ *
+ * CONFIG_RTC_FREQUENCY - If CONFIG_RTC_HIRES is defined, then the frequency
+ * of the high resolution RTC must be provided. If CONFIG_RTC_HIRES is
+ * not defined, CONFIG_RTC_FREQUENCY is assumed to be one.
+ *
+ * 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 - Enable building the upper-half RTC driver
+ */
+
+#ifdef CONFIG_RTC_HIRES
+# ifdef CONFIG_RTC_DATETIME
+# error "CONFIG_RTC_HIRES and CONFIG_RTC_DATETIME are both defined"
+# endif
+# ifndef CONFIG_RTC_FREQUENCY
+# error "CONFIG_RTC_FREQUENCY is required for CONFIG_RTC_HIRES"
+# endif
+#else
+# ifndef CONFIG_RTC_FREQUENCY
+# define CONFIG_RTC_FREQUENCY 1
+# endif
+# if CONFIG_RTC_FREQUENCY != 1
+# error "The low resolution RTC must have frequency 1Hz"
+# endif
+#endif
+
+/* The remainder of the contain of this header file is only valid if the
+ * RTC upper half driver is built.
+ */
+
+#if CONFIG_RTC_DRIVER
+
+/* IOCTL Commands ***********************************************************/
+/* RTC driver IOCTL commands. These are Linux compatible command names, not
+ * all of these commands are supported by all RTC drivers, however.
+ */
+
+/* RTC_RD_TIME returns the current RTC time.
+ *
+ * Argument: A writeable reference to a struct rtc_time to receive the RTC's
+ * time.
+ */
+
+#define RTC_RD_TIME _RTCIOC(0x0001)
+
+/* RTC_SET_TIME sets the RTC's time
+ *
+ * Argument: A read-only reference to a struct rtc_time containing the
+ * new time to be set.
+ */
+
+#define RTC_SET_TIME _RTCIOC(0x0002)
+
+/* RTC_ALM_READ reads the alarm time (for RTCs that support alarms)
+ *
+ * Argument: A writeable reference to a struct rtc_time to receive the RTC's
+ * alarm time.
+ */
+
+#define RTC_ALM_READ _RTCIOC(0x0003)
+
+/* RTC_ALM_SET sets the alarm time (for RTCs that support alarms).
+ *
+ * Argument: A read-only reference to a struct rtc_time containing the
+ * new alarm time to be set.
+ */
+
+#define RTC_ALM_SET _RTCIOC(0x0004)
+
+/* RTC_IRQP_READ read the frequency for periodic interrupts (for RTCs that
+ * support periodic interrupts)
+ *
+ * Argument: A pointer to a writeable unsigned long value in which to
+ * receive the frequency value.
+ */
+
+#define RTC_IRQP_READ _RTCIOC(0x0005)
+
+/* RTC_IRQP_SET set the frequency for periodic interrupts (for RTCs that
+ * support periodic interrupts)
+ *
+ * Argument: An unsigned long value providing the new periodic frequency
+ */
+
+#define RTC_IRQP_SET _RTCIOC(0x0006)
+
+/* RTC_AIE_ON enable alarm interrupts (for RTCs that support alarms)
+ *
+ * Argument: None
+ */
+
+#define RTC_AIE_ON _RTCIOC(0x0007)
+
+/* RTC_AIE_OFF disable the alarm interrupt (for RTCs that support alarms)
+ *
+ * Argument: None
+ */
+
+#define RTC_AIE_OFF _RTCIOC(0x0008)
+
+/* RTC_UIE_ON enable the interrupt on every clock update (for RTCs that
+ * support this once-per-second interrupt).
+ *
+ * Argument: None
+ */
+
+#define RTC_UIE_ON _RTCIOC(0x0009)
+
+/* RTC_UIE_OFF disable the interrupt on every clock update (for RTCs that
+ * support this once-per-second interrupt).
+ *
+ * Argument: None
+ */
+
+#define RTC_UIE_OFF _RTCIOC(0x000a)
+
+/* RTC_PIE_ON enable the periodic interrupt (for RTCs that support these
+ * periodic interrupts).
+ *
+ * Argument: None
+ */
+
+#define RTC_PIE_ON _RTCIOC(0x000b)
+
+/* RTC_PIE_OFF disable the periodic interrupt (for RTCs that support these
+ * periodic interrupts).
+ *
+ * Argument: None
+ */
+
+#define RTC_PIE_OFF _RTCIOC(0x000c)
+
+/* RTC_EPOCH_READ and RTC_EPOCH_SET.
+ *
+ * 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.
+ */
+
+/* RTC_EPOCH_READ read the Epoch.
+ *
+ * Argument: A reference to a writeable unsigned low variable that will
+ * receive the Epoch value.
+ */
+
+#define RTC_EPOCH_READ _RTCIOC(0x000d)
+
+/* RTC_EPOCH_SET set the Epoch
+ *
+ * Argument: An unsigned long value containing the new Epoch value to be set.
+ */
+
+#define RTC_EPOCH_SET _RTCIOC(0x000e)
+
+/* RTC_WKALM_RD and RTC_WKALM_SET.
+ *
+ * Some RTCs support a more powerful alarm interface, using these ioctls to
+ * read or write the RTC's alarm time (respectively) with the rtc_wkalrm.
+ */
+
+/* RTC_WKALM_RD read the current alarm
+ *
+ * Argument: A writeable reference to struct rtc_wkalrm to receive the
+ * current alarm settings.
+ */
+
+#define RTC_WKALM_RD _RTCIOC(0x000f)
+
+/* RTC_WKALM_SET set the alarm.
+ *
+ * Argument: A read-only reference to struct rtc_wkalrm containing the
+ * new alarm settings.
+ */
+
+#define RTC_WKALM_SET _RTCIOC(0x0010)
+
+/* Architecture-specific RTC IOCTLS should begin at RTC_USER_IOCBASE. For
+ * example:
+ *
+ * #define MY_RTC_IOCTL1 _RTCIOC(RTC_USER_IOCBASE);
+ * #define MY_RTC_IOCTL2 _RTCIOC(RTC_USER_IOCBASE + 1);
+ * etc.
+ */
+
+#define RTC_USER_IOCBASE 0x0011
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+/* IOCTL data structures */
+
+/* Broken-out time representation used with RTC IOCTL commands:
+ *
+ * The fields in this structure have the same meaning and ranges as for the
+ * tm structure described in gmtime(). Further, it is REQUIRED that the
+ * structure be cast compatible with struct tm! They must be interchangeable.
+ */
+
+struct rtc_time
+{
+ int tm_sec; /* Seconds (0-61, allows for leap seconds) */
+ int tm_min; /* Minutes (0-59) */
+ int tm_hour; /* Hours (0-23) */
+ int tm_mday; /* Day of the month (1-31) */
+ int tm_mon; /* Month (0-11) */
+ int tm_year; /* Years since 1900 */
+#ifdef CONFIG_LIBC_LOCALTIME
+ int tm_wday; /* Day of the week (0-6) (unused) */
+ int tm_yday; /* Day of the year (0-365) (unused) */
+ int tm_isdst; /* Non-0 if daylight savings time is in effect (unused) */
+#endif
+};
+
+#ifdef CONFIG_RTC_ALARM
+/* Structure used with the RTC_WKALM_RD and RTC_WKALM_SET IOCTL commands.
+ *
+ * The enabled flag is used to enable or disable the alarm interrupt, or to
+ * read its current status; when using these calls, RTC_AIE_ON and
+ * RTC_AIE_OFF are not used. The pending flag is used by RTC_WKALM_RD to
+ * report a pending interrupt . The time field is as used with RTC_ALM_READ
+ * and RTC_ALM_SET except that the tm_mday, tm_mon, and tm_year fields are
+ * also valid.
+ */
+
+struct rtc_wkalrm
+{
+ unsigned char enabled;
+ unsigned char pending;
+ struct rtc_time time;
+};
+#endif
+
+/* The RTC driver is implemented as a common, upper-half character driver
+ * that provides the RTC driver structure and a lower-level, hardware
+ * specific implementation that performs the actual RTC operations.
+ *
+ * struct rtc_ops_s defines the callable interface from the common upper-
+ * half driver into lower half implementation. Each method in this
+ * structure corresponds to one of the RTC IOCTL commands. All IOCTL
+ * command logic is implemented in the lower-half driver.
+ *
+ * A NULL value should be provided for any unsupported methods.
+ */
+
+struct rtc_lowerhalf_s;
+struct rtc_ops_s
+{
+ /* rdtime() returns the current RTC time. */
+
+ CODE int (*rdtime)(FAR struct rtc_lowerhalf_s *lower,
+ FAR struct rtc_time *rtctime);
+
+ /* settime sets the RTC's time */
+
+ CODE int (*settime)(FAR struct rtc_lowerhalf_s *lower,
+ FAR const struct rtc_time *rtctime);
+
+#ifdef CONFIG_RTC_ALARM
+ /* almread reads the alarm time (for RTCs that support alarms) */
+
+ CODE int (*almread)(FAR struct rtc_lowerhalf_s *lower,
+ FAR struct rtc_time *almtime);
+
+ /* almset sets the alarm time (for RTCs that support alarms). */
+
+ CODE int (*almset)(FAR struct rtc_lowerhalf_s *lower,
+ FAR const struct rtc_time *almtime);
+#endif
+
+#ifdef CONFIG_RTC_PERIODIC
+ /* irqpread the frequency for periodic interrupts (for RTCs that support
+ * periodic interrupts)
+ */
+
+ CODE int (*irqpread)(FAR struct rtc_lowerhalf_s *lower,
+ FAR unsigned long *irqpfreq);
+
+ /* irqpset set the frequency for periodic interrupts (for RTCs that
+ * support periodic interrupts)
+ */
+
+ CODE int (*irqpset)(FAR struct rtc_lowerhalf_s *lower,
+ unsigned long irqpfreq);
+#endif
+
+#ifdef CONFIG_RTC_ALARM
+ /* aie enable/disable alarm interrupts (for RTCs that support alarms) */
+
+ CODE int (*aie)(FAR struct rtc_lowerhalf_s *lower, bool enable);
+#endif
+
+#ifdef CONFIG_RTC_ONESEC
+ /* uie enable/disable the interrupt on every clock update (for RTCs that
+ * support this once-per-second interrupt).
+ */
+
+ CODE int (*uie)(FAR struct rtc_lowerhalf_s *lower, bool enable);
+#endif
+
+#ifdef CONFIG_RTC_PERIODIC
+ /* pie enable the periodic interrupt (for RTCs that support these periodic
+ * interrupts).
+ */
+
+ CODE int (*pie)(FAR struct rtc_lowerhalf_s *lower, bool enable);
+#endif
+
+#ifdef CONFIG_RTC_EPOCHYEAR
+ /* rdepoch read the Epoch. */
+
+ CODE int (*rdepoch)(FAR struct rtc_lowerhalf_s *lower,
+ FAR unsigned long *epoch);
+
+ /* setepoch set the Epoch */
+
+ CODE int (*setepoch)(FAR struct rtc_lowerhalf_s *lower,
+ unsigned long epoch);
+#endif
+
+#ifdef CONFIG_RTC_ALARM
+ /* rdwkalm read the current alarm */
+
+ CODE int (*rdwkalm)(FAR struct rtc_lowerhalf_s *lower,
+ FAR struct rtc_wkalrm *wkalrm);
+
+ /* setwkalm set the alarm. */
+
+ CODE int (*setwkalm)(FAR struct rtc_lowerhalf_s *lower,
+ FAR const struct rtc_wkalrm *wkalrm);
+#endif
+
+#ifdef CONFIG_RTC_IOCTL
+ /* Support for architecture-specific RTC operations */
+
+ CODE int (*ioctl)(FAR struct rtc_lowerhalf_s *lower, int cmd,
+ unsigned long arg);
+#endif
+
+#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
+ /* The driver has been unlinked and there are no further open references
+ * to the driver.
+ */
+
+ CODE int (*destroy)(FAR struct rtc_lowerhalf_s *lower);
+#endif
+};
+
+/* When the RTC driver is instantiated, a reference to struct
+ * rtc_lowerhalf_s is passed to the initialization function and bound to
+ * the driver. The actual content of the state structure used by different
+ * lower half drivers will vary from implementation to implementation. But
+ * each implementation must be cast compatible with this definition of
+ * struct rtc_lowerhalf_s that is understood by the upper half driver.
+ */
+
+struct rtc_lowerhalf_s
+{
+ /* This is the contained reference to the read-only, lower-half
+ * operations vtable (which may lie in FLASH or ROM)
+ */
+
+ FAR const struct rtc_ops_s *ops;
+
+ /* Data following this can vary from RTC driver-to-driver */
+};
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rtc_initialize
+ *
+ * Description:
+ * Create an RTC driver by binding to the lower half RTC driver instance
+ * provided to this function. The resulting RTC driver will be registered
+ * at /dev/rtcN where N is the minor number provided to this function.
+ *
+ ****************************************************************************/
+
+int rtc_initialize(int minor, FAR struct rtc_lowerhalf_s *lower);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* CONFIG_RTC_DRIVER */
+#endif /* CONFIG_RTC */
+#endif /* __INCLUDE_NUTTX_TIMERS_RTC_H */
diff --git a/nuttx/include/nuttx/timers/timer.h b/nuttx/include/nuttx/timers/timer.h
new file mode 100644
index 000000000..8e6926083
--- /dev/null
+++ b/nuttx/include/nuttx/timers/timer.h
@@ -0,0 +1,265 @@
+/****************************************************************************
+ * include/nuttx/timers/timer.h
+ *
+ * Copyright (C) 2014 Gregory Nutt. All rights reserved.
+ * Authors: Gregory Nutt
+ * Bob Doiron
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_NUTTX_TIMERS_TIMER_H
+#define __INCLUDE_NUTTX_TIMERS_TIMER_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+#include
+#include
+#include
+
+#ifdef CONFIG_TIMER
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/* IOCTL Commands ***********************************************************/
+/* The timer driver uses a standard character driver framework. However,
+ * since the timer driver is a device control interface and not a data
+ * transfer interface, the majority of the functionality is implemented in
+ * driver ioctl calls. The timer ioctl commands are listed below:
+ *
+ * These are detected and handled by the "upper half" timer driver.
+ *
+ * TCIOC_START - Start the timer
+ * Argument: Ignored
+ * TCIOC_STOP - Stop the timer
+ * Argument: Ignored
+ * TCIOC_GETSTATUS - Get the status of the timer.
+ * Argument: A writeable pointer to struct timer_status_s.
+ * TCIOC_SETTIMEOUT - Reset the timer timeout to this value
+ * Argument: A 32-bit timeout value in microseconds.
+ * TCIOC_SETHANDLER - Call this handler on timer expiration
+ * Argument: A pointer to struct timer_sethandler_s.
+ *
+ * WARNING: May change TCIOC_SETTIMEOUT to pass pointer to 64bit nanoseconds
+ * or timespec structure.
+ *
+ * NOTE: The TCIOC_SETHANDLER ioctl cannot be supported in the kernel build
+ * mode. In that case direct callbacks from kernel space into user space is
+ * forbidden.
+ */
+
+#define TCIOC_START _TCIOC(0x001)
+#define TCIOC_STOP _TCIOC(0x002)
+#define TCIOC_GETSTATUS _TCIOC(0x003)
+#define TCIOC_SETTIMEOUT _TCIOC(0x004)
+#define TCIOC_SETHANDLER _TCIOC(0x005)
+
+/* Bit Settings *************************************************************/
+/* Bit settings for the struct timer_status_s flags field */
+
+#define TCFLAGS_ACTIVE (1 << 0) /* 1=The timer is running */
+#define TCFLAGS_HANDLER (1 << 1) /* 1=Call the user function when the
+ * timer expires */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* User function prototype. Returns true to reload the timer, and the
+ * function can modify the next interval if desired.
+ */
+
+typedef bool (*tccb_t)(FAR uint32_t *next_interval_us);
+
+/* This is the type of the argument passed to the TCIOC_SETHANDLER ioctl */
+
+struct timer_sethandler_s
+{
+ CODE tccb_t newhandler; /* The new timer interrupt handler */
+ CODE tccb_t oldhandler; /* The previous timer interrupt handler (if any) */
+};
+
+/* This is the type of the argument passed to the TCIOC_GETSTATUS ioctl and
+ * and returned by the "lower half" getstatus() method.
+ */
+
+struct timer_status_s
+{
+ uint32_t flags; /* See TCFLAGS_* definitions above */
+ uint32_t timeout; /* The current timeout setting (in microseconds) */
+ uint32_t timeleft; /* Time left until the timer expiration
+ * (in microseconds) */
+};
+
+/* This structure provides the "lower-half" driver operations available to
+ * the "upper-half" driver.
+ */
+
+struct timer_lowerhalf_s;
+struct timer_ops_s
+{
+ /* Required methods ********************************************************/
+ /* Start the timer, resetting the time to the current timeout */
+
+ CODE int (*start)(FAR struct timer_lowerhalf_s *lower);
+
+ /* Stop the timer */
+
+ CODE int (*stop)(FAR struct timer_lowerhalf_s *lower);
+
+ /* Get the current timer status */
+
+ CODE int (*getstatus)(FAR struct timer_lowerhalf_s *lower,
+ FAR struct timer_status_s *status);
+
+ /* Set a new timeout value (and reset the timer) */
+
+ CODE int (*settimeout)(FAR struct timer_lowerhalf_s *lower,
+ uint32_t timeout);
+
+ /* Call this user provider timeout handler on timeout.
+ * NOTE: Providing handler==NULL disable.
+ */
+
+ CODE tccb_t (*sethandler)(FAR struct timer_lowerhalf_s *lower,
+ CODE tccb_t handler);
+
+ /* Any ioctl commands that are not recognized by the "upper-half" driver
+ * are forwarded to the lower half driver through this method.
+ */
+
+ CODE int (*ioctl)(FAR struct timer_lowerhalf_s *lower, int cmd,
+ unsigned long arg);
+};
+
+/* This structure provides the publicly visible representation of the
+ * "lower-half" driver state structure. "lower half" drivers will have an
+ * internal structure definition that will be cast-compatible with this
+ * structure definitions.
+ */
+
+struct timer_lowerhalf_s
+{
+ /* Publicly visible portion of the "lower-half" driver state structure. */
+
+ FAR const struct timer_ops_s *ops; /* Lower half operations */
+
+ /* The remainder of the structure is used by the "lower-half" driver
+ * for whatever state storage that it may need.
+ */
+};
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * "Upper-Half" Timer Driver Interfaces
+ ****************************************************************************/
+/****************************************************************************
+ * Name: timer_register
+ *
+ * Description:
+ * This function binds an instance of a "lower half" timer driver with the
+ * "upper half" timer device and registers that device so that can be used
+ * by application code.
+ *
+ * When this function is called, the "lower half" driver should be in the
+ * disabled state (as if the stop() method had already been called).
+ *
+ * NOTE: Normally, this function would not be called by application code.
+ * Rather it is called indirectly through the architecture-specific
+ * initialization.
+ *
+ * Input parameters:
+ * dev path - The full path to the driver to be registers in the NuttX
+ * pseudo-filesystem. The recommended convention is to name all timer
+ * drivers as "/dev/timer0", "/dev/timer1", etc. where the driver
+ * path differs only in the "minor" number at the end of the device name.
+ * lower - A pointer to an instance of lower half timer driver. This
+ * instance is bound to the timer driver and must persists as long as
+ * the driver persists.
+ *
+ * Returned Value:
+ * On success, a non-NULL handle is returned to the caller. In the event
+ * of any failure, a NULL value is returned.
+ *
+ ****************************************************************************/
+
+FAR void *timer_register(FAR const char *path,
+ FAR struct timer_lowerhalf_s *lower);
+
+/****************************************************************************
+ * Name: timer_unregister
+ *
+ * Description:
+ * This function can be called to disable and unregister the timer
+ * device driver.
+ *
+ * Input parameters:
+ * handle - This is the handle that was returned by timer_register()
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+void timer_unregister(FAR void *handle);
+
+/****************************************************************************
+ * Platform-Independent "Lower-Half" Timer Driver Interfaces
+ ****************************************************************************/
+
+/****************************************************************************
+ * Architecture-specific Application Interfaces
+ ****************************************************************************/
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CONFIG_TIMER */
+#endif /* __INCLUDE_NUTTX_TIMERS_TIMER_H */
diff --git a/nuttx/include/nuttx/timers/watchdog.h b/nuttx/include/nuttx/timers/watchdog.h
new file mode 100644
index 000000000..a9ebc1f81
--- /dev/null
+++ b/nuttx/include/nuttx/timers/watchdog.h
@@ -0,0 +1,294 @@
+/****************************************************************************
+ * include/nuttx/timers/watchog.h
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_NUTTX_TIMERS_WATCHDOG_H
+#define __INCLUDE_NUTTX_TIMERS_WATCHDOG_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+#include
+#include
+#include
+
+#ifdef CONFIG_WATCHDOG
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/* IOCTL Commands ***********************************************************/
+/* The watchdog driver uses a standard character driver framework. However,
+ * since the watchdog driver is a device control interface and not a data
+ * transfer interface, the majority of the functionality is implemented in
+ * driver ioctl calls. The watchdog ioctl commands are lised below:
+ *
+ * These are detected and handled by the "upper half" watchdog timer driver.
+ *
+ * WDIOC_START - Start the watchdog timer
+ * Argument: Ignored
+ * WDIOC_STOP - Stop the watchdog timer
+ * Argument: Ignored
+ * WDIOC_GETSTATUS - Get the status of the watchdog timer.
+ * Argument: A writeable pointer to struct watchdog_status_s.
+ * WDIOC_SETTIMEOUT - Reset the watchdog timeout to this value
+ * Argument: A 32-bit timeout value in milliseconds.
+ * WDIOC_CAPTURE - Do not reset. Instead, called this handler.
+ * Argument: A pointer to struct watchdog_capture_s.
+ * WDIOC_KEEPALIVE - Reset the watchdog timer ("ping", "pet the dog");
+ * Argument: Ignored
+ *
+ * These may be supported by certain "lower half" drivers
+ *
+ * WDIOC_MINTIME - Set the minimum ping time. If two keepalive ioctls
+ * are received within this time, a reset event will
+ * be generated. This feature should assume to be
+ * disabled after WDIOC_SETTIMEOUT.
+ * Argument: A 32-bit time value in milliseconds.
+ */
+
+#define WDIOC_START _WDIOC(0x001)
+#define WDIOC_STOP _WDIOC(0x002)
+#define WDIOC_GETSTATUS _WDIOC(0x003)
+#define WDIOC_SETTIMEOUT _WDIOC(0x004)
+#define WDIOC_CAPTURE _WDIOC(0x005)
+#define WDIOC_KEEPALIVE _WDIOC(0x006)
+
+#define WDIOC_MINTIME _WDIOC(0x080)
+
+/* Bit Settings *************************************************************/
+/* Bit settings for the struct watchdog_status_s flags field */
+
+#define WDFLAGS_ACTIVE (1 << 0) /* 1=The watchdog timer is running */
+#define WDFLAGS_RESET (1 << 1) /* 1=Reset when the watchog timer expires */
+#define WDFLAGS_CAPTURE (1 << 2) /* 1=Call the user function when the
+ * watchdog timer expires */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+/* This is the type of the argument passed to the WDIOC_CAPTURE ioctl */
+
+struct watchdog_capture_s
+{
+ CODE xcpt_t newhandler; /* The new watchdog capture handler */
+ CODE xcpt_t oldhandler; /* The previous watchdog capture handler (if any) */
+};
+
+/* This is the type of the argument passed to the WDIOC_GETSTATUS ioctl and
+ * and returned by the "lower half" getstatus() method.
+ */
+
+struct watchdog_status_s
+{
+ uint32_t flags; /* See WDFLAGS_* definitions above */
+ uint32_t timeout; /* The current timeout setting (in milliseconds) */
+ uint32_t timeleft; /* Time left until the watchdog expiration
+ * (in milliseconds) */
+};
+
+/* This structure provides the "lower-half" driver operations available to
+ * the "upper-half" driver.
+ */
+
+struct watchdog_lowerhalf_s;
+struct watchdog_ops_s
+{
+ /* Required methods ********************************************************/
+ /* Start the watchdog timer, resetting the time to the current timeout */
+
+ CODE int (*start)(FAR struct watchdog_lowerhalf_s *lower);
+
+ /* Stop the watchdog timer */
+
+ CODE int (*stop)(FAR struct watchdog_lowerhalf_s *lower);
+
+ /* Optional methods ********************************************************/
+ /* Reset the watchdog timer to the current timeout value, prevent any
+ * imminent watchdog timeouts. This is sometimes referred as "pinging" the
+ * watchdog timer or "petting the dog".
+ */
+
+ CODE int (*keepalive)(FAR struct watchdog_lowerhalf_s *lower);
+
+ /* Get the current watchdog timer status */
+
+ CODE int (*getstatus)(FAR struct watchdog_lowerhalf_s *lower,
+ FAR struct watchdog_status_s *status);
+
+ /* Set a new timeout value (and reset the watchdog timer) */
+
+ CODE int (*settimeout)(FAR struct watchdog_lowerhalf_s *lower,
+ uint32_t timeout);
+
+ /* Don't reset on watchdog timer timeout; instead, call this user provider
+ * timeout handler. NOTE: Providing handler==NULL will restore the reset
+ * behavior.
+ */
+
+ CODE xcpt_t (*capture)(FAR struct watchdog_lowerhalf_s *lower,
+ CODE xcpt_t handler);
+
+ /* Any ioctl commands that are not recognized by the "upper-half" driver
+ * are forwarded to the lower half driver through this method.
+ */
+
+ CODE int (*ioctl)(FAR struct watchdog_lowerhalf_s *lower, int cmd,
+ unsigned long arg);
+};
+
+/* This structure provides the publicly visible representation of the
+ * "lower-half" driver state structure. "lower half" drivers will have an
+ * internal structure definition that will be cast-compatible with this
+ * structure definitions.
+ */
+
+struct watchdog_lowerhalf_s
+{
+ /* Publicly visible portion of the "lower-half" driver state structure. */
+
+ FAR const struct watchdog_ops_s *ops; /* Lower half operations */
+
+ /* The remainder of the structure is used by the "lower-half" driver
+ * for whatever state storage that it may need.
+ */
+};
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * "Upper-Half" Watchdog Driver Interfaces
+ ****************************************************************************/
+/****************************************************************************
+ * Name: watchdog_register
+ *
+ * Description:
+ * This function binds an instance of a "lower half" watchdog driver with the
+ * "upper half" watchdog device and registers that device so that can be used
+ * by application code.
+ *
+ * When this function is called, the "lower half" driver should be in the
+ * disabled state (as if the stop() method had already been called).
+ *
+ * NOTE: Normally, this function would not be called by application code.
+ * Rather it is called indirectly through the architecture-specific
+ * interface up_wdginitialize() described below.
+ *
+ * Input parameters:
+ * dev path - The full path to the driver to be registers in the NuttX
+ * pseudo-filesystem. The recommended convention is to name all watchdog
+ * drivers as "/dev/watchdog0", "/dev/watchdog1", etc. where the driver
+ * path differs only in the "minor" number at the end of the device name.
+ * lower - A pointer to an instance of lower half watchdog driver. This
+ * instance is bound to the watchdog driver and must persists as long as
+ * the driver persists.
+ *
+ * Returned Value:
+ * On success, a non-NULL handle is returned to the caller. In the event
+ * of any failure, a NULL value is returned.
+ *
+ ****************************************************************************/
+
+FAR void *watchdog_register(FAR const char *path,
+ FAR struct watchdog_lowerhalf_s *lower);
+
+/****************************************************************************
+ * Name: watchdog_unregister
+ *
+ * Description:
+ * This function can be called to disable and unregister the watchdog
+ * device driver.
+ *
+ * Input parameters:
+ * handle - This is the handle that was returned by watchdog_register()
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+void watchdog_unregister(FAR void *handle);
+
+/****************************************************************************
+ * Platform-Independent "Lower-Half" Watchdog Driver Interfaces
+ ****************************************************************************/
+
+/****************************************************************************
+ * Architecture-specific Application Interfaces
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_wdginitialize()
+ *
+ * Description:
+ * Perform architecture-specific initialization of the Watchdog hardware.
+ * This interface should be provided by all configurations using
+ * to avoid exposed platform-dependent logic.
+ *
+ * At a minimum, this function should call watchdog_register() which is
+ * described above.
+ *
+ * Input parameters:
+ * None
+ *
+ * Returned Value:
+ * Zero on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+int up_wdginitialize(void);
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CONFIG_WATCHDOG */
+#endif /* __INCLUDE_NUTTX_TIMERS_WATCHDOG_H */
diff --git a/nuttx/include/nuttx/watchdog.h b/nuttx/include/nuttx/watchdog.h
deleted file mode 100644
index 2daa38142..000000000
--- a/nuttx/include/nuttx/watchdog.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/****************************************************************************
- * include/nuttx/watchdog.h
- *
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-#ifndef __INCLUDE_NUTTX_WATCHDOG_H
-#define __INCLUDE_NUTTX_WATCHDOG_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-#include
-
-#ifdef CONFIG_WATCHDOG
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-/* IOCTL Commands ***********************************************************/
-/* The watchdog driver uses a standard character driver framework. However,
- * since the watchdog driver is a device control interface and not a data
- * transfer interface, the majority of the functionality is implemented in
- * driver ioctl calls. The watchdog ioctl commands are lised below:
- *
- * These are detected and handled by the "upper half" watchdog timer driver.
- *
- * WDIOC_START - Start the watchdog timer
- * Argument: Ignored
- * WDIOC_STOP - Stop the watchdog timer
- * Argument: Ignored
- * WDIOC_GETSTATUS - Get the status of the watchdog timer.
- * Argument: A writeable pointer to struct watchdog_status_s.
- * WDIOC_SETTIMEOUT - Reset the watchdog timeout to this value
- * Argument: A 32-bit timeout value in milliseconds.
- * WDIOC_CAPTURE - Do not reset. Instead, called this handler.
- * Argument: A pointer to struct watchdog_capture_s.
- * WDIOC_KEEPALIVE - Reset the watchdog timer ("ping", "pet the dog");
- * Argument: Ignored
- *
- * These may be supported by certain "lower half" drivers
- *
- * WDIOC_MINTIME - Set the minimum ping time. If two keepalive ioctls
- * are received within this time, a reset event will
- * be generated. This feature should assume to be
- * disabled after WDIOC_SETTIMEOUT.
- * Argument: A 32-bit time value in milliseconds.
- */
-
-#define WDIOC_START _WDIOC(0x001)
-#define WDIOC_STOP _WDIOC(0x002)
-#define WDIOC_GETSTATUS _WDIOC(0x003)
-#define WDIOC_SETTIMEOUT _WDIOC(0x004)
-#define WDIOC_CAPTURE _WDIOC(0x005)
-#define WDIOC_KEEPALIVE _WDIOC(0x006)
-
-#define WDIOC_MINTIME _WDIOC(0x080)
-
-/* Bit Settings *************************************************************/
-/* Bit settings for the struct watchdog_status_s flags field */
-
-#define WDFLAGS_ACTIVE (1 << 0) /* 1=The watchdog timer is running */
-#define WDFLAGS_RESET (1 << 1) /* 1=Reset when the watchog timer expires */
-#define WDFLAGS_CAPTURE (1 << 2) /* 1=Call the user function when the
- * watchdog timer expires */
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-/* This is the type of the argument passed to the WDIOC_CAPTURE ioctl */
-
-struct watchdog_capture_s
-{
- CODE xcpt_t newhandler; /* The new watchdog capture handler */
- CODE xcpt_t oldhandler; /* The previous watchdog capture handler (if any) */
-};
-
-/* This is the type of the argument passed to the WDIOC_GETSTATUS ioctl and
- * and returned by the "lower half" getstatus() method.
- */
-
-struct watchdog_status_s
-{
- uint32_t flags; /* See WDFLAGS_* definitions above */
- uint32_t timeout; /* The current timeout setting (in milliseconds) */
- uint32_t timeleft; /* Time left until the watchdog expiration
- * (in milliseconds) */
-};
-
-/* This structure provides the "lower-half" driver operations available to
- * the "upper-half" driver.
- */
-
-struct watchdog_lowerhalf_s;
-struct watchdog_ops_s
-{
- /* Required methods ********************************************************/
- /* Start the watchdog timer, resetting the time to the current timeout */
-
- CODE int (*start)(FAR struct watchdog_lowerhalf_s *lower);
-
- /* Stop the watchdog timer */
-
- CODE int (*stop)(FAR struct watchdog_lowerhalf_s *lower);
-
- /* Optional methods ********************************************************/
- /* Reset the watchdog timer to the current timeout value, prevent any
- * imminent watchdog timeouts. This is sometimes referred as "pinging" the
- * watchdog timer or "petting the dog".
- */
-
- CODE int (*keepalive)(FAR struct watchdog_lowerhalf_s *lower);
-
- /* Get the current watchdog timer status */
-
- CODE int (*getstatus)(FAR struct watchdog_lowerhalf_s *lower,
- FAR struct watchdog_status_s *status);
-
- /* Set a new timeout value (and reset the watchdog timer) */
-
- CODE int (*settimeout)(FAR struct watchdog_lowerhalf_s *lower,
- uint32_t timeout);
-
- /* Don't reset on watchdog timer timeout; instead, call this user provider
- * timeout handler. NOTE: Providing handler==NULL will restore the reset
- * behavior.
- */
-
- CODE xcpt_t (*capture)(FAR struct watchdog_lowerhalf_s *lower,
- CODE xcpt_t handler);
-
- /* Any ioctl commands that are not recognized by the "upper-half" driver
- * are forwarded to the lower half driver through this method.
- */
-
- CODE int (*ioctl)(FAR struct watchdog_lowerhalf_s *lower, int cmd,
- unsigned long arg);
-};
-
-/* This structure provides the publicly visible representation of the
- * "lower-half" driver state structure. "lower half" drivers will have an
- * internal structure definition that will be cast-compatible with this
- * structure definitions.
- */
-
-struct watchdog_lowerhalf_s
-{
- /* Publicly visible portion of the "lower-half" driver state structure. */
-
- FAR const struct watchdog_ops_s *ops; /* Lower half operations */
-
- /* The remainder of the structure is used by the "lower-half" driver
- * for whatever state storage that it may need.
- */
-};
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-#ifdef __cplusplus
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * "Upper-Half" Watchdog Driver Interfaces
- ****************************************************************************/
-/****************************************************************************
- * Name: watchdog_register
- *
- * Description:
- * This function binds an instance of a "lower half" watchdog driver with the
- * "upper half" watchdog device and registers that device so that can be used
- * by application code.
- *
- * When this function is called, the "lower half" driver should be in the
- * disabled state (as if the stop() method had already been called).
- *
- * NOTE: Normally, this function would not be called by application code.
- * Rather it is called indirectly through the architecture-specific
- * interface up_wdginitialize() described below.
- *
- * Input parameters:
- * dev path - The full path to the driver to be registers in the NuttX
- * pseudo-filesystem. The recommended convention is to name all watchdog
- * drivers as "/dev/watchdog0", "/dev/watchdog1", etc. where the driver
- * path differs only in the "minor" number at the end of the device name.
- * lower - A pointer to an instance of lower half watchdog driver. This
- * instance is bound to the watchdog driver and must persists as long as
- * the driver persists.
- *
- * Returned Value:
- * On success, a non-NULL handle is returned to the caller. In the event
- * of any failure, a NULL value is returned.
- *
- ****************************************************************************/
-
-FAR void *watchdog_register(FAR const char *path,
- FAR struct watchdog_lowerhalf_s *lower);
-
-/****************************************************************************
- * Name: watchdog_unregister
- *
- * Description:
- * This function can be called to disable and unregister the watchdog
- * device driver.
- *
- * Input parameters:
- * handle - This is the handle that was returned by watchdog_register()
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-void watchdog_unregister(FAR void *handle);
-
-/****************************************************************************
- * Platform-Independent "Lower-Half" Watchdog Driver Interfaces
- ****************************************************************************/
-
-/****************************************************************************
- * Architecture-specific Application Interfaces
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_wdginitialize()
- *
- * Description:
- * Perform architecture-specific initialization of the Watchdog hardware.
- * This interface should be provided by all configurations using
- * to avoid exposed platform-dependent logic.
- *
- * At a minimum, this function should call watchdog_register() which is
- * described above.
- *
- * Input parameters:
- * None
- *
- * Returned Value:
- * Zero on success; a negated errno value on failure.
- *
- ****************************************************************************/
-
-int up_wdginitialize(void);
-
-#undef EXTERN
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* CONFIG_WATCHDOG */
-#endif /* __INCLUDE_NUTTX_WATCHDOG_H */
diff --git a/nuttx/include/time.h b/nuttx/include/time.h
index a5eb238f5..4b21270d9 100644
--- a/nuttx/include/time.h
+++ b/nuttx/include/time.h
@@ -124,7 +124,7 @@ struct timespec
* REVISIT: This structure could be packed better using uint8_t's and
* uint16_t's. The standard definition does, however, call out type int for
* all of the members. NOTE: Any changes to this structure must be also be
- * reflected in struct rtc_time defined in include/nuttx/rtc.h; these two
+ * reflected in struct rtc_time defined in include/nuttx/timers/rtc.h; these two
* structures must be cast compatible.
*/
--
cgit v1.2.3