clean shutdown for idle timer and sleep timer

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5814 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Christi Scarborough 2005-02-06 09:57:57 +00:00
parent 05605866a6
commit 247fe6d698
3 changed files with 20 additions and 15 deletions

View File

@ -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;

View File

@ -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

View File

@ -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();
}