diff options
author | Christi Scarborough <christi@coraline.org> | 2005-02-06 17:21:42 +0000 |
---|---|---|
committer | Christi Scarborough <christi@coraline.org> | 2005-02-06 17:21:42 +0000 |
commit | a83ffb208f53a91aeab09b933e3544ec29919ce1 (patch) | |
tree | 1aa7f5fe667b2d65cf3482a5488539d7d25cec90 /firmware/powermgmt.c | |
parent | 59eb461f8255b636800c120d7640d10d6a15e175 (diff) | |
download | rockbox-a83ffb208f53a91aeab09b933e3544ec29919ce1.tar.gz rockbox-a83ffb208f53a91aeab09b933e3544ec29919ce1.zip |
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
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r-- | firmware/powermgmt.c | 22 |
1 files changed, 20 insertions, 2 deletions
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 @@ | |||
36 | #include "powermgmt.h" | 36 | #include "powermgmt.h" |
37 | #include "backlight.h" | 37 | #include "backlight.h" |
38 | #include "lcd.h" | 38 | #include "lcd.h" |
39 | #include "rtc.h" | ||
39 | #ifdef CONFIG_TUNER | 40 | #ifdef CONFIG_TUNER |
40 | #include "fmradio.h" | 41 | #include "fmradio.h" |
41 | #endif | 42 | #endif |
@@ -441,6 +442,15 @@ static void car_adapter_mode_processing(void) | |||
441 | } | 442 | } |
442 | #endif | 443 | #endif |
443 | 444 | ||
445 | /* Check to see whether or not we've received an alarm in the last second */ | ||
446 | #ifdef HAVE_ALARM_MOD | ||
447 | static void power_thread_rtc_process(void) | ||
448 | { | ||
449 | |||
450 | rtc_check_alarm_flag(); | ||
451 | } | ||
452 | #endif | ||
453 | |||
444 | /* | 454 | /* |
445 | * This function is called to do the relativly long sleep waits from within the | 455 | * This function is called to do the relativly long sleep waits from within the |
446 | * main power_thread loop while at the same time servicing any other periodic | 456 | * main power_thread loop while at the same time servicing any other periodic |
@@ -456,6 +466,9 @@ static void power_thread_sleep(int ticks) | |||
456 | ticks -= small_ticks; | 466 | ticks -= small_ticks; |
457 | 467 | ||
458 | car_adapter_mode_processing(); | 468 | car_adapter_mode_processing(); |
469 | #ifdef HAVE_ALARM_MOD | ||
470 | power_thread_rtc_process(); | ||
471 | #endif | ||
459 | } | 472 | } |
460 | #else | 473 | #else |
461 | sleep(ticks); /* no fast-processing functions, sleep the whole time */ | 474 | sleep(ticks); /* no fast-processing functions, sleep the whole time */ |
@@ -491,7 +504,10 @@ static void power_thread(void) | |||
491 | { | 504 | { |
492 | /* never read power while disk is spinning, unless in USB mode */ | 505 | /* never read power while disk is spinning, unless in USB mode */ |
493 | if (ata_disk_is_active() && !usb_inserted()) { | 506 | if (ata_disk_is_active() && !usb_inserted()) { |
494 | sleep(HZ * 2); | 507 | #ifdef HAVE_ALARM_MOD |
508 | power_thread_rtc_process(); | ||
509 | #endif | ||
510 | sleep(HZ); | ||
495 | continue; | 511 | continue; |
496 | } | 512 | } |
497 | 513 | ||
@@ -876,7 +892,9 @@ void powermgmt_init(void) | |||
876 | 892 | ||
877 | #endif /* SIMULATOR */ | 893 | #endif /* SIMULATOR */ |
878 | 894 | ||
879 | void shutdown_hw(void) { | 895 | /* Various hardware housekeeping tasks relating to shutting down the jukebox */ |
896 | void shutdown_hw(void) | ||
897 | { | ||
880 | #ifndef SIMULATOR | 898 | #ifndef SIMULATOR |
881 | mpeg_stop(); | 899 | mpeg_stop(); |
882 | ata_flush(); | 900 | ata_flush(); |