summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c28
1 files changed, 28 insertions, 0 deletions
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 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include <ctype.h> 19#include <ctype.h>
20#include "lang.h"
20#include "string.h" 21#include "string.h"
21#include "config.h" 22#include "config.h"
22#include "file.h" 23#include "file.h"
@@ -25,6 +26,13 @@
25#include "errno.h" 26#include "errno.h"
26#include "system.h" 27#include "system.h"
27#include "timefuncs.h" 28#include "timefuncs.h"
29#include "screens.h"
30#include "mpeg.h"
31#include "mp3_playback.h"
32#include "settings.h"
33#include "ata.h"
34#include "kernel.h"
35#include "power.h"
28 36
29#define ONE_KILOBYTE 1024 37#define ONE_KILOBYTE 1024
30#define ONE_MEGABYTE (1024*1024) 38#define ONE_MEGABYTE (1024*1024)
@@ -204,3 +212,23 @@ bool settings_parseline(char* line, char** name, char** value)
204 *value = ptr; 212 *value = ptr;
205 return true; 213 return true;
206} 214}
215
216bool clean_shutdown(void)
217{
218 lcd_clear_display();
219 splash(0, true, str(LANG_SHUTTINGDOWN));
220 mpeg_stop();
221 settings_save();
222 ata_flush();
223 ata_spindown(1);
224#ifndef SIMULATOR
225 while(ata_disk_is_active())
226 sleep(HZ/10);
227 if(!charger_inserted())
228 {
229 mp3_shutdown();
230 power_off();
231 }
232#endif
233 return false;
234}