summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-02-14 09:44:34 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-02-14 09:44:34 +0000
commitc4d8d970f6602c80d7362a41da8851dbbf59ae1b (patch)
tree7e8f936eae5c1854c006c4fe134c4c2ce6f91291 /apps/settings.c
parent84706a4188cea193a5a095855c1068b1c31a3875 (diff)
The power-saving SLEEP patch by Simon Elén.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3259 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/settings.c b/apps/settings.c
index bc78e823dd..c7ab9e411c 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include "config.h"
#include "kernel.h"
+#include "thread.h"
#include "settings.h"
#include "disk.h"
#include "panic.h"
@@ -102,7 +103,7 @@ offset abs
0x23 0x37 <rec. left gain (bit 0-3)>
0x24 0x38 <rec. right gain (bit 0-3)>
0x25 0x39 <disk poweroff flag (bit 0), MP3 buffer margin (bit 1-3),
- Trickle charge flag (bit 4)>
+ Trickle charge flag (bit 4), CPU sleep flag (bit 5)>
0x26 0x40 <runtime low byte>
0x27 0x41 <runtime high byte>
0x28 0x42 <topruntime low byte>
@@ -350,7 +351,8 @@ int settings_save( void )
config_block[0x25] = (unsigned char)
((global_settings.disk_poweroff & 1) |
((global_settings.buffer_margin & 7) << 1) |
- ((global_settings.trickle_charge & 1) << 4));
+ ((global_settings.trickle_charge & 1) << 4) |
+ ((global_settings.cpu_sleep & 1) << 5));
{
static long lasttime = 0;
@@ -513,6 +515,8 @@ void settings_apply(void)
global_settings.lang_file);
lang_load(buf);
}
+
+ cpu_sleep(global_settings.cpu_sleep);
}
/*
@@ -636,6 +640,7 @@ void settings_load(void)
global_settings.disk_poweroff = config_block[0x25] & 1;
global_settings.buffer_margin = (config_block[0x25] >> 1) & 7;
global_settings.trickle_charge = (config_block[0x25] >> 4) & 1;
+ global_settings.cpu_sleep = (config_block[0x25] >> 5) & 1;
}
if (config_block[0x27] != 0xff)
@@ -881,6 +886,7 @@ void settings_reset(void) {
global_settings.lang_file[0] = 0;
global_settings.runtime = 0;
global_settings.topruntime = 0;
+ global_settings.cpu_sleep = true;
}