RTC: Remove all backdoor interfaces from rtc.h
This commit is contained in:
parent
d1fa95ffc3
commit
501bc15fbd
@ -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, ®vals);
|
||||
efm32_rtc_breakout(tp, ®vals);
|
||||
|
||||
/* 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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "stm32_rtc.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
@ -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
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN void stm32_rtc_settalarmpin(bool activate);
|
||||
#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
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
int stm32_rtc_cancelalarm(void);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
|
@ -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;
|
||||
|
@ -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, ®vals);
|
||||
stm32_rtc_breakout(tp, ®vals);
|
||||
|
||||
/* 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, ®vals);
|
||||
stm32_rtc_breakout(tp, ®vals);
|
||||
|
||||
/* 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;
|
||||
|
Loading…
Reference in New Issue
Block a user