From f4d4a6ab60960385b99fd43d8e1d0213bdf1aec3 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Thu, 3 Jul 2008 13:37:57 +0000 Subject: [PATCH] Implement FS#8947 - Add a stub in the simulator for ata_disk_is_active. This make it possible to clean up some #ifdef SIMULATOR macros. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17927 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugin.c | 2 -- apps/plugin.h | 2 -- apps/recorder/peakmeter.c | 2 +- apps/recorder/recording.c | 6 +----- apps/tagtree.c | 2 +- uisimulator/common/stubs.c | 8 ++++++++ 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/plugin.c b/apps/plugin.c index 38c95cd572..08beddf8fb 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -263,9 +263,7 @@ static const struct plugin_api rockbox_api = { read_line, settings_parseline, ata_sleep, -#ifndef SIMULATOR ata_disk_is_active, -#endif ata_spin, ata_spindown, reload_directory, diff --git a/apps/plugin.h b/apps/plugin.h index 5223f85d2c..28c3d5a5a5 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -364,9 +364,7 @@ struct plugin_api { int (*read_line)(int fd, char* buffer, int buffer_size); bool (*settings_parseline)(char* line, char** name, char** value); void (*ata_sleep)(void); -#ifndef SIMULATOR bool (*ata_disk_is_active)(void); -#endif void (*ata_spin)(void); void (*ata_spindown)(int seconds); void (*reload_directory)(void); diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index 29be704f0c..fc7c9bc5f5 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c @@ -1335,7 +1335,7 @@ int peak_meter_draw_get_btn(int action_context, int x, int y[], long next_refresh = current_tick; long next_big_refresh = current_tick + HZ / 10; int i; -#if (CONFIG_CODEC == SWCODEC) || defined(SIMULATOR) +#if (CONFIG_CODEC == SWCODEC) bool highperf = false; #else /* On MAS targets, we need to poll as often as possible in order to not diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index de4a2e6805..4afa87e5b6 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -292,11 +292,7 @@ static bool read_peak_levels(int *peak_l, int *peak_r, int *balance) peak_valid_mem[peak_time % 3] = *peak_l; if (((peak_valid_mem[0] == peak_valid_mem[1]) && (peak_valid_mem[1] == peak_valid_mem[2])) && - ((*peak_l < 32767) -#ifndef SIMULATOR - || ata_disk_is_active() -#endif - )) + ((*peak_l < 32767) || ata_disk_is_active())) return false; if (*peak_r > *peak_l) diff --git a/apps/tagtree.c b/apps/tagtree.c index b8fffa9b56..eb9df07113 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -1057,7 +1057,7 @@ static int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs, /* Show search progress straight away if the disk needs to spin up, otherwise show it after the normal 1/2 second delay */ show_search_progress( -#if !defined(HAVE_FLASH_STORAGE) && !defined(SIMULATOR) +#if !defined(HAVE_FLASH_STORAGE) ata_disk_is_active() #else true diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index 7bf3a4f546..7b630eb25b 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c @@ -33,6 +33,7 @@ #include "ata.h" /* for volume definitions */ extern char having_new_lcd; +static bool ata_spinning = false; #if CONFIG_CODEC != SWCODEC void audio_set_buffer_margin(int seconds) @@ -108,6 +109,7 @@ void ata_flush(void) void ata_spin(void) { + ata_spinning = true; } void ata_sleep(void) @@ -115,9 +117,15 @@ void ata_sleep(void) DEBUGF("ata_sleep()\n"); } +bool ata_disk_is_active(void) +{ + return ata_spinning; +} + void ata_spindown(int s) { (void)s; + ata_spinning = false; } void rtc_init(void)