From 247fe6d698f244123ecde9d9971e74ee99504e9e Mon Sep 17 00:00:00 2001 From: Christi Scarborough Date: Sun, 6 Feb 2005 09:57:57 +0000 Subject: clean shutdown for idle timer and sleep timer git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5814 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/powermgmt.h | 1 + firmware/powermgmt.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'firmware') diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index ce006e9145..922630097a 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -120,5 +120,6 @@ void set_sleep_timer(int seconds); int get_sleep_timer(void); void set_car_adapter_mode(bool setting); void reset_poweroff_timer(void); +void shutdown_hw(void); #endif diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index cb9fb53fcb..91b09aa555 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -351,7 +351,7 @@ static void handle_auto_poweroff(void) TIME_AFTER(current_tick, last_disk_activity + timeout) && TIME_AFTER(current_tick, last_charge_time + timeout)) { - power_off(); + shutdown_hw(); } } else @@ -375,7 +375,7 @@ static void handle_auto_poweroff(void) we cut the power */ while(ata_disk_is_active()) sleep(HZ); - power_off(); + shutdown_hw(); } } } @@ -874,3 +874,18 @@ void powermgmt_init(void) #endif /* SIMULATOR */ +void shutdown_hw(void) { + mpeg_stop(); + ata_flush(); + ata_spindown(1); + while(ata_disk_is_active()) + sleep(HZ/10); + + mp3_shutdown(); +#if CONFIG_KEYPAD == ONDIO_PAD + backlight_off(); + sleep(1); + lcd_set_contrast(0); +#endif + power_off(); +} -- cgit v1.2.3