mirror of
https://github.com/apache/nuttx.git
synced 2026-08-27 04:10:40 +00:00
STM32 F1 RT Counter: Another fix from Darcy Gong
This commit is contained in:
parent
2d2f645e77
commit
47f2a0b09d
1 changed files with 10 additions and 4 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue