STM32 F4 RTC: I believe that the F405/407 has only a single alarm. Not sure.

This commit is contained in:
Gregory Nutt 2016-06-02 15:04:23 -06:00
parent a18dbfda6e
commit fcdc17056b

View File

@ -183,10 +183,12 @@ volatile bool g_rtc_enabled = false;
#ifdef CONFIG_RTC_ALARM #ifdef CONFIG_RTC_ALARM
static int rtchw_check_alrawf(void); static int rtchw_check_alrawf(void);
static int rtchw_check_alrbwf(void);
static int rtchw_set_alrmar(rtc_alarmreg_t alarmreg); static int rtchw_set_alrmar(rtc_alarmreg_t alarmreg);
#if CONFIG_RTC_NALARMS > 1
static int rtchw_check_alrbwf(void);
static int rtchw_set_alrmbr(rtc_alarmreg_t alarmreg); static int rtchw_set_alrmbr(rtc_alarmreg_t alarmreg);
#endif #endif
#endif
/************************************************************************************ /************************************************************************************
* Private Functions * Private Functions
@ -655,6 +657,7 @@ static int stm32_rtc_alarm_handler(int irq, void *context)
} }
} }
#if CONFIG_RTC_NALARMS > 1
if ((isr & RTC_ISR_ALRBF) != 0) if ((isr & RTC_ISR_ALRBF) != 0)
{ {
cr = getreg32(STM32_RTC_CR); cr = getreg32(STM32_RTC_CR);
@ -678,6 +681,7 @@ static int stm32_rtc_alarm_handler(int irq, void *context)
putreg32(isr, STM32_RTC_CR); putreg32(isr, STM32_RTC_CR);
} }
} }
#endif
return ret; return ret;
} }
@ -723,7 +727,7 @@ static int rtchw_check_alrawf(void)
} }
#endif #endif
#ifdef CONFIG_RTC_ALARM #if defined(CONFIG_RTC_ALARM) && CONFIG_RTC_NALARMS > 1
static int rtchw_check_alrbwf(void) static int rtchw_check_alrbwf(void)
{ {
volatile uint32_t timeout; volatile uint32_t timeout;
@ -801,7 +805,7 @@ errout_with_wprunlock:
} }
#endif #endif
#ifdef CONFIG_RTC_ALARM #if defined(CONFIG_RTC_ALARM) && CONFIG_RTC_NALARMS > 1
static int rtchw_set_alrmbr(rtc_alarmreg_t alarmreg) static int rtchw_set_alrmbr(rtc_alarmreg_t alarmreg)
{ {
int ret = -EBUSY; int ret = -EBUSY;
@ -1385,6 +1389,7 @@ int stm32_rtc_setalarm(FAR struct alm_setalarm_s *alminfo)
} }
break; break;
#if CONFIG_RTC_NALARMS > 1
case RTC_ALARMB: case RTC_ALARMB:
{ {
cbinfo = &g_alarmcb[RTC_ALARMB]; cbinfo = &g_alarmcb[RTC_ALARMB];
@ -1401,6 +1406,7 @@ int stm32_rtc_setalarm(FAR struct alm_setalarm_s *alminfo)
rtc_dumpregs("Set AlarmB"); rtc_dumpregs("Set AlarmB");
} }
break; break;
#endif
default: default:
rtcvdbg("ERROR: Invalid ALARM%d\n", alminfo->as_id); rtcvdbg("ERROR: Invalid ALARM%d\n", alminfo->as_id);
@ -1467,6 +1473,7 @@ int stm32_rtc_cancelalarm(enum alm_id_e alarmid)
} }
break; break;
#if CONFIG_RTC_NALARMS > 1
case RTC_ALARMB: case RTC_ALARMB:
{ {
/* Cancel the global callback function */ /* Cancel the global callback function */
@ -1497,6 +1504,7 @@ int stm32_rtc_cancelalarm(enum alm_id_e alarmid)
ret = OK; ret = OK;
} }
break; break;
#endif
default: default:
rtcvdbg("ERROR: Invalid ALARM%d\n", alarmid); rtcvdbg("ERROR: Invalid ALARM%d\n", alarmid);