From a83ffb208f53a91aeab09b933e3544ec29919ce1 Mon Sep 17 00:00:00 2001 From: Christi Scarborough Date: Sun, 6 Feb 2005 17:21:42 +0000 Subject: A proper alarm clock for the V2/FM (and v1 with mod) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5818 a1c6a512-1295-4272-9138-f99709370657 --- firmware/powermgmt.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'firmware/powermgmt.c') diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 4495f58d74..37715abcdd 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -36,6 +36,7 @@ #include "powermgmt.h" #include "backlight.h" #include "lcd.h" +#include "rtc.h" #ifdef CONFIG_TUNER #include "fmradio.h" #endif @@ -441,6 +442,15 @@ static void car_adapter_mode_processing(void) } #endif +/* Check to see whether or not we've received an alarm in the last second */ +#ifdef HAVE_ALARM_MOD +static void power_thread_rtc_process(void) +{ + + rtc_check_alarm_flag(); +} +#endif + /* * This function is called to do the relativly long sleep waits from within the * main power_thread loop while at the same time servicing any other periodic @@ -456,6 +466,9 @@ static void power_thread_sleep(int ticks) ticks -= small_ticks; car_adapter_mode_processing(); +#ifdef HAVE_ALARM_MOD + power_thread_rtc_process(); +#endif } #else sleep(ticks); /* no fast-processing functions, sleep the whole time */ @@ -491,7 +504,10 @@ static void power_thread(void) { /* never read power while disk is spinning, unless in USB mode */ if (ata_disk_is_active() && !usb_inserted()) { - sleep(HZ * 2); +#ifdef HAVE_ALARM_MOD + power_thread_rtc_process(); +#endif + sleep(HZ); continue; } @@ -876,7 +892,9 @@ void powermgmt_init(void) #endif /* SIMULATOR */ -void shutdown_hw(void) { +/* Various hardware housekeeping tasks relating to shutting down the jukebox */ +void shutdown_hw(void) +{ #ifndef SIMULATOR mpeg_stop(); ata_flush(); -- cgit v1.2.3