summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-06-17 05:28:38 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-06-17 05:28:38 +0000
commitba07b2055c7eb8f2add96f55cb52b40b9ccb3d63 (patch)
treec5c21160773004d06e17ede1d38a7e1267ccf094
parent604b17aa082160cd0347e16fdf245000e3ada3f0 (diff)
downloadrockbox-ba07b2055c7eb8f2add96f55cb52b40b9ccb3d63.tar.gz
rockbox-ba07b2055c7eb8f2add96f55cb52b40b9ccb3d63.zip
AMSv2 RTC: no need to write to RTC_WAKEUP register
The wakeup alarm will be disabled when powering off anyway OF database refresh of µSD now only happens if the wakeup was explicitely enabled There still seems to be a freeze problem when powering off (sometimes) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26875 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/rtc/rtc_as3514.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/firmware/drivers/rtc/rtc_as3514.c b/firmware/drivers/rtc/rtc_as3514.c
index 837806d2ea..f2716e52e8 100644
--- a/firmware/drivers/rtc/rtc_as3514.c
+++ b/firmware/drivers/rtc/rtc_as3514.c
@@ -122,36 +122,21 @@ bool rtc_check_alarm_started(bool release_alarm)
{
(void) release_alarm;
- /* was it an alarm that triggered power on ? */
- bool alarm_start = false;
-
/* 3 first reads give the 23 bits counter and enable bit */
ascodec_read(AS3543_WAKEUP); /* bits 7:0 */
ascodec_read(AS3543_WAKEUP); /* bits 15:8 */
- if(ascodec_read(AS3543_WAKEUP) & (1<<7)) /* enable bit */
- {
-#if 0 /* we could have a persistent setting for wake-up time */
- alarm_enabled = true;
-#endif
-
- /* subsequent reads give the 16 bytes static SRAM */
- wakeup_h = ascodec_read(AS3543_WAKEUP);
- wakeup_m = ascodec_read(AS3543_WAKEUP);
-
- struct tm tm;
- rtc_read_datetime(&tm);
+ if(!(ascodec_read(AS3543_WAKEUP) & (1<<7))) /* enable bit */
+ return false;
- /* do we wake up at the programmed time, or for another reason ? */
- if(wakeup_h == tm.tm_hour && wakeup_m == tm.tm_min)
- alarm_start = true;
- }
+ /* subsequent reads give the 16 bytes static SRAM */
+ wakeup_h = ascodec_read(AS3543_WAKEUP);
+ wakeup_m = ascodec_read(AS3543_WAKEUP);
- /* disable alarm */
- ascodec_write(AS3543_WAKEUP, 0); /* bits 7:0 */
- ascodec_write(AS3543_WAKEUP, 0); /* bits 15:8 */
- ascodec_write(AS3543_WAKEUP, 0); /* bits 22:16 + enable bit */
+ struct tm tm;
+ rtc_read_datetime(&tm);
- return alarm_start;
+ /* were we powered up at the programmed time ? */
+ return wakeup_h == tm.tm_hour && wakeup_m == tm.tm_min;
}
bool rtc_check_alarm_flag(void)