From fcdc17056b4e6135bc447296341d4666c76e4531 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 2 Jun 2016 15:04:23 -0600 Subject: [PATCH] STM32 F4 RTC: I believe that the F405/407 has only a single alarm. Not sure. --- arch/arm/src/stm32/stm32f40xxx_rtcc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/arm/src/stm32/stm32f40xxx_rtcc.c b/arch/arm/src/stm32/stm32f40xxx_rtcc.c index 22fd766f6c..d89134fd46 100644 --- a/arch/arm/src/stm32/stm32f40xxx_rtcc.c +++ b/arch/arm/src/stm32/stm32f40xxx_rtcc.c @@ -183,10 +183,12 @@ volatile bool g_rtc_enabled = false; #ifdef CONFIG_RTC_ALARM static int rtchw_check_alrawf(void); -static int rtchw_check_alrbwf(void); 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); #endif +#endif /************************************************************************************ * 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) { cr = getreg32(STM32_RTC_CR); @@ -678,6 +681,7 @@ static int stm32_rtc_alarm_handler(int irq, void *context) putreg32(isr, STM32_RTC_CR); } } +#endif return ret; } @@ -723,7 +727,7 @@ static int rtchw_check_alrawf(void) } #endif -#ifdef CONFIG_RTC_ALARM +#if defined(CONFIG_RTC_ALARM) && CONFIG_RTC_NALARMS > 1 static int rtchw_check_alrbwf(void) { volatile uint32_t timeout; @@ -801,7 +805,7 @@ errout_with_wprunlock: } #endif -#ifdef CONFIG_RTC_ALARM +#if defined(CONFIG_RTC_ALARM) && CONFIG_RTC_NALARMS > 1 static int rtchw_set_alrmbr(rtc_alarmreg_t alarmreg) { int ret = -EBUSY; @@ -1385,6 +1389,7 @@ int stm32_rtc_setalarm(FAR struct alm_setalarm_s *alminfo) } break; +#if CONFIG_RTC_NALARMS > 1 case 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"); } break; +#endif default: rtcvdbg("ERROR: Invalid ALARM%d\n", alminfo->as_id); @@ -1467,6 +1473,7 @@ int stm32_rtc_cancelalarm(enum alm_id_e alarmid) } break; +#if CONFIG_RTC_NALARMS > 1 case RTC_ALARMB: { /* Cancel the global callback function */ @@ -1497,6 +1504,7 @@ int stm32_rtc_cancelalarm(enum alm_id_e alarmid) ret = OK; } break; +#endif default: rtcvdbg("ERROR: Invalid ALARM%d\n", alarmid);