diff options
| author | Thom Johansen <thomj@rockbox.org> | 2007-09-28 15:09:54 +0000 |
|---|---|---|
| committer | Thom Johansen <thomj@rockbox.org> | 2007-09-28 15:09:54 +0000 |
| commit | 1ef5dadec5342dc126a1f7745cd48030cb05eaa8 (patch) | |
| tree | 088d71aa489733972cdf7344c9ee30ad887dba4e | |
| parent | 49a9e1ef35085dd1b348bb7949f32cd4db043506 (diff) | |
| download | rockbox-1ef5dadec5342dc126a1f7745cd48030cb05eaa8.zip rockbox-1ef5dadec5342dc126a1f7745cd48030cb05eaa8.tar.gz rockbox-1ef5dadec5342dc126a1f7745cd48030cb05eaa8.tar.bz2 rockbox-1ef5dadec5342dc126a1f7745cd48030cb05eaa8.tar.xz | |
Try to fix the case where Ipods would spuriously wake up even though no alarm had been set.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14885 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/drivers/pcf50605.c | 4 | ||||
| -rw-r--r-- | firmware/drivers/rtc/rtc_pcf50605.c | 10 | ||||
| -rw-r--r-- | firmware/export/pcf50605.h | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/firmware/drivers/pcf50605.c b/firmware/drivers/pcf50605.c index cf4ea9f..94d9d08 100644 --- a/firmware/drivers/pcf50605.c +++ b/firmware/drivers/pcf50605.c @@ -69,6 +69,7 @@ #define D2REGC1 0x25 #define D3REGC1 0x26 +unsigned char pcf50605_wakeup_flags = 0; int pcf50605_read(int address) { @@ -101,8 +102,7 @@ int pcf50605_write_multiple(int address, const unsigned char* buf, int count) power on your iPod again. */ void pcf50605_standby_mode(void) { - const char mask = pcf50605_read(OOCC1) | GOSTDBY | CHGWAK | EXTONWAK; - pcf50605_write(OOCC1, mask); + pcf50605_write(OOCC1, GOSTDBY | CHGWAK | EXTONWAK | pcf50605_wakeup_flags); } void pcf50605_init(void) diff --git a/firmware/drivers/rtc/rtc_pcf50605.c b/firmware/drivers/rtc/rtc_pcf50605.c index fedcdd3..93fa391 100644 --- a/firmware/drivers/rtc/rtc_pcf50605.c +++ b/firmware/drivers/rtc/rtc_pcf50605.c @@ -25,7 +25,9 @@ #include <stdbool.h> /* Values which each disable one alarm time register */ -static char alarm_disable[] = { 0x7f, 0x7f, 0x3f, 0x07, 0x3f, 0x1f, 0xff }; +static const char alarm_disable[] = { + 0x7f, 0x7f, 0x3f, 0x07, 0x3f, 0x1f, 0xff +}; void rtc_init(void) { @@ -68,14 +70,16 @@ bool rtc_enable_alarm(bool enable) pcf50605_write_multiple(0x14, alarm_disable + 3, 4); /* Unmask the alarm interrupt (might be unneeded) */ pcf50605_write(0x5, pcf50605_read(0x5) & ~0x80); - /* Make sure wake on RTC is set */ - pcf50605_write(0x8, pcf50605_read(0x8) | 0x10); + /* Make sure wake on RTC is set when shutting down */ + pcf50605_wakeup_flags |= 0x10; } else { /* We use this year to indicate a disabled alarm. If you happen to live * around this time and are annoyed by this, feel free to seek out my * grave and do something nasty to it. */ pcf50605_write(0x17, 0x99); + /* Make sure we don't wake on RTC after shutting down */ + pcf50605_wakeup_flags &= ~0x10; } return false; } diff --git a/firmware/export/pcf50605.h b/firmware/export/pcf50605.h index eb899af..b38d6a3 100644 --- a/firmware/export/pcf50605.h +++ b/firmware/export/pcf50605.h @@ -20,6 +20,8 @@ #ifndef PCF50605_H #define PCF50605_H +extern unsigned char pcf50605_wakeup_flags; + int pcf50605_read(int address); int pcf50605_read_multiple(int address, unsigned char* buf, int count); int pcf50605_write(int address, unsigned char val); |