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.tar.gz rockbox-228d62dd18906eaef814ec63cf888b30a94cd1c8.zip |
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 1a7d159666..4280ff9f7a 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -86,6 +86,7 @@ | |||
86 | void dac_line_in(bool enable); | 86 | void dac_line_in(bool enable); |
87 | #endif | 87 | #endif |
88 | struct user_settings global_settings; | 88 | struct user_settings global_settings; |
89 | struct system_status global_status; | ||
89 | #ifdef HAVE_RECORDING | 90 | #ifdef HAVE_RECORDING |
90 | const char rec_base_directory[] = REC_BASE_DIR; | 91 | const char rec_base_directory[] = REC_BASE_DIR; |
91 | #endif | 92 | #endif |
@@ -346,6 +347,12 @@ bool settings_write_config(char* filename) | |||
346 | close(fd); | 347 | close(fd); |
347 | return true; | 348 | return true; |
348 | } | 349 | } |
350 | #ifndef HAVE_RTC_RAM | ||
351 | static bool flush_global_status_callback(void) | ||
352 | { | ||
353 | return write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); | ||
354 | } | ||
355 | #endif | ||
349 | static bool flush_config_block_callback(void) | 356 | static bool flush_config_block_callback(void) |
350 | { | 357 | { |
351 | bool r1, r2; | 358 | bool r1, r2; |
@@ -357,16 +364,33 @@ static bool flush_config_block_callback(void) | |||
357 | /* | 364 | /* |
358 | * persist all runtime user settings to disk or RTC RAM | 365 | * persist all runtime user settings to disk or RTC RAM |
359 | */ | 366 | */ |
360 | int settings_save( void ) | 367 | static void update_runtime(void) |
361 | { | 368 | { |
362 | int elapsed_secs; | 369 | int elapsed_secs; |
363 | 370 | ||
364 | elapsed_secs = (current_tick - lasttime) / HZ; | 371 | elapsed_secs = (current_tick - lasttime) / HZ; |
365 | global_settings.runtime += elapsed_secs; | 372 | global_status.runtime += elapsed_secs; |
366 | lasttime += (elapsed_secs * HZ); | 373 | lasttime += (elapsed_secs * HZ); |
367 | 374 | ||
368 | if ( global_settings.runtime > global_settings.topruntime ) | 375 | if ( global_status.runtime > global_status.topruntime ) |
369 | global_settings.topruntime = global_settings.runtime; | 376 | global_status.topruntime = global_status.runtime; |
377 | } | ||
378 | |||
379 | void status_save( void ) | ||
380 | { | ||
381 | update_runtime(); | ||
382 | #ifdef HAVE_RTC_RAM | ||
383 | /* this will be done in the ata_callback if | ||
384 | target doesnt have rtc ram */ | ||
385 | write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); | ||
386 | #else | ||
387 | register_ata_idle_func(flush_global_status_callback); | ||
388 | #endif | ||
389 | } | ||
390 | |||
391 | int settings_save( void ) | ||
392 | { | ||
393 | update_runtime(); | ||
370 | #ifdef HAVE_RTC_RAM | 394 | #ifdef HAVE_RTC_RAM |
371 | /* this will be done in the ata_callback if | 395 | /* this will be done in the ata_callback if |
372 | target doesnt have rtc ram */ | 396 | target doesnt have rtc ram */ |