STM32 F1 RT Counter: Another fix from Darcy Gong
This commit is contained in:
parent
2d2f645e77
commit
47f2a0b09d
@ -589,6 +589,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
|
||||
{
|
||||
struct rtc_regvals_s regvals;
|
||||
irqstate_t flags;
|
||||
uint16_t cntl;
|
||||
|
||||
/* Break out the time values */
|
||||
|
||||
@ -603,10 +604,15 @@ int up_rtc_settime(FAR const struct timespec *tp)
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
stm32_rtc_beginwr();
|
||||
putreg16(regvals.cnth, STM32_RTC_CNTH);
|
||||
putreg16(regvals.cntl, STM32_RTC_CNTL);
|
||||
stm32_rtc_endwr();
|
||||
do
|
||||
{
|
||||
stm32_rtc_beginwr();
|
||||
putreg16(regvals.cnth, STM32_RTC_CNTH);
|
||||
putreg16(regvals.cntl, STM32_RTC_CNTL);
|
||||
cntl = getreg16(STM32_RTC_CNTL);
|
||||
stm32_rtc_endwr();
|
||||
}
|
||||
while (cntl != regvals.cntl);
|
||||
|
||||
#ifdef CONFIG_RTC_HIRES
|
||||
putreg16(regvals.ovf, RTC_TIMEMSB_REG);
|
||||
|
Loading…
Reference in New Issue
Block a user