diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-17 05:28:38 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-17 05:28:38 +0000 |
commit | ba07b2055c7eb8f2add96f55cb52b40b9ccb3d63 (patch) | |
tree | c5c21160773004d06e17ede1d38a7e1267ccf094 /firmware | |
parent | 604b17aa082160cd0347e16fdf245000e3ada3f0 (diff) | |
download | rockbox-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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/rtc/rtc_as3514.c | 33 |
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) | |||
122 | { | 122 | { |
123 | (void) release_alarm; | 123 | (void) release_alarm; |
124 | 124 | ||
125 | /* was it an alarm that triggered power on ? */ | ||
126 | bool alarm_start = false; | ||
127 | |||
128 | /* 3 first reads give the 23 bits counter and enable bit */ | 125 | /* 3 first reads give the 23 bits counter and enable bit */ |
129 | ascodec_read(AS3543_WAKEUP); /* bits 7:0 */ | 126 | ascodec_read(AS3543_WAKEUP); /* bits 7:0 */ |
130 | ascodec_read(AS3543_WAKEUP); /* bits 15:8 */ | 127 | ascodec_read(AS3543_WAKEUP); /* bits 15:8 */ |
131 | if(ascodec_read(AS3543_WAKEUP) & (1<<7)) /* enable bit */ | 128 | if(!(ascodec_read(AS3543_WAKEUP) & (1<<7))) /* enable bit */ |
132 | { | 129 | return false; |
133 | #if 0 /* we could have a persistent setting for wake-up time */ | ||
134 | alarm_enabled = true; | ||
135 | #endif | ||
136 | |||
137 | /* subsequent reads give the 16 bytes static SRAM */ | ||
138 | wakeup_h = ascodec_read(AS3543_WAKEUP); | ||
139 | wakeup_m = ascodec_read(AS3543_WAKEUP); | ||
140 | |||
141 | struct tm tm; | ||
142 | rtc_read_datetime(&tm); | ||
143 | 130 | ||
144 | /* do we wake up at the programmed time, or for another reason ? */ | 131 | /* subsequent reads give the 16 bytes static SRAM */ |
145 | if(wakeup_h == tm.tm_hour && wakeup_m == tm.tm_min) | 132 | wakeup_h = ascodec_read(AS3543_WAKEUP); |
146 | alarm_start = true; | 133 | wakeup_m = ascodec_read(AS3543_WAKEUP); |
147 | } | ||
148 | 134 | ||
149 | /* disable alarm */ | 135 | struct tm tm; |
150 | ascodec_write(AS3543_WAKEUP, 0); /* bits 7:0 */ | 136 | rtc_read_datetime(&tm); |
151 | ascodec_write(AS3543_WAKEUP, 0); /* bits 15:8 */ | ||
152 | ascodec_write(AS3543_WAKEUP, 0); /* bits 22:16 + enable bit */ | ||
153 | 137 | ||
154 | return alarm_start; | 138 | /* were we powered up at the programmed time ? */ |
139 | return wakeup_h == tm.tm_hour && wakeup_m == tm.tm_min; | ||
155 | } | 140 | } |
156 | 141 | ||
157 | bool rtc_check_alarm_flag(void) | 142 | bool rtc_check_alarm_flag(void) |