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;
|
struct rtc_regvals_s regvals;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
uint16_t cntl;
|
||||||
|
|
||||||
/* Break out the time values */
|
/* Break out the time values */
|
||||||
|
|
||||||
@ -603,10 +604,15 @@ int up_rtc_settime(FAR const struct timespec *tp)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
flags = irqsave();
|
flags = irqsave();
|
||||||
|
do
|
||||||
|
{
|
||||||
stm32_rtc_beginwr();
|
stm32_rtc_beginwr();
|
||||||
putreg16(regvals.cnth, STM32_RTC_CNTH);
|
putreg16(regvals.cnth, STM32_RTC_CNTH);
|
||||||
putreg16(regvals.cntl, STM32_RTC_CNTL);
|
putreg16(regvals.cntl, STM32_RTC_CNTL);
|
||||||
|
cntl = getreg16(STM32_RTC_CNTL);
|
||||||
stm32_rtc_endwr();
|
stm32_rtc_endwr();
|
||||||
|
}
|
||||||
|
while (cntl != regvals.cntl);
|
||||||
|
|
||||||
#ifdef CONFIG_RTC_HIRES
|
#ifdef CONFIG_RTC_HIRES
|
||||||
putreg16(regvals.ovf, RTC_TIMEMSB_REG);
|
putreg16(regvals.ovf, RTC_TIMEMSB_REG);
|
||||||
|
Loading…
Reference in New Issue
Block a user