diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-01-24 02:19:22 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-01-24 02:19:22 +0000 |
| commit | 228d62dd18906eaef814ec63cf888b30a94cd1c8 (patch) | |
| tree | a15e27e0e52222e4514e2b163e726869b33b5397 /apps/settings.c | |
| parent | cdcffd988372606abea31fad4a815f0b4968b21c (diff) | |
| download | rockbox-228d62dd18906eaef814ec63cf888b30a94cd1c8.zip rockbox-228d62dd18906eaef814ec63cf888b30a94cd1c8.tar.gz rockbox-228d62dd18906eaef814ec63cf888b30a94cd1c8.tar.bz2 rockbox-228d62dd18906eaef814ec63cf888b30a94cd1c8.tar.xz | |
Split the system status variables out of global_settings and put them into a new struct global_status. Use status_save() if these need
saving.
Added car_adapter_mode to the nvram settings, so nvram settings will be reset.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12101 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
| -rw-r--r-- | apps/settings.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/apps/settings.c b/apps/settings.c index 1a7d159..4280ff9 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -86,6 +86,7 @@ void dac_line_in(bool enable); #endif struct user_settings global_settings; +struct system_status global_status; #ifdef HAVE_RECORDING const char rec_base_directory[] = REC_BASE_DIR; #endif @@ -346,6 +347,12 @@ bool settings_write_config(char* filename) close(fd); return true; } +#ifndef HAVE_RTC_RAM +static bool flush_global_status_callback(void) +{ + return write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); +} +#endif static bool flush_config_block_callback(void) { bool r1, r2; @@ -357,16 +364,33 @@ static bool flush_config_block_callback(void) /* * persist all runtime user settings to disk or RTC RAM */ -int settings_save( void ) +static void update_runtime(void) { int elapsed_secs; elapsed_secs = (current_tick - lasttime) / HZ; - global_settings.runtime += elapsed_secs; + global_status.runtime += elapsed_secs; lasttime += (elapsed_secs * HZ); - if ( global_settings.runtime > global_settings.topruntime ) - global_settings.topruntime = global_settings.runtime; + if ( global_status.runtime > global_status.topruntime ) + global_status.topruntime = global_status.runtime; +} + +void status_save( void ) +{ + update_runtime(); +#ifdef HAVE_RTC_RAM + /* this will be done in the ata_callback if + target doesnt have rtc ram */ + write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); +#else + register_ata_idle_func(flush_global_status_callback); +#endif +} + +int settings_save( void ) +{ + update_runtime(); #ifdef HAVE_RTC_RAM /* this will be done in the ata_callback if target doesnt have rtc ram */ |