STM32 RTC counter: Include enable/disable backup domain within critical section. Per recommendtion of Alexander Oryshchenko.
This commit is contained in:
parent
ba1e1b19fc
commit
85df251093
@ -597,13 +597,13 @@ int up_rtc_settime(FAR const struct timespec *tp)
|
|||||||
|
|
||||||
/* Enable write access to the backup domain */
|
/* Enable write access to the backup domain */
|
||||||
|
|
||||||
|
flags = irqsave();
|
||||||
(void)stm32_pwr_enablebkp(true);
|
(void)stm32_pwr_enablebkp(true);
|
||||||
|
|
||||||
/* Then write the broken out values to the RTC counter and BKP overflow register
|
/* Then write the broken out values to the RTC counter and BKP overflow register
|
||||||
* (hi-res mode only)
|
* (hi-res mode only)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = irqsave();
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
stm32_rtc_beginwr();
|
stm32_rtc_beginwr();
|
||||||
@ -617,9 +617,9 @@ int up_rtc_settime(FAR const struct timespec *tp)
|
|||||||
#ifdef CONFIG_RTC_HIRES
|
#ifdef CONFIG_RTC_HIRES
|
||||||
putreg16(regvals.ovf, RTC_TIMEMSB_REG);
|
putreg16(regvals.ovf, RTC_TIMEMSB_REG);
|
||||||
#endif
|
#endif
|
||||||
irqrestore(flags);
|
|
||||||
|
|
||||||
(void)stm32_pwr_enablebkp(false);
|
(void)stm32_pwr_enablebkp(false);
|
||||||
|
irqrestore(flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user