From c38362f35741e875f83ca5f1841b4c561ea8e4d9 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 1 Sep 2011 15:09:49 +0000 Subject: [PATCH] Add NSH date command git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3932 42af7a65-404d-4744-a932-0658087f49c3 --- arch/arm/src/stm32/stm32_rtc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/arm/src/stm32/stm32_rtc.c b/arch/arm/src/stm32/stm32_rtc.c index 17b6110084..68c4bc30d9 100644 --- a/arch/arm/src/stm32/stm32_rtc.c +++ b/arch/arm/src/stm32/stm32_rtc.c @@ -222,11 +222,12 @@ clock_t up_rtc_getclock(void) * * \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(); - putreg16(clock >> 16, STM32_RTC_CNTH); - putreg16(clock & 0xFFFF, STM32_RTC_CNTL); + putreg16(newclock >> 16, STM32_RTC_CNTH); + putreg16(newclock & 0xFFFF, STM32_RTC_CNTL); 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 */ - uint32_t time_lsb = time << RTC_CLOCKS_SHIFT | + uint32_t time_lsb = newtime << RTC_CLOCKS_SHIFT | (up_rtc_getclock() & ((1<> (32-RTC_CLOCKS_SHIFT); + uint32_t time_msb = newtime >> (32-RTC_CLOCKS_SHIFT); irqstate_t irqs = irqsave();