summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2008-11-12 03:52:33 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2008-11-12 03:52:33 +0000
commit68c686957b1b62671d727116e5c167cd8f080148 (patch)
tree600746fc28046ddfc58498fd69d4afef8d40e419
parentf6791faedd2e4ab6d23590c053aeaf816d1eaa6d (diff)
downloadrockbox-68c686957b1b62671d727116e5c167cd8f080148.tar.gz
rockbox-68c686957b1b62671d727116e5c167cd8f080148.zip
Make the wakeup alarm code work (Needs the flashed bootloader)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19093 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/rtc/rtc_s3c2440.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/firmware/drivers/rtc/rtc_s3c2440.c b/firmware/drivers/rtc/rtc_s3c2440.c
index 70178efc49..d39b50a2ca 100644
--- a/firmware/drivers/rtc/rtc_s3c2440.c
+++ b/firmware/drivers/rtc/rtc_s3c2440.c
@@ -57,39 +57,32 @@ int rtc_write_datetime(unsigned char* buf)
57} 57}
58 58
59#ifdef HAVE_RTC_ALARM 59#ifdef HAVE_RTC_ALARM
60/* This alarm code works in that it at least triggers INT_RTC. I am guessing 60/* This alarm code works with a flashed bootloader. This will not work with
61 * that the OF bootloader for the Gigabeat detects the startup by alarm and shuts down. 61 * the OF bootloader.
62 * This code is available for use once the OF bootloader is no longer required.
63 */
64
65/* check whether the unit has been started by the RTC alarm function
66 * This code has not been written/checked for the gigabeat
67 */ 62 */
63
64/* Check whether the unit has been started by the RTC alarm function */
68bool rtc_check_alarm_started(bool release_alarm) 65bool rtc_check_alarm_started(bool release_alarm)
69{ 66{
70 static bool alarm_state, run_before; 67 if (GSTATUS3)
71 bool rc; 68 {
72 69 GSTATUS3 &= ~release_alarm;
73 if (run_before) { 70 return true;
74 rc = alarm_state; 71 }
75 alarm_state &= ~release_alarm; 72 else
76 } else { 73 {
77 /* This call resets AF, so we store the state for later recall */ 74 return false;
78 rc = alarm_state = rtc_check_alarm_flag();
79 run_before = true;
80 } 75 }
81
82 return rc;
83} 76}
84 77
85/* 78/* Check to see if the alarm has flaged since the last it was checked */
86 * I don't think this matters on the gigabeat, it seems designed to shut off the alarm in the
87 * event one happens while the player is running. This does not cause any problems on the
88 * gigabeat as the interupt is recieved (if not masked) and ignored.
89 */
90bool rtc_check_alarm_flag(void) 79bool rtc_check_alarm_flag(void)
91{ 80{
92 return false; 81 bool ret=SRCPND & 0x40000000;
82
83 SRCPND=RTC_MASK;
84
85 return ret;
93} 86}
94 87
95/* set alarm time registers to the given time (repeat once per day) */ 88/* set alarm time registers to the given time (repeat once per day) */
@@ -114,12 +107,10 @@ bool rtc_enable_alarm(bool enable)
114 if (enable) 107 if (enable)
115 { 108 {
116 RTCALM=0x46; 109 RTCALM=0x46;
117 INTMSK&=~(1<<30);
118 } 110 }
119 else 111 else
120 { 112 {
121 RTCALM=0x00; 113 RTCALM=0x00;
122 INTMSK|=(1<<30);
123 } 114 }
124 115
125 return false; /* all ok */ 116 return false; /* all ok */