diff options
| author | Björn Stenberg <bjorn@haxx.se> | 2003-02-14 09:44:34 +0000 |
|---|---|---|
| committer | Björn Stenberg <bjorn@haxx.se> | 2003-02-14 09:44:34 +0000 |
| commit | c4d8d970f6602c80d7362a41da8851dbbf59ae1b (patch) | |
| tree | 7e8f936eae5c1854c006c4fe134c4c2ce6f91291 /apps | |
| parent | 84706a4188cea193a5a095855c1068b1c31a3875 (diff) | |
| download | rockbox-c4d8d970f6602c80d7362a41da8851dbbf59ae1b.zip rockbox-c4d8d970f6602c80d7362a41da8851dbbf59ae1b.tar.gz rockbox-c4d8d970f6602c80d7362a41da8851dbbf59ae1b.tar.bz2 rockbox-c4d8d970f6602c80d7362a41da8851dbbf59ae1b.tar.xz | |
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')
| -rw-r--r-- | apps/lang/english.lang | 5 | ||||
| -rw-r--r-- | apps/main.c | 2 | ||||
| -rw-r--r-- | apps/recorder/recording.c | 3 | ||||
| -rw-r--r-- | apps/settings.c | 10 | ||||
| -rw-r--r-- | apps/settings.h | 2 | ||||
| -rw-r--r-- | apps/settings_menu.c | 9 |
6 files changed, 26 insertions, 5 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index c1541cf..f272bea 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -1376,3 +1376,8 @@ id: LANG_RECORDING_SIZE desc: Display of recorded file size eng: "Size:" new: + +id: LANG_CPU_SLEEP +desc: in system_settings_menu() +eng: "Power Saving" +new: diff --git a/apps/main.c b/apps/main.c index 614a7fc..e33e2bd 100644 --- a/apps/main.c +++ b/apps/main.c @@ -103,12 +103,12 @@ void init(void) font_init(); show_logo(); + set_irq_level(0); #ifdef DEBUG debug_init(); #else serial_setup(); #endif - set_irq_level(0); i2c_init(); diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 8fb31d8..5196735 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -180,8 +180,7 @@ bool recording_screen(void) while(!done) { - yield(); - button = button_get(false); + button = button_get_w_tmo(HZ / peak_meter_fps); switch(button) { case BUTTON_OFF: diff --git a/apps/settings.c b/apps/settings.c index bc78e82..c7ab9e4 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; } diff --git a/apps/settings.h b/apps/settings.h index be41ef8..529797c 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -147,6 +147,8 @@ struct user_settings int bidir_limit; /* bidir scroll length limit */ int scroll_delay; /* delay (in 1/10s) before starting scroll */ int scroll_step; /* pixels to advance per update */ + + bool cpu_sleep; /* Use sleep instruction when idle? */ }; /* prototypes */ diff --git a/apps/settings_menu.c b/apps/settings_menu.c index baffb81..37b2b09 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -27,6 +27,7 @@ #include "mpeg.h" #include "button.h" #include "kernel.h" +#include "thread.h" #include "sprintf.h" #include "settings.h" #include "settings_menu.h" @@ -539,6 +540,13 @@ static bool poweroff(void) } #endif +static bool cpu_sleep_set(void) +{ + bool result = set_bool(str(LANG_CPU_SLEEP), &global_settings.cpu_sleep); + cpu_sleep(global_settings.cpu_sleep); + return result; +} + static bool buffer_margin(void) { return set_int(str(LANG_MP3BUFFER_MARGIN), "s", @@ -731,6 +739,7 @@ static bool system_settings_menu(void) #ifdef HAVE_ATA_POWER_OFF { str(LANG_POWEROFF), poweroff }, #endif + { str(LANG_CPU_SLEEP), cpu_sleep_set }, #ifndef SIMULATOR { str(LANG_BATTERY_CAPACITY), battery_capacity }, #endif |