From 5b5003dcb12b0fe22f497a62d3024f3cf7a10fd1 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Sat, 24 Jul 2004 21:26:41 +0000 Subject: New feature: clean shutdown if you press OFF twice in the file browser, or select "Shut off" in the main menu. Players only have the menu option, due to lack of keys. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4940 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'apps/misc.c') diff --git a/apps/misc.c b/apps/misc.c index 535cd81814..8bb78f5d64 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -17,6 +17,7 @@ * ****************************************************************************/ #include +#include "lang.h" #include "string.h" #include "config.h" #include "file.h" @@ -25,6 +26,13 @@ #include "errno.h" #include "system.h" #include "timefuncs.h" +#include "screens.h" +#include "mpeg.h" +#include "mp3_playback.h" +#include "settings.h" +#include "ata.h" +#include "kernel.h" +#include "power.h" #define ONE_KILOBYTE 1024 #define ONE_MEGABYTE (1024*1024) @@ -204,3 +212,23 @@ bool settings_parseline(char* line, char** name, char** value) *value = ptr; return true; } + +bool clean_shutdown(void) +{ + lcd_clear_display(); + splash(0, true, str(LANG_SHUTTINGDOWN)); + mpeg_stop(); + settings_save(); + ata_flush(); + ata_spindown(1); +#ifndef SIMULATOR + while(ata_disk_is_active()) + sleep(HZ/10); + if(!charger_inserted()) + { + mp3_shutdown(); + power_off(); + } +#endif + return false; +} -- cgit v1.2.3