From aaeb9843d6862b5385d5df472ef46fdf72e09e9f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 21 Apr 2015 18:08:31 -0600 Subject: [PATCH] STM32 RTC counter: Include enable/disable backup domain within critical section. Per recommendtion of Alexander Oryshchenko. --- arch/arm/src/stm32/stm32_rtcounter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/stm32/stm32_rtcounter.c b/arch/arm/src/stm32/stm32_rtcounter.c index 815d654acb..d5c6cbb5f9 100644 --- a/arch/arm/src/stm32/stm32_rtcounter.c +++ b/arch/arm/src/stm32/stm32_rtcounter.c @@ -597,13 +597,13 @@ int up_rtc_settime(FAR const struct timespec *tp) /* Enable write access to the backup domain */ + flags = irqsave(); (void)stm32_pwr_enablebkp(true); /* Then write the broken out values to the RTC counter and BKP overflow register * (hi-res mode only) */ - flags = irqsave(); do { stm32_rtc_beginwr(); @@ -617,9 +617,9 @@ int up_rtc_settime(FAR const struct timespec *tp) #ifdef CONFIG_RTC_HIRES putreg16(regvals.ovf, RTC_TIMEMSB_REG); #endif - irqrestore(flags); (void)stm32_pwr_enablebkp(false); + irqrestore(flags); return OK; }