From fca9e7bf8d48f2fcc4c8b21cc29aabf2ce053900 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Sun, 27 May 2012 00:14:42 +0200 Subject: zenxfi3: RTC is used in same was as in fuze+, using seconds-since-1970 plus an offset Change-Id: Iab2e6e15c790c26d3bf2679e9f965a409d162783 --- firmware/drivers/rtc/rtc_imx233.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'firmware/drivers/rtc') diff --git a/firmware/drivers/rtc/rtc_imx233.c b/firmware/drivers/rtc/rtc_imx233.c index fd01421644..9ed8540b5d 100644 --- a/firmware/drivers/rtc/rtc_imx233.c +++ b/firmware/drivers/rtc/rtc_imx233.c @@ -36,15 +36,15 @@ void rtc_init(void) int rtc_read_datetime(struct tm *tm) { uint32_t seconds = imx233_rtc_read_seconds(); - #ifdef SANSA_FUZEPLUS +#if defined(SANSA_FUZEPLUS) || defined(CREATIVE_ZENXFI3) /* The OF uses PERSISTENT2 register to keep the adjustment and only changes * SECONDS if necessary. */ seconds += imx233_rtc_read_persistent(2); - #else +#else /* The Freescale recommended way of keeping time is the number of seconds * since 00:00 1/1/1980 */ seconds += YEAR1980; - #endif +#endif gmtime_r(&seconds, tm); @@ -57,18 +57,18 @@ int rtc_write_datetime(const struct tm *tm) seconds = mktime((struct tm *)tm); - #ifdef SANSA_FUZEPLUS +#if defined(SANSA_FUZEPLUS) || defined(CREATIVE_ZENXFI3) /* The OF uses PERSISTENT2 register to keep the adjustment and only changes * SECONDS if necessary. * NOTE: the OF uses this mechanism to prevent roll back in time. Although * Rockbox will handle a negative PERSISTENT2 value, the OF will detect * it and won't return in time before SECONDS */ imx233_rtc_write_persistent(2, seconds - imx233_rtc_read_seconds()); - #else +#else /* The Freescale recommended way of keeping time is the number of seconds * since 00:00 1/1/1980 */ imx233_rtc_write_seconds(seconds - YEAR1980); - #endif +#endif return 0; } -- cgit v1.2.3