summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-02-28 21:55:11 +0000
committerThom Johansen <thomj@rockbox.org>2007-02-28 21:55:11 +0000
commit8fd6d658a1caeddc0a84dd69ffe45739bd466e74 (patch)
tree91f79d4d40d898a303998710a18ae62d8b8c7082
parentab66955664f8987d064247dc6d585b5618745d29 (diff)
downloadrockbox-8fd6d658a1caeddc0a84dd69ffe45739bd466e74.tar.gz
rockbox-8fd6d658a1caeddc0a84dd69ffe45739bd466e74.zip
Add wake on alarm support for Ipods. Rename HAVE_ALARM_MOD to HAVE_ALARM_RTC since it's not always a mod. Make Ipod PCF driver keep other flags in OOCC1 that have been set instead of overwriting them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12522 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/alarm_menu.c4
-rw-r--r--apps/lang/english.lang2
-rw-r--r--apps/menus/settings_menu.c6
-rw-r--r--apps/tree.c2
-rw-r--r--firmware/drivers/pcf50605.c10
-rw-r--r--firmware/drivers/rtc/rtc_ds1339_ds3231.c6
-rw-r--r--firmware/drivers/rtc/rtc_m41st84w.c8
-rw-r--r--firmware/drivers/rtc/rtc_pcf50605.c94
-rw-r--r--firmware/export/config-fmrecorder.h2
-rw-r--r--firmware/export/config-h120.h2
-rw-r--r--firmware/export/config-ipod3g.h1
-rw-r--r--firmware/export/config-ipod4g.h1
-rw-r--r--firmware/export/config-ipodcolor.h1
-rw-r--r--firmware/export/config-ipodmini.h1
-rw-r--r--firmware/export/config-ipodmini2g.h1
-rw-r--r--firmware/export/config-ipodnano.h1
-rw-r--r--firmware/export/config-ipodvideo.h1
-rw-r--r--firmware/export/config-recorderv2.h2
-rw-r--r--firmware/export/rtc.h4
-rw-r--r--firmware/powermgmt.c4
20 files changed, 124 insertions, 29 deletions
diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c
index d7377c20d6..47c28c43f4 100644
--- a/apps/alarm_menu.c
+++ b/apps/alarm_menu.c
@@ -18,7 +18,7 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "config.h" 19#include "config.h"
20 20
21#ifdef HAVE_ALARM_MOD 21#ifdef HAVE_RTC_ALARM
22 22
23#include <stdbool.h> 23#include <stdbool.h>
24 24
@@ -165,4 +165,4 @@ bool alarm_screen(void)
165 return false; 165 return false;
166} 166}
167 167
168#endif /* HAVE_ALARM_MOD */ 168#endif /* HAVE_RTC_ALARM */
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index c081e53ea7..08f06ba56b 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -5356,9 +5356,11 @@
5356 user: 5356 user:
5357 <source> 5357 <source>
5358 *: "PLAY=Set OFF=Cancel" 5358 *: "PLAY=Set OFF=Cancel"
5359 ipod*: "SELECT=Set MENU=Cancel"
5359 </source> 5360 </source>
5360 <dest> 5361 <dest>
5361 *: "PLAY=Set OFF=Cancel" 5362 *: "PLAY=Set OFF=Cancel"
5363 ipod*: "SELECT=Set MENU=Cancel"
5362 </dest> 5364 </dest>
5363 <voice> 5365 <voice>
5364 *: "" 5366 *: ""
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 818271b623..92c169e43a 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -35,7 +35,7 @@
35#include "talk.h" 35#include "talk.h"
36#include "sprintf.h" 36#include "sprintf.h"
37#include "powermgmt.h" 37#include "powermgmt.h"
38#ifdef HAVE_ALARM_MOD 38#ifdef HAVE_RTC_ALARM
39#include "alarm_menu.h" 39#include "alarm_menu.h"
40#endif 40#endif
41#ifdef CONFIG_RTC 41#ifdef CONFIG_RTC
@@ -250,7 +250,7 @@ static int sleep_timer(void)
250MENUITEM_FUNCTION(sleep_timer_call, ID2P(LANG_SLEEP_TIMER), sleep_timer, 250MENUITEM_FUNCTION(sleep_timer_call, ID2P(LANG_SLEEP_TIMER), sleep_timer,
251 NULL, bitmap_icons_6x8[Icon_Menu_setting]); /* make it look like a 251 NULL, bitmap_icons_6x8[Icon_Menu_setting]); /* make it look like a
252 setting to the user */ 252 setting to the user */
253#ifdef HAVE_ALARM_MOD 253#ifdef HAVE_RTC_ALARM
254MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU), 254MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU),
255 (menu_function)alarm_screen, rtc_detect_callback, NOICON); 255 (menu_function)alarm_screen, rtc_detect_callback, NOICON);
256#endif 256#endif
@@ -295,7 +295,7 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
295#endif 295#endif
296 &poweroff, 296 &poweroff,
297 &sleep_timer_call, 297 &sleep_timer_call,
298#ifdef HAVE_ALARM_MOD 298#ifdef HAVE_RTC_ALARM
299 &alarm_screen_call, 299 &alarm_screen_call,
300#endif 300#endif
301 &limits_menu, 301 &limits_menu,
diff --git a/apps/tree.c b/apps/tree.c
index a8eaea6aa6..78fb1db76d 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -486,7 +486,7 @@ static void start_resume(bool just_powered_on)
486 global_status.resume_index, 486 global_status.resume_index,
487 global_status.resume_offset); 487 global_status.resume_offset);
488 488
489#ifdef HAVE_ALARM_MOD 489#ifdef HAVE_RTC_ALARM
490 if ( rtc_check_alarm_started(true) ) { 490 if ( rtc_check_alarm_started(true) ) {
491 rtc_enable_alarm(false); 491 rtc_enable_alarm(false);
492 do_resume = true; 492 do_resume = true;
diff --git a/firmware/drivers/pcf50605.c b/firmware/drivers/pcf50605.c
index 0610f41aec..cf4ea9fecb 100644
--- a/firmware/drivers/pcf50605.c
+++ b/firmware/drivers/pcf50605.c
@@ -89,10 +89,9 @@ int pcf50605_write(int address, unsigned char val)
89 89
90int pcf50605_write_multiple(int address, const unsigned char* buf, int count) 90int pcf50605_write_multiple(int address, const unsigned char* buf, int count)
91{ 91{
92 /* TODO */ 92 int i;
93 (void)address; 93 for (i = 0; i < count; i++)
94 (void)buf; 94 pp_i2c_send(0x8, address + i, buf[i]);
95 (void)count;
96 return 0; 95 return 0;
97} 96}
98 97
@@ -102,7 +101,8 @@ int pcf50605_write_multiple(int address, const unsigned char* buf, int count)
102 power on your iPod again. */ 101 power on your iPod again. */
103void pcf50605_standby_mode(void) 102void pcf50605_standby_mode(void)
104{ 103{
105 pcf50605_write(OOCC1, GOSTDBY | CHGWAK | EXTONWAK); 104 const char mask = pcf50605_read(OOCC1) | GOSTDBY | CHGWAK | EXTONWAK;
105 pcf50605_write(OOCC1, mask);
106} 106}
107 107
108void pcf50605_init(void) 108void pcf50605_init(void)
diff --git a/firmware/drivers/rtc/rtc_ds1339_ds3231.c b/firmware/drivers/rtc/rtc_ds1339_ds3231.c
index df67fed735..7396c2e0a1 100644
--- a/firmware/drivers/rtc/rtc_ds1339_ds3231.c
+++ b/firmware/drivers/rtc/rtc_ds1339_ds3231.c
@@ -33,14 +33,14 @@ void rtc_init(void)
33 /* read one byte from RTC; 0 on success */ 33 /* read one byte from RTC; 0 on success */
34 rtc_detected = !sw_i2c_read(RTC_ADDR, 0, &byte, 1); 34 rtc_detected = !sw_i2c_read(RTC_ADDR, 0, &byte, 1);
35 35
36#ifdef HAVE_ALARM_MOD 36#ifdef HAVE_RTC_ALARM
37 /* Check + save alarm bit first, before the power thread starts watching */ 37 /* Check + save alarm bit first, before the power thread starts watching */
38 rtc_check_alarm_started(false); 38 rtc_check_alarm_started(false);
39#endif 39#endif
40 40
41} 41}
42 42
43#ifdef HAVE_ALARM_MOD 43#ifdef HAVE_RTC_ALARM
44 44
45/* check whether the unit has been started by the RTC alarm function */ 45/* check whether the unit has been started by the RTC alarm function */
46/* (check for A2F, which => started using wakeup alarm) */ 46/* (check for A2F, which => started using wakeup alarm) */
@@ -117,7 +117,7 @@ bool rtc_enable_alarm(bool enable)
117 return false; /* all ok */ 117 return false; /* all ok */
118} 118}
119 119
120#endif /* HAVE_ALARM_MOD */ 120#endif /* HAVE_RTC_ALARM */
121 121
122int rtc_read_datetime(unsigned char* buf) 122int rtc_read_datetime(unsigned char* buf)
123{ 123{
diff --git a/firmware/drivers/rtc/rtc_m41st84w.c b/firmware/drivers/rtc/rtc_m41st84w.c
index 1d76867e13..4e861692d8 100644
--- a/firmware/drivers/rtc/rtc_m41st84w.c
+++ b/firmware/drivers/rtc/rtc_m41st84w.c
@@ -31,7 +31,7 @@ void rtc_init(void)
31{ 31{
32 unsigned char data; 32 unsigned char data;
33 33
34#ifdef HAVE_ALARM_MOD 34#ifdef HAVE_RTC_ALARM
35 /* Check + save alarm bit first, before the power thread starts watching */ 35 /* Check + save alarm bit first, before the power thread starts watching */
36 rtc_check_alarm_started(false); 36 rtc_check_alarm_started(false);
37#endif 37#endif
@@ -52,7 +52,7 @@ void rtc_init(void)
52 rtc_write(0x0c,data); 52 rtc_write(0x0c,data);
53 } 53 }
54 54
55#ifdef HAVE_ALARM_MOD 55#ifdef HAVE_RTC_ALARM
56 56
57 /* Clear Trec bit, write-protecting the RTC for 200ms when shutting off */ 57 /* Clear Trec bit, write-protecting the RTC for 200ms when shutting off */
58 /* without this, the alarm won't work! */ 58 /* without this, the alarm won't work! */
@@ -71,7 +71,7 @@ void rtc_init(void)
71#endif 71#endif
72} 72}
73 73
74#ifdef HAVE_ALARM_MOD 74#ifdef HAVE_RTC_ALARM
75 75
76/* check whether the unit has been started by the RTC alarm function */ 76/* check whether the unit has been started by the RTC alarm function */
77/* (check for AF, which => started using wakeup alarm) */ 77/* (check for AF, which => started using wakeup alarm) */
@@ -168,7 +168,7 @@ bool rtc_enable_alarm(bool enable)
168 return false; /* all ok */ 168 return false; /* all ok */
169} 169}
170 170
171#endif /* HAVE_ALARM_MOD */ 171#endif /* HAVE_RTC_ALARM */
172 172
173int rtc_write(unsigned char address, unsigned char value) 173int rtc_write(unsigned char address, unsigned char value)
174{ 174{
diff --git a/firmware/drivers/rtc/rtc_pcf50605.c b/firmware/drivers/rtc/rtc_pcf50605.c
index 1bc40146ff..fedcdd3cdf 100644
--- a/firmware/drivers/rtc/rtc_pcf50605.c
+++ b/firmware/drivers/rtc/rtc_pcf50605.c
@@ -24,8 +24,12 @@
24#include "pcf50605.h" 24#include "pcf50605.h"
25#include <stdbool.h> 25#include <stdbool.h>
26 26
27/* Values which each disable one alarm time register */
28static char alarm_disable[] = { 0x7f, 0x7f, 0x3f, 0x07, 0x3f, 0x1f, 0xff };
29
27void rtc_init(void) 30void rtc_init(void)
28{ 31{
32 rtc_check_alarm_started(false);
29} 33}
30 34
31int rtc_read_datetime(unsigned char* buf) 35int rtc_read_datetime(unsigned char* buf)
@@ -35,11 +39,93 @@ int rtc_read_datetime(unsigned char* buf)
35 39
36int rtc_write_datetime(unsigned char* buf) 40int rtc_write_datetime(unsigned char* buf)
37{ 41{
38 int i; 42 pcf50605_write_multiple(0x0a, buf, 7);
43 return 1;
44}
45
46/**
47 * Checks the PCF interrupt 1 register bit 7 to see if an alarm interrupt has
48 * triggered since last we checked.
49 */
50bool rtc_check_alarm_flag(void)
51{
52 return pcf50605_read(0x02) & 0x80;
53}
39 54
40 for (i=0;i<7;i++) { 55/**
41 pcf50605_write(0x0a+i, buf[i]); 56 * Enables or disables the alarm.
57 * The Ipod bootloader clears all PCF interrupt registers and always enables
58 * the "wake on RTC" bit on OOCC1, so we have to rely on other means to find
59 * out if we just woke from an alarm.
60 * Return value is always false for us.
61 */
62bool rtc_enable_alarm(bool enable)
63{
64 if (enable) {
65 /* Tell the PCF to ignore everything but second, minute and hour, so
66 * that an alarm will trigger the next time the alarm time occurs.
67 */
68 pcf50605_write_multiple(0x14, alarm_disable + 3, 4);
69 /* Unmask the alarm interrupt (might be unneeded) */
70 pcf50605_write(0x5, pcf50605_read(0x5) & ~0x80);
71 /* Make sure wake on RTC is set */
72 pcf50605_write(0x8, pcf50605_read(0x8) | 0x10);
73 } else {
74 /* We use this year to indicate a disabled alarm. If you happen to live
75 * around this time and are annoyed by this, feel free to seek out my
76 * grave and do something nasty to it.
77 */
78 pcf50605_write(0x17, 0x99);
42 } 79 }
80 return false;
81}
43 82
44 return 1; 83/**
84 * Check if alarm caused unit to start.
85 */
86bool rtc_check_alarm_started(bool release_alarm)
87{
88 static bool run_before = false, alarm_state;
89 bool rc;
90
91 if (run_before) {
92 rc = alarm_state;
93 alarm_state &= ~release_alarm;
94 } else {
95 char rt[3], at[3];
96 /* The Ipod bootloader seems to read (and thus clear) the PCF interrupt
97 * registers, so we need to find some other way to detect if an alarm
98 * just happened
99 */
100 pcf50605_read_multiple(0x0a, rt, 3);
101 pcf50605_read_multiple(0x11, at, 3);
102
103 /* If alarm time and real time match within 10 seconds of each other, we
104 * assume an alarm just triggered
105 */
106 rc = alarm_state = rt[1] == at[1] && rt[2] == at[2]
107 && (rt[0] - at[0]) <= 10;
108 run_before = true;
109 }
110 return rc;
111}
112
113void rtc_set_alarm(int h, int m)
114{
115 /* Set us to wake at the first second of the specified time */
116 pcf50605_write(0x11, 0);
117 /* Convert to BCD */
118 pcf50605_write(0x12, ((m/10) << 4) | m%10);
119 pcf50605_write(0x13, ((h/10) << 4) | h%10);
45} 120}
121
122void rtc_get_alarm(int *h, int *m)
123{
124 char buf[2];
125
126 pcf50605_read_multiple(0x12, buf, 2);
127 /* Convert from BCD */
128 *m = ((buf[0] >> 4) & 0x7)*10 + (buf[0] & 0x0f);
129 *h = ((buf[1] >> 4) & 0x3)*10 + (buf[1] & 0x0f);
130}
131
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index da2f7fbb87..1b7bd190d6 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -97,7 +97,7 @@
97#define FIRMWARE_OFFSET_FILE_DATA 24 97#define FIRMWARE_OFFSET_FILE_DATA 24
98 98
99/* FM recorders can wake up from RTC alarm */ 99/* FM recorders can wake up from RTC alarm */
100#define HAVE_ALARM_MOD 100#define HAVE_RTC_ALARM
101 101
102/* How to detect USB */ 102/* How to detect USB */
103#define USB_FMRECORDERSTYLE 1 103#define USB_FMRECORDERSTYLE 1
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index 9dccf22d0e..e899cd4c5a 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -48,7 +48,7 @@
48#ifndef SIMULATOR 48#ifndef SIMULATOR
49/* RTC is autodetected on target only */ 49/* RTC is autodetected on target only */
50#define CONFIG_RTC RTC_DS1339_DS3231 50#define CONFIG_RTC RTC_DS1339_DS3231
51#define HAVE_ALARM_MOD 51#define HAVE_RTC_ALARM
52#endif 52#endif
53 53
54 /* Define this if you have an remote lcd */ 54 /* Define this if you have an remote lcd */
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h
index d97b5ac886..4c9b61267f 100644
--- a/firmware/export/config-ipod3g.h
+++ b/firmware/export/config-ipod3g.h
@@ -48,6 +48,7 @@
48/* define this if you have a real-time clock */ 48/* define this if you have a real-time clock */
49#ifndef BOOTLOADER 49#ifndef BOOTLOADER
50#define CONFIG_RTC RTC_PCF50605 50#define CONFIG_RTC RTC_PCF50605
51#define HAVE_RTC_ALARM
51#endif 52#endif
52 53
53/* Define this if you have a software controlled poweroff */ 54/* Define this if you have a software controlled poweroff */
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index 504de0f471..3790500063 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -54,6 +54,7 @@
54/* define this if you have a real-time clock */ 54/* define this if you have a real-time clock */
55#ifndef BOOTLOADER 55#ifndef BOOTLOADER
56#define CONFIG_RTC RTC_PCF50605 56#define CONFIG_RTC RTC_PCF50605
57#define HAVE_RTC_ALARM
57#endif 58#endif
58 59
59/* Define this if you have a software controlled poweroff */ 60/* Define this if you have a software controlled poweroff */
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 97b4301ce6..efe49fb6a7 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -45,6 +45,7 @@
45/* define this if you have a real-time clock */ 45/* define this if you have a real-time clock */
46#ifndef BOOTLOADER 46#ifndef BOOTLOADER
47#define CONFIG_RTC RTC_PCF50605 47#define CONFIG_RTC RTC_PCF50605
48#define HAVE_RTC_ALARM
48#endif 49#endif
49 50
50/* Define this if you have a software controlled poweroff */ 51/* Define this if you have a software controlled poweroff */
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index df5da35f4c..4a6c6a5dcf 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -48,6 +48,7 @@
48/* define this if you have a real-time clock */ 48/* define this if you have a real-time clock */
49#ifndef BOOTLOADER 49#ifndef BOOTLOADER
50#define CONFIG_RTC RTC_PCF50605 50#define CONFIG_RTC RTC_PCF50605
51#define HAVE_RTC_ALARM
51#endif 52#endif
52 53
53/* Define this if you have a software controlled poweroff */ 54/* Define this if you have a software controlled poweroff */
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index aa5bef2df0..a8033b1574 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -48,6 +48,7 @@
48/* define this if you have a real-time clock */ 48/* define this if you have a real-time clock */
49#ifndef BOOTLOADER 49#ifndef BOOTLOADER
50#define CONFIG_RTC RTC_PCF50605 50#define CONFIG_RTC RTC_PCF50605
51#define HAVE_RTC_ALARM
51#endif 52#endif
52 53
53/* Define this if you have a software controlled poweroff */ 54/* Define this if you have a software controlled poweroff */
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index 52bdbe2890..2e727e463b 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -45,6 +45,7 @@
45/* define this if you have a real-time clock */ 45/* define this if you have a real-time clock */
46#ifndef BOOTLOADER 46#ifndef BOOTLOADER
47#define CONFIG_RTC RTC_PCF50605 47#define CONFIG_RTC RTC_PCF50605
48#define HAVE_RTC_ALARM
48#endif 49#endif
49 50
50/* Define this if you have a software controlled poweroff */ 51/* Define this if you have a software controlled poweroff */
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index 6f68f1e756..765c33b2a4 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -45,6 +45,7 @@
45/* define this if you have a real-time clock */ 45/* define this if you have a real-time clock */
46#ifndef BOOTLOADER 46#ifndef BOOTLOADER
47#define CONFIG_RTC RTC_PCF50605 47#define CONFIG_RTC RTC_PCF50605
48#define HAVE_RTC_ALARM
48#endif 49#endif
49 50
50/* Define this if you have a software controlled poweroff */ 51/* Define this if you have a software controlled poweroff */
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h
index f035f2dab0..0568879066 100644
--- a/firmware/export/config-recorderv2.h
+++ b/firmware/export/config-recorderv2.h
@@ -94,7 +94,7 @@
94#define FIRMWARE_OFFSET_FILE_DATA 24 94#define FIRMWARE_OFFSET_FILE_DATA 24
95 95
96/* FM recorders can wake up from RTC alarm */ 96/* FM recorders can wake up from RTC alarm */
97#define HAVE_ALARM_MOD 97#define HAVE_RTC_ALARM
98 98
99/* Define this if you have an FM Radio */ 99/* Define this if you have an FM Radio */
100#define CONFIG_TUNER S1A0903X01 100#define CONFIG_TUNER S1A0903X01
diff --git a/firmware/export/rtc.h b/firmware/export/rtc.h
index 2f13cbb578..1b0d215371 100644
--- a/firmware/export/rtc.h
+++ b/firmware/export/rtc.h
@@ -47,13 +47,13 @@ int rtc_write(unsigned char address, unsigned char value);
47 47
48#endif /* RTC_M41ST84W */ 48#endif /* RTC_M41ST84W */
49 49
50#ifdef HAVE_ALARM_MOD 50#ifdef HAVE_RTC_ALARM
51void rtc_set_alarm(int h, int m); 51void rtc_set_alarm(int h, int m);
52void rtc_get_alarm(int *h, int *m); 52void rtc_get_alarm(int *h, int *m);
53bool rtc_enable_alarm(bool enable); 53bool rtc_enable_alarm(bool enable);
54bool rtc_check_alarm_started(bool release_alarm); 54bool rtc_check_alarm_started(bool release_alarm);
55bool rtc_check_alarm_flag(void); 55bool rtc_check_alarm_flag(void);
56#endif /* HAVE_ALARM_MOD */ 56#endif /* HAVE_RTC_ALARM */
57 57
58#endif /* CONFIG_RTC */ 58#endif /* CONFIG_RTC */
59 59
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 1a1d576e67..c2f9ca0bca 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -727,7 +727,7 @@ static int runcurrent(void)
727 727
728 728
729/* Check to see whether or not we've received an alarm in the last second */ 729/* Check to see whether or not we've received an alarm in the last second */
730#ifdef HAVE_ALARM_MOD 730#ifdef HAVE_RTC_ALARM
731static void power_thread_rtc_process(void) 731static void power_thread_rtc_process(void)
732{ 732{
733 if (rtc_check_alarm_flag()) { 733 if (rtc_check_alarm_flag()) {
@@ -823,7 +823,7 @@ static void power_thread_sleep(int ticks)
823 power_off(); 823 power_off();
824 } 824 }
825 825
826#ifdef HAVE_ALARM_MOD 826#ifdef HAVE_RTC_ALARM
827 power_thread_rtc_process(); 827 power_thread_rtc_process();
828#endif 828#endif
829 829