summaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-02-13 08:41:34 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-02-13 08:41:34 -0600
commitb3260ea37bc255d781477bec9e8706205fd9b46f (patch)
treef7f08a435279bdf39ad510f5cc0df742bfc0e8ef /nuttx/arch
parentdca2ea2ae29ea5eed3353a7f9bc1e8137f03978a (diff)
downloadpx4-nuttx-b3260ea37bc255d781477bec9e8706205fd9b46f.tar.gz
px4-nuttx-b3260ea37bc255d781477bec9e8706205fd9b46f.tar.bz2
px4-nuttx-b3260ea37bc255d781477bec9e8706205fd9b46f.zip
RTC: Remove all backdoor interfaces from rtc.h
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/arm/src/efm32/efm32_rtc_burtc.c11
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc176x_rtc.c11
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h26
-rw-r--r--nuttx/arch/arm/src/sam34/sam_rtc.c11
-rw-r--r--nuttx/arch/arm/src/sam34/sam_rtc.h37
-rw-r--r--nuttx/arch/arm/src/sama5/sam_rtc.c8
-rw-r--r--nuttx/arch/arm/src/sama5/sam_rtc.h37
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_rtc.c1
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_rtc.h55
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_rtcc.c11
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_rtcounter.c22
11 files changed, 184 insertions, 46 deletions
diff --git a/nuttx/arch/arm/src/efm32/efm32_rtc_burtc.c b/nuttx/arch/arm/src/efm32/efm32_rtc_burtc.c
index 0450b7aad..2b58b4a9e 100644
--- a/nuttx/arch/arm/src/efm32/efm32_rtc_burtc.c
+++ b/nuttx/arch/arm/src/efm32/efm32_rtc_burtc.c
@@ -55,6 +55,7 @@
#include "chip/efm32_burtc.h"
#include "efm32_rmu.h"
+#include "efm32_rtc.h"
#include "clock/clock.h"
/************************************************************************************
@@ -496,7 +497,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
}
/************************************************************************************
- * Name: up_rtc_setalarm
+ * Name: efm32_rtc_setalarm
*
* Description:
* Set up an alarm.
@@ -512,7 +513,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
#ifdef CONFIG_RTC_ALARM
#error "Sorry ! not yet implemented, just copied from STM32"
-int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
+int efm32_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
{
struct rtc_regvals_s regvals;
irqstate_t flags;
@@ -529,7 +530,7 @@ int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
/* Break out the time values */
- up_rtc_breakout(tp, &regvals);
+ efm32_rtc_breakout(tp, &regvals);
/* Enable RTC alarm */
@@ -554,7 +555,7 @@ int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
#endif
/************************************************************************************
- * Name: up_rtc_cancelalarm
+ * Name: efm32_rtc_cancelalarm
*
* Description:
* Cancel a pending alarm alarm
@@ -569,7 +570,7 @@ int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
#ifdef CONFIG_RTC_ALARM
#error "Sorry ! not yet implemented, just copied from STM32"
-int up_rtc_cancelalarm(void)
+int efm32_rtc_cancelalarm(void)
{
irqstate_t flags;
int ret = -ENODATA;
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc176x_rtc.c b/nuttx/arch/arm/src/lpc17xx/lpc176x_rtc.c
index 5423335c1..0aaf6eb33 100644
--- a/nuttx/arch/arm/src/lpc17xx/lpc176x_rtc.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc176x_rtc.c
@@ -39,14 +39,13 @@
#include <nuttx/config.h>
-#include <nuttx/arch.h>
-#include <nuttx/irq.h>
-#include <nuttx/rtc.h>
-
#include <time.h>
#include <errno.h>
#include <debug.h>
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
+
#include <arch/board/board.h>
#include "up_arch.h"
@@ -403,7 +402,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
}
/************************************************************************************
- * Name: up_rtc_setalarm
+ * Name: lpc17_rtc_setalarm
*
* Description:
* Set up an alarm. Up to two alarms can be supported (ALARM A and ALARM B).
@@ -418,7 +417,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
************************************************************************************/
#ifdef CONFIG_RTC_ALARM
-int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
+int lpc17_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
{
int ret = -EBUSY;
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h b/nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h
index 9011cd84a..1ee2ea91b 100644
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h
@@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/lpc17xx/lpc17_rtc.h
*
- * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2010, 2012-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,10 @@
* Public Types
************************************************************************************/
+/* The form of an alarm callback */
+
+typedef void (*alarmcb_t)(void);
+
/************************************************************************************
* Public Data
************************************************************************************/
@@ -59,4 +63,24 @@
* Public Functions
************************************************************************************/
+/************************************************************************************
+ * Name: lpc17_rtc_setalarm
+ *
+ * Description:
+ * Set up an alarm.
+ *
+ * Input Parameters:
+ * tp - the time to set the alarm
+ * callback - the function to call when the alarm expires.
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno on failure
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_RTC_ALARM
+struct timespec;
+int lpc17_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback);
+#endif
+
#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_RTC_H */
diff --git a/nuttx/arch/arm/src/sam34/sam_rtc.c b/nuttx/arch/arm/src/sam34/sam_rtc.c
index 9b4e8b40f..c92672aa9 100644
--- a/nuttx/arch/arm/src/sam34/sam_rtc.c
+++ b/nuttx/arch/arm/src/sam34/sam_rtc.c
@@ -40,15 +40,14 @@
#include <nuttx/config.h>
-#include <nuttx/arch.h>
-#include <nuttx/irq.h>
-#include <nuttx/rtc.h>
-
#include <time.h>
#include <errno.h>
#include <debug.h>
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
#include <nuttx/wqueue.h>
+
#include <arch/board/board.h>
#include "up_arch.h"
@@ -651,7 +650,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
}
/************************************************************************************
- * Name: up_rtc_setalarm
+ * Name: sam_rtc_setalarm
*
* Description:
* Set up an alarm. Up to two alarms can be supported (ALARM A and ALARM B).
@@ -666,7 +665,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
************************************************************************************/
#ifdef CONFIG_RTC_ALARM
-int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
+int sam_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
{
FAR struct tm newalarm;
irqstate_t flags;
diff --git a/nuttx/arch/arm/src/sam34/sam_rtc.h b/nuttx/arch/arm/src/sam34/sam_rtc.h
index 03b123a6d..03ab31669 100644
--- a/nuttx/arch/arm/src/sam34/sam_rtc.h
+++ b/nuttx/arch/arm/src/sam34/sam_rtc.h
@@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/sam34/sam_rtc.h
*
- * Copyright (C) 2014 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Bob Doiron
*
@@ -50,12 +50,25 @@
* Pre-processor Definitions
************************************************************************************/
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
#ifndef __ASSEMBLY__
+/* The form of an alarm callback */
+
+typedef void (*alarmcb_t)(void);
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
-extern "C" {
+extern "C"
+{
#else
#define EXTERN extern
#endif
@@ -64,6 +77,26 @@ extern "C" {
* Public Functions
************************************************************************************/
+/************************************************************************************
+ * Name: sam_rtc_setalarm
+ *
+ * Description:
+ * Set up an alarm.
+ *
+ * Input Parameters:
+ * tp - the time to set the alarm
+ * callback - the function to call when the alarm expires.
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno on failure
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_RTC_ALARM
+struct timespec;
+int sam_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback);
+#endif
+
#undef EXTERN
#if defined(__cplusplus)
}
diff --git a/nuttx/arch/arm/src/sama5/sam_rtc.c b/nuttx/arch/arm/src/sama5/sam_rtc.c
index e9221898d..db1be9738 100644
--- a/nuttx/arch/arm/src/sama5/sam_rtc.c
+++ b/nuttx/arch/arm/src/sama5/sam_rtc.c
@@ -41,13 +41,15 @@
#include <nuttx/arch.h>
#include <nuttx/irq.h>
-#include <nuttx/rtc.h>
#include <time.h>
#include <errno.h>
#include <debug.h>
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
#include <nuttx/wqueue.h>
+
#include <arch/board/board.h>
#include "up_arch.h"
@@ -579,7 +581,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
}
/************************************************************************************
- * Name: up_rtc_setalarm
+ * Name: sam_rtc_setalarm
*
* Description:
* Set up an alarm. Up to two alarms can be supported (ALARM A and ALARM B).
@@ -594,7 +596,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
************************************************************************************/
#ifdef CONFIG_RTC_ALARM
-int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
+int sam_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
{
FAR struct tm newalarm;
irqstate_t flags;
diff --git a/nuttx/arch/arm/src/sama5/sam_rtc.h b/nuttx/arch/arm/src/sama5/sam_rtc.h
index c119d4c9c..bb97c5ea5 100644
--- a/nuttx/arch/arm/src/sama5/sam_rtc.h
+++ b/nuttx/arch/arm/src/sama5/sam_rtc.h
@@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/sama5/sam_rtc.h
*
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -49,12 +49,25 @@
* Pre-processor Definitions
************************************************************************************/
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
#ifndef __ASSEMBLY__
+/* The form of an alarm callback */
+
+typedef void (*alarmcb_t)(void);
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
-extern "C" {
+extern "C"
+{
#else
#define EXTERN extern
#endif
@@ -63,6 +76,26 @@ extern "C" {
* Public Functions
************************************************************************************/
+/************************************************************************************
+ * Name: sam_rtc_setalarm
+ *
+ * Description:
+ * Set up an alarm.
+ *
+ * Input Parameters:
+ * tp - the time to set the alarm
+ * callback - the function to call when the alarm expires.
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno on failure
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_RTC_ALARM
+struct timespec;
+int sam_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback);
+#endif
+
#undef EXTERN
#if defined(__cplusplus)
}
diff --git a/nuttx/arch/arm/src/stm32/stm32_rtc.c b/nuttx/arch/arm/src/stm32/stm32_rtc.c
index 5d4e0896e..9dc5b2097 100644
--- a/nuttx/arch/arm/src/stm32/stm32_rtc.c
+++ b/nuttx/arch/arm/src/stm32/stm32_rtc.c
@@ -40,6 +40,7 @@
#include <nuttx/config.h>
#include "chip.h"
+#include "stm32_rtc.h"
/****************************************************************************
* Pre-processor Definitions
diff --git a/nuttx/arch/arm/src/stm32/stm32_rtc.h b/nuttx/arch/arm/src/stm32/stm32_rtc.h
index 8e529cb61..b27a4ffb9 100644
--- a/nuttx/arch/arm/src/stm32/stm32_rtc.h
+++ b/nuttx/arch/arm/src/stm32/stm32_rtc.h
@@ -2,7 +2,7 @@
* arch/arm/src/stm32/stm32_rtc.h
*
* Copyright (C) 2011 Uros Platise. All rights reserved.
- * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Uros Platise <uros.platise@isotel.eu> (Original for the F1)
* Gregory Nutt <gnutt@nuttx.org> (On-going support and development)
*
@@ -71,12 +71,25 @@
#define STM32_RTC_PRESCALER_SECOND 32767 /* Default prescaler to get a second base */
#define STM32_RTC_PRESCALER_MIN 1 /* Maximum speed of 16384 Hz */
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
#ifndef __ASSEMBLY__
+/* The form of an alarm callback */
+
+typedef CODE void (*alarmcb_t)(void);
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
-extern "C" {
+extern "C"
+{
#else
#define EXTERN extern
#endif
@@ -85,9 +98,43 @@ extern "C" {
* Public Functions
************************************************************************************/
-/* Set alarm output pin */
+/************************************************************************************
+ * Name: stm32_rtc_setalarm
+ *
+ * Description:
+ * Set up an alarm.
+ *
+ * Input Parameters:
+ * tp - the time to set the alarm
+ * callback - the function to call when the alarm expires.
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno on failure
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_RTC_ALARM
+struct timespec;
+int stm32_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback);
+#endif
+
+/************************************************************************************
+ * Name: stm32_rtc_cancelalarm
+ *
+ * Description:
+ * Cancel a pending alarm alarm
+ *
+ * Input Parameters:
+ * none
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno on failure
+ *
+ ************************************************************************************/
-EXTERN void stm32_rtc_settalarmpin(bool activate);
+#ifdef CONFIG_RTC_ALARM
+int stm32_rtc_cancelalarm(void);
+#endif
#undef EXTERN
#if defined(__cplusplus)
diff --git a/nuttx/arch/arm/src/stm32/stm32_rtcc.c b/nuttx/arch/arm/src/stm32/stm32_rtcc.c
index ea49fa2e6..29840b7b6 100644
--- a/nuttx/arch/arm/src/stm32/stm32_rtcc.c
+++ b/nuttx/arch/arm/src/stm32/stm32_rtcc.c
@@ -39,14 +39,13 @@
#include <nuttx/config.h>
-#include <nuttx/arch.h>
-#include <nuttx/irq.h>
-#include <nuttx/rtc.h>
-
#include <time.h>
#include <errno.h>
#include <debug.h>
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
+
#include <arch/board/board.h>
#include "up_arch.h"
@@ -904,7 +903,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
}
/************************************************************************************
- * Name: up_rtc_setalarm
+ * Name: stm32_rtc_setalarm
*
* Description:
* Set up an alarm. Up to two alarms can be supported (ALARM A and ALARM B).
@@ -919,7 +918,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
************************************************************************************/
#ifdef CONFIG_RTC_ALARM
-int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
+int stm32_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
{
irqstate_t flags;
int ret = -EBUSY;
diff --git a/nuttx/arch/arm/src/stm32/stm32_rtcounter.c b/nuttx/arch/arm/src/stm32/stm32_rtcounter.c
index 5ffb1a313..5613b05aa 100644
--- a/nuttx/arch/arm/src/stm32/stm32_rtcounter.c
+++ b/nuttx/arch/arm/src/stm32/stm32_rtcounter.c
@@ -247,7 +247,7 @@ static inline void stm32_rtc_wait4rsf(void)
}
/************************************************************************************
- * Name: up_rtc_breakout
+ * Name: stm32_rtc_breakout
*
* Description:
* Set the RTC to the provided time.
@@ -261,8 +261,8 @@ static inline void stm32_rtc_wait4rsf(void)
************************************************************************************/
#ifdef CONFIG_RTC_HIRES
-static void up_rtc_breakout(FAR const struct timespec *tp,
- FAR struct rtc_regvals_s *regvals)
+static void stm32_rtc_breakout(FAR const struct timespec *tp,
+ FAR struct rtc_regvals_s *regvals)
{
uint64_t frac;
uint32_t cnt;
@@ -281,8 +281,8 @@ static void up_rtc_breakout(FAR const struct timespec *tp,
regvals->ovf = ovf;
}
#else
-static inline void up_rtc_breakout(FAR const struct timespec *tp,
- FAR struct rtc_regvals_s *regvals)
+static inline void stm32_rtc_breakout(FAR const struct timespec *tp,
+ FAR struct rtc_regvals_s *regvals)
{
/* The low-res timer is easy... tv_sec holds exactly the value needed by the
* CNTH/CNTL registers.
@@ -572,7 +572,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
/* Break out the time values */
- up_rtc_breakout(tp, &regvals);
+ stm32_rtc_breakout(tp, &regvals);
/* Then write the broken out values to the RTC counter and BKP overflow register
* (hi-res mode only)
@@ -592,7 +592,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
}
/************************************************************************************
- * Name: up_rtc_setalarm
+ * Name: stm32_rtc_setalarm
*
* Description:
* Set up an alarm.
@@ -607,7 +607,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
************************************************************************************/
#ifdef CONFIG_RTC_ALARM
-int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
+int stm32_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
{
struct rtc_regvals_s regvals;
irqstate_t flags;
@@ -624,7 +624,7 @@ int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
/* Break out the time values */
- up_rtc_breakout(tp, &regvals);
+ stm32_rtc_breakout(tp, &regvals);
/* Enable RTC alarm */
@@ -648,7 +648,7 @@ int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
#endif
/************************************************************************************
- * Name: up_rtc_cancelalarm
+ * Name: stm32_rtc_cancelalarm
*
* Description:
* Cancel a pending alarm alarm
@@ -662,7 +662,7 @@ int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
************************************************************************************/
#ifdef CONFIG_RTC_ALARM
-int up_rtc_cancelalarm(void)
+int stm32_rtc_cancelalarm(void)
{
irqstate_t flags;
int ret = -ENODATA;