mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
Merge from master
This commit is contained in:
@@ -10253,6 +10253,7 @@
|
||||
Parikh. This initial commit is incomplete. This is quite a bit more
|
||||
hub logic that needs to come in before the port is complete
|
||||
(2015-04-18).
|
||||
* arch/arm/src/stm32/stm32_rtcounter.c: Now need to enable backup
|
||||
domain write access when setting the time. From Darcy Gong (2015-04-19).
|
||||
* include/nuttx/usb/usbhost.h: Bring in more logic from
|
||||
https://github.com/kaushalparikh/nuttx (2015-04-19).
|
||||
|
||||
https://github.com/kaushalparikh/nuttx (2015-04-19).
|
||||
|
||||
@@ -589,25 +589,37 @@ 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 */
|
||||
|
||||
stm32_rtc_breakout(tp, ®vals);
|
||||
|
||||
/* Enable write access to the backup domain */
|
||||
|
||||
(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();
|
||||
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);
|
||||
#endif
|
||||
irqrestore(flags);
|
||||
|
||||
(void)stm32_pwr_enablebkp(false);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user