Add NSH date command

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3932 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-09-01 15:09:49 +00:00
parent 64d78eec58
commit c38362f357

View File

@ -222,11 +222,12 @@ clock_t up_rtc_getclock(void)
* *
* \param time The unit depends on the prescaler value * \param time The unit depends on the prescaler value
**/ **/
void up_rtc_setclock(clock_t clock)
void up_rtc_setclock(clock_t newclock)
{ {
stm32_rtc_beginwr(); stm32_rtc_beginwr();
putreg16(clock >> 16, STM32_RTC_CNTH); putreg16(newclock >> 16, STM32_RTC_CNTH);
putreg16(clock & 0xFFFF, STM32_RTC_CNTL); putreg16(newclock & 0xFFFF, STM32_RTC_CNTL);
stm32_rtc_endwr(); stm32_rtc_endwr();
} }
@ -263,14 +264,14 @@ time_t up_rtc_gettime(void)
} }
void up_rtc_settime(time_t time) void up_rtc_settime(time_t newtime)
{ {
/* Do reverse compared to gettime above */ /* Do reverse compared to gettime above */
uint32_t time_lsb = time << RTC_CLOCKS_SHIFT | uint32_t time_lsb = newtime << RTC_CLOCKS_SHIFT |
(up_rtc_getclock() & ((1<<RTC_CLOCKS_SHIFT)-1)); (up_rtc_getclock() & ((1<<RTC_CLOCKS_SHIFT)-1));
uint32_t time_msb = time >> (32-RTC_CLOCKS_SHIFT); uint32_t time_msb = newtime >> (32-RTC_CLOCKS_SHIFT);
irqstate_t irqs = irqsave(); irqstate_t irqs = irqsave();