summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristi Scarborough <christi@coraline.org>2005-02-06 09:57:57 +0000
committerChristi Scarborough <christi@coraline.org>2005-02-06 09:57:57 +0000
commit247fe6d698f244123ecde9d9971e74ee99504e9e (patch)
treeafd5c663351558446b1610388b9100987da13775
parent05605866a6b9c6b01f496e580b906ababa803fe7 (diff)
downloadrockbox-247fe6d698f244123ecde9d9971e74ee99504e9e.zip
rockbox-247fe6d698f244123ecde9d9971e74ee99504e9e.tar.gz
rockbox-247fe6d698f244123ecde9d9971e74ee99504e9e.tar.bz2
rockbox-247fe6d698f244123ecde9d9971e74ee99504e9e.tar.xz
clean shutdown for idle timer and sleep timer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5814 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/misc.c15
-rw-r--r--firmware/export/powermgmt.h1
-rw-r--r--firmware/powermgmt.c19
3 files changed, 20 insertions, 15 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 9e7e394..67fe268 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -35,6 +35,7 @@
#include "ata.h"
#include "kernel.h"
#include "power.h"
+#include "powermgmt.h"
#include "backlight.h"
#ifdef HAVE_MMC
#include "ata_mmc.h"
@@ -232,19 +233,7 @@ bool clean_shutdown(void)
{
lcd_clear_display();
splash(0, true, str(LANG_SHUTTINGDOWN));
- 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();
+ shutdown_hw();
}
#endif
return false;
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index ce006e9..9226300 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 cb9fb53..91b09aa 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();
+}