summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/buffering.c6
-rw-r--r--apps/codecs.c2
-rw-r--r--apps/debug_menu.c39
-rw-r--r--apps/gui/gwps.c8
-rw-r--r--apps/main.c6
-rw-r--r--apps/misc.c6
-rw-r--r--apps/mpeg.c10
-rw-r--r--apps/playback.c2
-rw-r--r--apps/playlist.c2
-rw-r--r--apps/plugin.c15
-rw-r--r--apps/plugin.h14
-rw-r--r--apps/plugins/battery_bench.c4
-rw-r--r--apps/plugins/clock/clock_settings.c2
-rw-r--r--apps/plugins/jpeg/jpeg.c8
-rw-r--r--apps/plugins/mpegplayer/disk_buf.c6
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.h2
-rw-r--r--apps/plugins/video.c2
-rw-r--r--apps/plugins/wavplay.c2
-rw-r--r--apps/recorder/pcm_record.c10
-rw-r--r--apps/recorder/peakmeter.c4
-rw-r--r--apps/recorder/recording.c8
-rw-r--r--apps/scrobbler.c2
-rw-r--r--apps/settings.c11
-rw-r--r--apps/settings_list.c4
-rw-r--r--apps/tagcache.c2
-rw-r--r--apps/tagtree.c3
-rw-r--r--apps/tree.c4
27 files changed, 107 insertions, 77 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index d963a983a6..534a82d7b9 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -26,7 +26,7 @@
26#include <ctype.h> 26#include <ctype.h>
27#include "buffering.h" 27#include "buffering.h"
28 28
29#include "ata.h" 29#include "storage.h"
30#include "system.h" 30#include "system.h"
31#include "thread.h" 31#include "thread.h"
32#include "file.h" 32#include "file.h"
@@ -832,7 +832,7 @@ static bool fill_buffer(void)
832 { 832 {
833 /* only spin the disk down if the filling wasn't interrupted by an 833 /* only spin the disk down if the filling wasn't interrupted by an
834 event arriving in the queue. */ 834 event arriving in the queue. */
835 ata_sleep(); 835 storage_sleep();
836 return false; 836 return false;
837 } 837 }
838} 838}
@@ -1408,7 +1408,7 @@ void buffering_thread(void)
1408 * for simplicity until its done right */ 1408 * for simplicity until its done right */
1409#if MEM > 8 1409#if MEM > 8
1410 /* If the disk is spinning, take advantage by filling the buffer */ 1410 /* If the disk is spinning, take advantage by filling the buffer */
1411 else if (ata_disk_is_active() && queue_empty(&buffering_queue)) 1411 else if (storage_disk_is_active() && queue_empty(&buffering_queue))
1412 { 1412 {
1413 if (num_handles > 0 && data_counters.useful <= high_watermark) 1413 if (num_handles > 0 && data_counters.useful <= high_watermark)
1414 send_event(BUFFER_EVENT_BUFFER_LOW, 0); 1414 send_event(BUFFER_EVENT_BUFFER_LOW, 0);
diff --git a/apps/codecs.c b/apps/codecs.c
index 53fa6755a8..8f5a0e36fd 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -43,7 +43,7 @@
43#include "buffering.h" 43#include "buffering.h"
44#include "mp3_playback.h" 44#include "mp3_playback.h"
45#include "backlight.h" 45#include "backlight.h"
46#include "ata.h" 46#include "storage.h"
47#include "talk.h" 47#include "talk.h"
48#include "mp3data.h" 48#include "mp3data.h"
49#include "powermgmt.h" 49#include "powermgmt.h"
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 26534cc101..b6038e7c89 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -59,13 +59,16 @@
59#include "power.h" 59#include "power.h"
60#include "usb.h" 60#include "usb.h"
61#include "rtc.h" 61#include "rtc.h"
62#include "ata.h" 62#include "storage.h"
63#include "fat.h" 63#include "fat.h"
64#include "mas.h" 64#include "mas.h"
65#include "eeprom_24cxx.h" 65#include "eeprom_24cxx.h"
66#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD) 66#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
67#include "hotswap.h" 67#include "hotswap.h"
68#endif 68#endif
69#if (CONFIG_STORAGE & STORAGE_ATA)
70#include "ata.h"
71#endif
69#if CONFIG_TUNER 72#if CONFIG_TUNER
70#include "tuner.h" 73#include "tuner.h"
71#include "radio.h" 74#include "radio.h"
@@ -1731,11 +1734,13 @@ static bool view_battery(void)
1731 1734
1732#ifndef SIMULATOR 1735#ifndef SIMULATOR
1733#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD) 1736#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
1737
1734#if (CONFIG_STORAGE & STORAGE_MMC) 1738#if (CONFIG_STORAGE & STORAGE_MMC)
1735#define CARDTYPE "MMC" 1739#define CARDTYPE "MMC"
1736#else 1740#elif (CONFIG_STORAGE & STORAGE_SD)
1737#define CARDTYPE "microSD" 1741#define CARDTYPE "microSD"
1738#endif 1742#endif
1743
1739static int disk_callback(int btn, struct gui_synclist *lists) 1744static int disk_callback(int btn, struct gui_synclist *lists)
1740{ 1745{
1741 tCardInfo *card; 1746 tCardInfo *card;
@@ -1826,7 +1831,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
1826 } 1831 }
1827 return btn; 1832 return btn;
1828} 1833}
1829#else /* !(CONFIG_STORAGE & STORAGE_MMC) && !(CONFIG_STORAGE & STORAGE_SD) */ 1834#elif (CONFIG_STORAGE & STORAGE_ATA)
1830static int disk_callback(int btn, struct gui_synclist *lists) 1835static int disk_callback(int btn, struct gui_synclist *lists)
1831{ 1836{
1832 (void)lists; 1837 (void)lists;
@@ -1860,7 +1865,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
1860 simplelist_addline(SIMPLELIST_ADD_LINE, 1865 simplelist_addline(SIMPLELIST_ADD_LINE,
1861 "Free: %ld MB", free / 1024); 1866 "Free: %ld MB", free / 1024);
1862 simplelist_addline(SIMPLELIST_ADD_LINE, 1867 simplelist_addline(SIMPLELIST_ADD_LINE,
1863 "Spinup time: %d ms", ata_spinup_time * (1000/HZ)); 1868 "Spinup time: %d ms", storage_spinup_time() * (1000/HZ));
1864 i = identify_info[83] & (1<<3); 1869 i = identify_info[83] & (1<<3);
1865 simplelist_addline(SIMPLELIST_ADD_LINE, 1870 simplelist_addline(SIMPLELIST_ADD_LINE,
1866 "Power mgmt: %s", i ? "enabled" : "unsupported"); 1871 "Power mgmt: %s", i ? "enabled" : "unsupported");
@@ -1945,7 +1950,29 @@ static int disk_callback(int btn, struct gui_synclist *lists)
1945 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0))); 1950 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
1946 return btn; 1951 return btn;
1947} 1952}
1953#else /* No SD, MMC or ATA */
1954static int disk_callback(int btn, struct gui_synclist *lists)
1955{
1956 (void)btn;
1957 (void)lists;
1958 struct storage_info info;
1959 storage_get_info(IF_MV2(0,)&info);
1960 simplelist_addline(SIMPLELIST_ADD_LINE, "Vendor: %s", info.vendor);
1961 simplelist_addline(SIMPLELIST_ADD_LINE, "Model: %s", info.product);
1962 simplelist_addline(SIMPLELIST_ADD_LINE, "Firmware: %s", info.revision);
1963 simplelist_addline(SIMPLELIST_ADD_LINE,
1964 "Size: %ld MB", info.num_sectors*(info.sector_size/512)/2024);
1965 unsigned long free;
1966 fat_size( IF_MV2(0,) NULL, &free );
1967 simplelist_addline(SIMPLELIST_ADD_LINE,
1968 "Free: %ld MB", free / 1024);
1969 simplelist_addline(SIMPLELIST_ADD_LINE,
1970 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
1971 return btn;
1972}
1973#endif
1948 1974
1975#if (CONFIG_STORAGE & STORAGE_ATA)
1949static bool dbg_identify_info(void) 1976static bool dbg_identify_info(void)
1950{ 1977{
1951 int fd = creat("/identify_info.bin"); 1978 int fd = creat("/identify_info.bin");
@@ -1960,7 +1987,7 @@ static bool dbg_identify_info(void)
1960 } 1987 }
1961 return false; 1988 return false;
1962} 1989}
1963#endif /* !(CONFIG_STORAGE & STORAGE_MMC) && !(CONFIG_STORAGE & STORAGE_SD) */ 1990#endif
1964 1991
1965static bool dbg_disk_info(void) 1992static bool dbg_disk_info(void)
1966{ 1993{
@@ -2504,7 +2531,7 @@ static const struct the_menu_item menuitems[] = {
2504#endif 2531#endif
2505#ifndef SIMULATOR 2532#ifndef SIMULATOR
2506 { "View disk info", dbg_disk_info }, 2533 { "View disk info", dbg_disk_info },
2507#if !(CONFIG_STORAGE & STORAGE_MMC) && !(CONFIG_STORAGE & STORAGE_SD) 2534#if (CONFIG_STORAGE & STORAGE_ATA)
2508 { "Dump ATA identify info", dbg_identify_info}, 2535 { "Dump ATA identify info", dbg_identify_info},
2509#endif 2536#endif
2510#endif 2537#endif
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 4d50740182..9b6d6b5558 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -39,7 +39,7 @@
39#include "audio.h" 39#include "audio.h"
40#include "usb.h" 40#include "usb.h"
41#include "status.h" 41#include "status.h"
42#include "ata.h" 42#include "storage.h"
43#include "screens.h" 43#include "screens.h"
44#include "playlist.h" 44#include "playlist.h"
45#ifdef HAVE_LCD_BITMAP 45#ifdef HAVE_LCD_BITMAP
@@ -184,7 +184,7 @@ long gui_wps_show(void)
184 if (wps_state.paused) { 184 if (wps_state.paused) {
185 settings_save(); 185 settings_save();
186#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) 186#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF)
187 call_ata_idle_notifys(true); 187 call_storage_idle_notifys(true);
188#endif 188#endif
189 } 189 }
190 } 190 }
@@ -322,7 +322,7 @@ long gui_wps_show(void)
322 audio_pause(); 322 audio_pause();
323 settings_save(); 323 settings_save();
324#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) 324#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF)
325 call_ata_idle_notifys(true); /* make sure resume info is saved */ 325 call_storage_idle_notifys(true); /* make sure resume info is saved */
326#endif 326#endif
327 } 327 }
328 break; 328 break;
@@ -701,7 +701,7 @@ long gui_wps_show(void)
701 } 701 }
702 702
703 if ( button ) 703 if ( button )
704 ata_spin(); 704 storage_spin();
705 } 705 }
706 return GO_TO_ROOT; /* unreachable - just to reduce compiler warnings */ 706 return GO_TO_ROOT; /* unreachable - just to reduce compiler warnings */
707} 707}
diff --git a/apps/main.c b/apps/main.c
index 50597699c5..111c5d1e78 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -20,7 +20,7 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "config.h" 21#include "config.h"
22 22
23#include "ata.h" 23#include "storage.h"
24#include "disk.h" 24#include "disk.h"
25#include "fat.h" 25#include "fat.h"
26#include "lcd.h" 26#include "lcd.h"
@@ -289,7 +289,7 @@ static void init(void)
289#endif 289#endif
290 /* Must be done before any code uses the multi-screen APi */ 290 /* Must be done before any code uses the multi-screen APi */
291 gui_syncstatusbar_init(&statusbars); 291 gui_syncstatusbar_init(&statusbars);
292 ata_init(); 292 storage_init();
293 settings_reset(); 293 settings_reset();
294 settings_load(SETTINGS_ALL); 294 settings_load(SETTINGS_ALL);
295 gui_sync_wps_init(); 295 gui_sync_wps_init();
@@ -427,7 +427,7 @@ static void init(void)
427 } 427 }
428#endif 428#endif
429 429
430 rc = ata_init(); 430 rc = storage_init();
431 if(rc) 431 if(rc)
432 { 432 {
433#ifdef HAVE_LCD_BITMAP 433#ifdef HAVE_LCD_BITMAP
diff --git a/apps/misc.c b/apps/misc.c
index 7c8ff0fbd8..02d8bed2d8 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -46,7 +46,7 @@
46#include "audio.h" 46#include "audio.h"
47#include "mp3_playback.h" 47#include "mp3_playback.h"
48#include "settings.h" 48#include "settings.h"
49#include "ata.h" 49#include "storage.h"
50#include "ata_idle_notify.h" 50#include "ata_idle_notify.h"
51#include "kernel.h" 51#include "kernel.h"
52#include "power.h" 52#include "power.h"
@@ -621,7 +621,7 @@ bool settings_parseline(char* line, char** name, char** value)
621static void system_flush(void) 621static void system_flush(void)
622{ 622{
623 tree_flush(); 623 tree_flush();
624 call_ata_idle_notifys(true); /*doesnt work on usb and shutdown from ata thread */ 624 call_storage_idle_notifys(true); /*doesnt work on usb and shutdown from ata thread */
625} 625}
626 626
627static void system_restore(void) 627static void system_restore(void)
@@ -635,7 +635,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
635 (void)callback; 635 (void)callback;
636 (void)parameter; 636 (void)parameter;
637 bookmark_autobookmark(); 637 bookmark_autobookmark();
638 call_ata_idle_notifys(true); 638 call_storage_idle_notifys(true);
639 exit(0); 639 exit(0);
640#else 640#else
641 long msg_id = -1; 641 long msg_id = -1;
diff --git a/apps/mpeg.c b/apps/mpeg.c
index 3c37a6b22f..f6d48bf42c 100644
--- a/apps/mpeg.c
+++ b/apps/mpeg.c
@@ -29,7 +29,7 @@
29#include "metadata.h" 29#include "metadata.h"
30#include "mpeg.h" 30#include "mpeg.h"
31#include "audio.h" 31#include "audio.h"
32#include "ata.h" 32#include "storage.h"
33#include "string.h" 33#include "string.h"
34#include <kernel.h> 34#include <kernel.h>
35#include "thread.h" 35#include "thread.h"
@@ -509,7 +509,7 @@ static void generate_postbuffer_events(void)
509static void recalculate_watermark(int bitrate) 509static void recalculate_watermark(int bitrate)
510{ 510{
511 int bytes_per_sec; 511 int bytes_per_sec;
512 int time = ata_spinup_time; 512 int time = storage_spinup_time();
513 513
514 /* A bitrate of 0 probably means empty VBR header. We play safe 514 /* A bitrate of 0 probably means empty VBR header. We play safe
515 and set a high threshold */ 515 and set a high threshold */
@@ -1589,7 +1589,7 @@ static void mpeg_thread(void)
1589 DEBUGF("0\n"); 1589 DEBUGF("0\n");
1590 filling = false; 1590 filling = false;
1591 generate_postbuffer_events(); 1591 generate_postbuffer_events();
1592 ata_sleep(); 1592 storage_sleep();
1593 break; 1593 break;
1594 } 1594 }
1595 1595
@@ -1947,7 +1947,7 @@ static void mpeg_thread(void)
1947 rc = fsync(mpeg_file); 1947 rc = fsync(mpeg_file);
1948 if (rc < 0) 1948 if (rc < 0)
1949 panicf("rec fls: %d", rc); 1949 panicf("rec fls: %d", rc);
1950 ata_sleep(); 1950 storage_sleep();
1951 break; 1951 break;
1952 1952
1953 case NEW_FILE: 1953 case NEW_FILE:
@@ -1957,7 +1957,7 @@ static void mpeg_thread(void)
1957 panicf("rec cls: %d", rc); 1957 panicf("rec cls: %d", rc);
1958 mpeg_file = -1; 1958 mpeg_file = -1;
1959 update_header(); 1959 update_header();
1960 ata_sleep(); 1960 storage_sleep();
1961 1961
1962 /* copy new filename */ 1962 /* copy new filename */
1963 strcpy(delayed_filename, recording_filename); 1963 strcpy(delayed_filename, recording_filename);
diff --git a/apps/playback.c b/apps/playback.c
index b2305949ac..ec4f4197a4 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -49,7 +49,7 @@
49#include "mp3_playback.h" 49#include "mp3_playback.h"
50#include "usb.h" 50#include "usb.h"
51#include "status.h" 51#include "status.h"
52#include "ata.h" 52#include "storage.h"
53#include "screens.h" 53#include "screens.h"
54#include "playlist.h" 54#include "playlist.h"
55#include "playback.h" 55#include "playback.h"
diff --git a/apps/playlist.c b/apps/playlist.c
index cdcc0594c2..95e1b8262c 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1266,7 +1266,7 @@ static void playlist_thread(void)
1266 if (playlist->control_fd >= 0) 1266 if (playlist->control_fd >= 0)
1267 { 1267 {
1268 if (playlist->num_cached > 0) 1268 if (playlist->num_cached > 0)
1269 register_ata_idle_func(playlist_flush_callback); 1269 register_storage_idle_func(playlist_flush_callback);
1270 } 1270 }
1271 1271
1272 if (!dirty_pointers) 1272 if (!dirty_pointers)
diff --git a/apps/plugin.c b/apps/plugin.c
index 86e5c51128..e46e193129 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -38,6 +38,7 @@
38#include "option_select.h" 38#include "option_select.h"
39#include "talk.h" 39#include "talk.h"
40#include "version.h" 40#include "version.h"
41#include "storage.h"
41 42
42#if CONFIG_CHARGING 43#if CONFIG_CHARGING
43#include "power.h" 44#include "power.h"
@@ -265,13 +266,13 @@ static const struct plugin_api rockbox_api = {
265 fdprintf, 266 fdprintf,
266 read_line, 267 read_line,
267 settings_parseline, 268 settings_parseline,
268 ata_sleep, 269 storage_sleep,
269 ata_spin, 270 storage_spin,
270 ata_spindown, 271 storage_spindown,
271#if USING_ATA_CALLBACK 272#if USING_STORAGE_CALLBACK
272 register_ata_idle_func, 273 register_storage_idle_func,
273 unregister_ata_idle_func, 274 unregister_storage_idle_func,
274#endif /* USING_ATA_CALLBACK */ 275#endif /* USING_STORAGE_CALLBACK */
275 reload_directory, 276 reload_directory,
276 create_numbered_filename, 277 create_numbered_filename,
277 file_exists, 278 file_exists,
diff --git a/apps/plugin.h b/apps/plugin.h
index 08d0b603ac..464614dcf9 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -379,13 +379,13 @@ struct plugin_api {
379 int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); 379 int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
380 int (*read_line)(int fd, char* buffer, int buffer_size); 380 int (*read_line)(int fd, char* buffer, int buffer_size);
381 bool (*settings_parseline)(char* line, char** name, char** value); 381 bool (*settings_parseline)(char* line, char** name, char** value);
382 void (*ata_sleep)(void); 382 void (*storage_sleep)(void);
383 void (*ata_spin)(void); 383 void (*storage_spin)(void);
384 void (*ata_spindown)(int seconds); 384 void (*storage_spindown)(int seconds);
385#if USING_ATA_CALLBACK 385#if USING_STORAGE_CALLBACK
386 void (*register_ata_idle_func)(ata_idle_notify function); 386 void (*register_storage_idle_func)(storage_idle_notify function);
387 void (*unregister_ata_idle_func)(ata_idle_notify function, bool run); 387 void (*unregister_storage_idle_func)(storage_idle_notify function, bool run);
388#endif /* USING_ATA_CALLBACK */ 388#endif /* USING_STORAGE_CALLBACK */
389 void (*reload_directory)(void); 389 void (*reload_directory)(void);
390 char *(*create_numbered_filename)(char *buffer, const char *path, 390 char *(*create_numbered_filename)(char *buffer, const char *path,
391 const char *prefix, const char *suffix, 391 const char *prefix, const char *suffix,
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index ef4795a0e1..fff93b2a3a 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -344,7 +344,7 @@ void thread(void)
344 bat[buf_idx].flags = charge_state(); 344 bat[buf_idx].flags = charge_state();
345#endif 345#endif
346 buf_idx++; 346 buf_idx++;
347 rb->register_ata_idle_func(flush_buffer); 347 rb->register_storage_idle_func(flush_buffer);
348 } 348 }
349 349
350 /* What to do when the measurement buffer is full: 350 /* What to do when the measurement buffer is full:
@@ -386,7 +386,7 @@ void thread(void)
386 } 386 }
387 387
388 /* unregister flush callback and flush to disk */ 388 /* unregister flush callback and flush to disk */
389 rb->unregister_ata_idle_func(flush_buffer, true); 389 rb->unregister_storage_idle_func(flush_buffer, true);
390 390
391 /* log end of bench and exit reason */ 391 /* log end of bench and exit reason */
392 fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND); 392 fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND);
diff --git a/apps/plugins/clock/clock_settings.c b/apps/plugins/clock/clock_settings.c
index 44a6f164a7..1147055ce5 100644
--- a/apps/plugins/clock/clock_settings.c
+++ b/apps/plugins/clock/clock_settings.c
@@ -173,7 +173,7 @@ void load_settings(void){
173 draw_message(display, MESSAGE_ERRLOAD, 1); 173 draw_message(display, MESSAGE_ERRLOAD, 1);
174 display->update(); 174 display->update();
175 } 175 }
176 rb->ata_sleep(); 176 rb->storage_sleep();
177 rb->sleep(HZ); 177 rb->sleep(HZ);
178} 178}
179 179
diff --git a/apps/plugins/jpeg/jpeg.c b/apps/plugins/jpeg/jpeg.c
index ed1b181e92..d8775dd176 100644
--- a/apps/plugins/jpeg/jpeg.c
+++ b/apps/plugins/jpeg/jpeg.c
@@ -438,14 +438,14 @@ int show_menu(void) /* return 1 to quit */
438#if !defined(SIMULATOR) && defined(HAVE_DISK_STORAGE) 438#if !defined(SIMULATOR) && defined(HAVE_DISK_STORAGE)
439 /* change ata spindown time based on slideshow time setting */ 439 /* change ata spindown time based on slideshow time setting */
440 immediate_ata_off = false; 440 immediate_ata_off = false;
441 rb->ata_spindown(rb->global_settings->disk_spindown); 441 rb->storage_spindown(rb->global_settings->disk_spindown);
442 442
443 if (slideshow_enabled) 443 if (slideshow_enabled)
444 { 444 {
445 if(jpeg_settings.ss_timeout < 10) 445 if(jpeg_settings.ss_timeout < 10)
446 { 446 {
447 /* slideshow times < 10s keep disk spinning */ 447 /* slideshow times < 10s keep disk spinning */
448 rb->ata_spindown(0); 448 rb->storage_spindown(0);
449 } 449 }
450 else if (!rb->mp3_is_playing()) 450 else if (!rb->mp3_is_playing())
451 { 451 {
@@ -1057,7 +1057,7 @@ int load_and_show(char* filename)
1057 else if(immediate_ata_off) 1057 else if(immediate_ata_off)
1058 { 1058 {
1059 /* running slideshow and time is long enough: power down disk */ 1059 /* running slideshow and time is long enough: power down disk */
1060 rb->ata_sleep(); 1060 rb->storage_sleep();
1061 } 1061 }
1062#endif 1062#endif
1063 1063
@@ -1259,7 +1259,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
1259 1259
1260#if !defined(SIMULATOR) && defined(HAVE_DISK_STORAGE) 1260#if !defined(SIMULATOR) && defined(HAVE_DISK_STORAGE)
1261 /* set back ata spindown time in case we changed it */ 1261 /* set back ata spindown time in case we changed it */
1262 rb->ata_spindown(rb->global_settings->disk_spindown); 1262 rb->storage_spindown(rb->global_settings->disk_spindown);
1263#endif 1263#endif
1264 1264
1265 /* Turn on backlight timeout (revert to settings) */ 1265 /* Turn on backlight timeout (revert to settings) */
diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c
index 7ba4025f1e..df5e005b50 100644
--- a/apps/plugins/mpegplayer/disk_buf.c
+++ b/apps/plugins/mpegplayer/disk_buf.c
@@ -171,7 +171,7 @@ static inline void disk_buf_buffer(void)
171 if (!stream_get_window(&sw)) 171 if (!stream_get_window(&sw))
172 { 172 {
173 disk_buf.state = TSTATE_DATA; 173 disk_buf.state = TSTATE_DATA;
174 rb->ata_sleep(); 174 rb->storage_sleep();
175 break; 175 break;
176 } 176 }
177 177
@@ -186,7 +186,7 @@ static inline void disk_buf_buffer(void)
186 /* Free space is less than one page */ 186 /* Free space is less than one page */
187 disk_buf.state = TSTATE_DATA; 187 disk_buf.state = TSTATE_DATA;
188 disk_buf.low_wm = DISK_BUF_LOW_WATERMARK; 188 disk_buf.low_wm = DISK_BUF_LOW_WATERMARK;
189 rb->ata_sleep(); 189 rb->storage_sleep();
190 break; 190 break;
191 } 191 }
192 192
@@ -208,7 +208,7 @@ static inline void disk_buf_buffer(void)
208 { 208 {
209 /* Error or end of stream */ 209 /* Error or end of stream */
210 disk_buf.state = TSTATE_EOS; 210 disk_buf.state = TSTATE_EOS;
211 rb->ata_sleep(); 211 rb->storage_sleep();
212 break; 212 break;
213 } 213 }
214 214
diff --git a/apps/plugins/mpegplayer/stream_mgr.h b/apps/plugins/mpegplayer/stream_mgr.h
index c94fa84089..e3ea9207e6 100644
--- a/apps/plugins/mpegplayer/stream_mgr.h
+++ b/apps/plugins/mpegplayer/stream_mgr.h
@@ -153,7 +153,7 @@ static inline bool stream_can_seek(void)
153static inline void stream_keep_disk_active(void) 153static inline void stream_keep_disk_active(void)
154{ 154{
155#ifdef HAVE_DISK_STORAGE 155#ifdef HAVE_DISK_STORAGE
156 rb->ata_spin(); 156 rb->storage_spin();
157#endif 157#endif
158 } 158 }
159 159
diff --git a/apps/plugins/video.c b/apps/plugins/video.c
index 6a380b8e3c..1ba2b89e37 100644
--- a/apps/plugins/video.c
+++ b/apps/plugins/video.c
@@ -661,7 +661,7 @@ int PlayTick(int fd)
661#endif 661#endif
662 ) 662 )
663 { 663 {
664 rb->ata_sleep(); /* no point in leaving the disk run til timeout */ 664 rb->storage_sleep(); /* no point in leaving the disk run til timeout */
665 gPlay.bDiskSleep = true; 665 gPlay.bDiskSleep = true;
666 } 666 }
667 667
diff --git a/apps/plugins/wavplay.c b/apps/plugins/wavplay.c
index c37b656d1c..dc0992abac 100644
--- a/apps/plugins/wavplay.c
+++ b/apps/plugins/wavplay.c
@@ -3598,7 +3598,7 @@ int play_file(char* filename)
3598 if (free_space <= 0) 3598 if (free_space <= 0)
3599 { 3599 {
3600 filling = false; 3600 filling = false;
3601 rb->ata_sleep(); 3601 rb->storage_sleep();
3602 } 3602 }
3603 else 3603 else
3604 { 3604 {
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c
index da4e9b7255..dbbc6901ec 100644
--- a/apps/recorder/pcm_record.c
+++ b/apps/recorder/pcm_record.c
@@ -24,7 +24,7 @@
24#include "logf.h" 24#include "logf.h"
25#include "thread.h" 25#include "thread.h"
26#include <string.h> 26#include <string.h>
27#include "ata.h" 27#include "storage.h"
28#include "usb.h" 28#include "usb.h"
29#include "buffer.h" 29#include "buffer.h"
30#include "general.h" 30#include "general.h"
@@ -162,7 +162,7 @@ static bool pcm_buffer_empty; /* all pcm chunks processed? */
162static int low_watermark; /* Low watermark to stop flush */ 162static int low_watermark; /* Low watermark to stop flush */
163static int high_watermark; /* max chunk limit for data flush */ 163static int high_watermark; /* max chunk limit for data flush */
164static unsigned long spinup_time = 35*HZ/10; /* Fudged spinup time */ 164static unsigned long spinup_time = 35*HZ/10; /* Fudged spinup time */
165static int last_ata_spinup_time = -1;/* previous spin time used */ 165static int last_storage_spinup_time = -1;/* previous spin time used */
166#ifdef HAVE_PRIORITY_SCHEDULING 166#ifdef HAVE_PRIORITY_SCHEDULING
167static int flood_watermark; /* boost thread priority when here */ 167static int flood_watermark; /* boost thread priority when here */
168#endif 168#endif
@@ -731,7 +731,7 @@ static void pcmrec_end_file(void)
731 */ 731 */
732static void pcmrec_refresh_watermarks(void) 732static void pcmrec_refresh_watermarks(void)
733{ 733{
734 logf("ata spinup: %d", ata_spinup_time); 734 logf("ata spinup: %d", storage_spinup_time());
735 735
736 /* set the low mark for when flushing stops if automatic */ 736 /* set the low mark for when flushing stops if automatic */
737 low_watermark = (LOW_SECONDS*4*sample_rate + (enc_chunk_size-1)) 737 low_watermark = (LOW_SECONDS*4*sample_rate + (enc_chunk_size-1))
@@ -755,7 +755,7 @@ static void pcmrec_refresh_watermarks(void)
755 755
756 logf("flood at: %d", flood_watermark); 756 logf("flood at: %d", flood_watermark);
757#endif 757#endif
758 spinup_time = last_ata_spinup_time = ata_spinup_time; 758 spinup_time = last_storage_spinup_time = storage_spinup_time();
759 759
760 /* write at 8s + st remaining in enc_buffer - range 12s to 760 /* write at 8s + st remaining in enc_buffer - range 12s to
761 20s total - default to 3.5s spinup. */ 761 20s total - default to 3.5s spinup. */
@@ -816,7 +816,7 @@ static void pcmrec_flush(unsigned flush_num)
816 if (!is_recording) 816 if (!is_recording)
817 return; 817 return;
818 818
819 if (ata_spinup_time != last_ata_spinup_time) 819 if (storage_spinup_time() != last_storage_spinup_time)
820 pcmrec_refresh_watermarks(); 820 pcmrec_refresh_watermarks();
821 821
822 /* enough available? no? then leave */ 822 /* enough available? no? then leave */
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index ce0974a084..422b138020 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -26,7 +26,7 @@
26#include "thread.h" 26#include "thread.h"
27#include "kernel.h" 27#include "kernel.h"
28#include "settings.h" 28#include "settings.h"
29#include "ata.h" 29#include "storage.h"
30#include "lcd.h" 30#include "lcd.h"
31#include "scrollbar.h" 31#include "scrollbar.h"
32#include "gwps.h" 32#include "gwps.h"
@@ -1343,7 +1343,7 @@ int peak_meter_draw_get_btn(int action_context, int x[], int y[],
1343 * is active, it must not draw too much CPU power or a buffer overrun can 1343 * is active, it must not draw too much CPU power or a buffer overrun can
1344 * happen when saving a recording. As a compromise, poll only once per tick 1344 * happen when saving a recording. As a compromise, poll only once per tick
1345 * when the disk is active, otherwise spin around as fast as possible. */ 1345 * when the disk is active, otherwise spin around as fast as possible. */
1346 bool highperf = !ata_disk_is_active(); 1346 bool highperf = !storage_disk_is_active();
1347#endif 1347#endif
1348 bool dopeek = true; 1348 bool dopeek = true;
1349 1349
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index d29db390c7..5a2aa096db 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -65,7 +65,7 @@
65#include "errno.h" 65#include "errno.h"
66#include "talk.h" 66#include "talk.h"
67#include "sound.h" 67#include "sound.h"
68#include "ata.h" 68#include "storage.h"
69#include "splash.h" 69#include "splash.h"
70#include "screen_access.h" 70#include "screen_access.h"
71#include "action.h" 71#include "action.h"
@@ -298,7 +298,7 @@ static bool read_peak_levels(int *peak_l, int *peak_r, int *balance)
298 peak_valid_mem[peak_time % 3] = *peak_l; 298 peak_valid_mem[peak_time % 3] = *peak_l;
299 if (((peak_valid_mem[0] == peak_valid_mem[1]) && 299 if (((peak_valid_mem[0] == peak_valid_mem[1]) &&
300 (peak_valid_mem[1] == peak_valid_mem[2])) && 300 (peak_valid_mem[1] == peak_valid_mem[2])) &&
301 ((*peak_l < 32767) || ata_disk_is_active())) 301 ((*peak_l < 32767) || storage_disk_is_active()))
302 return false; 302 return false;
303 303
304 if (*peak_r > *peak_l) 304 if (*peak_r > *peak_l)
@@ -1034,7 +1034,7 @@ bool recording_screen(bool no_source)
1034 rec_status = RCSTAT_IN_RECSCREEN; 1034 rec_status = RCSTAT_IN_RECSCREEN;
1035 1035
1036#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) 1036#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
1037 ata_set_led_enabled(false); 1037 storage_set_led_enabled(false);
1038#endif 1038#endif
1039 1039
1040#if CONFIG_CODEC == SWCODEC 1040#if CONFIG_CODEC == SWCODEC
@@ -1905,7 +1905,7 @@ rec_abort:
1905 reload_directory(); 1905 reload_directory();
1906 1906
1907#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) 1907#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
1908 ata_set_led_enabled(true); 1908 storage_set_led_enabled(true);
1909#endif 1909#endif
1910 1910
1911#if CONFIG_TUNER 1911#if CONFIG_TUNER
diff --git a/apps/scrobbler.c b/apps/scrobbler.c
index acf1e9e4b0..b0f65158e8 100644
--- a/apps/scrobbler.c
+++ b/apps/scrobbler.c
@@ -180,7 +180,7 @@ static void add_to_cache(unsigned long play_length)
180 logf("SCROBBLER: %s", scrobbler_entry.path); 180 logf("SCROBBLER: %s", scrobbler_entry.path);
181 } else { 181 } else {
182 cache_pos++; 182 cache_pos++;
183 register_ata_idle_func(scrobbler_flush_callback); 183 register_storage_idle_func(scrobbler_flush_callback);
184 } 184 }
185 185
186} 186}
diff --git a/apps/settings.c b/apps/settings.c
index 709e05e086..e15bfc8638 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -38,6 +38,7 @@
38#include "rtc.h" 38#include "rtc.h"
39#include "power.h" 39#include "power.h"
40#include "ata_idle_notify.h" 40#include "ata_idle_notify.h"
41#include "storage.h"
41#include "screens.h" 42#include "screens.h"
42#include "ctype.h" 43#include "ctype.h"
43#include "file.h" 44#include "file.h"
@@ -582,11 +583,11 @@ void status_save(void)
582{ 583{
583 update_runtime(); 584 update_runtime();
584#ifdef HAVE_RTC_RAM 585#ifdef HAVE_RTC_RAM
585 /* this will be done in the ata_callback if 586 /* this will be done in the storage_callback if
586 target doesnt have rtc ram */ 587 target doesnt have rtc ram */
587 write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); 588 write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
588#else 589#else
589 register_ata_idle_func(flush_global_status_callback); 590 register_storage_idle_func(flush_global_status_callback);
590#endif 591#endif
591} 592}
592 593
@@ -594,11 +595,11 @@ int settings_save(void)
594{ 595{
595 update_runtime(); 596 update_runtime();
596#ifdef HAVE_RTC_RAM 597#ifdef HAVE_RTC_RAM
597 /* this will be done in the ata_callback if 598 /* this will be done in the storage_callback if
598 target doesnt have rtc ram */ 599 target doesnt have rtc ram */
599 write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); 600 write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
600#endif 601#endif
601 register_ata_idle_func(flush_config_block_callback); 602 register_storage_idle_func(flush_config_block_callback);
602 return 0; 603 return 0;
603} 604}
604 605
@@ -768,7 +769,7 @@ void settings_apply(bool read_disk)
768 buttonlight_set_timeout(global_settings.buttonlight_timeout); 769 buttonlight_set_timeout(global_settings.buttonlight_timeout);
769#endif 770#endif
770#ifdef HAVE_DISK_STORAGE 771#ifdef HAVE_DISK_STORAGE
771 ata_spindown(global_settings.disk_spindown); 772 storage_spindown(global_settings.disk_spindown);
772#endif 773#endif
773#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR) 774#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
774 dac_line_in(global_settings.line_in); 775 dac_line_in(global_settings.line_in);
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 7f870b442e..3eeeffd8fd 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -23,7 +23,7 @@
23#include <stdbool.h> 23#include <stdbool.h>
24#include <string.h> 24#include <string.h>
25#include "system.h" 25#include "system.h"
26#include "ata.h" 26#include "storage.h"
27#include "lang.h" 27#include "lang.h"
28#include "talk.h" 28#include "talk.h"
29#include "lcd.h" 29#include "lcd.h"
@@ -714,7 +714,7 @@ const struct settings_list settings[] = {
714 /* disk */ 714 /* disk */
715#ifdef HAVE_DISK_STORAGE 715#ifdef HAVE_DISK_STORAGE
716 INT_SETTING(0, disk_spindown, LANG_SPINDOWN, 5, "disk spindown", 716 INT_SETTING(0, disk_spindown, LANG_SPINDOWN, 5, "disk spindown",
717 UNIT_SEC, 3, 254, 1, NULL, NULL, ata_spindown), 717 UNIT_SEC, 3, 254, 1, NULL, NULL, storage_spindown),
718#endif /* HAVE_DISK_STORAGE */ 718#endif /* HAVE_DISK_STORAGE */
719 /* browser */ 719 /* browser */
720 CHOICE_SETTING(0, dirfilter, LANG_FILTER, SHOW_SUPPORTED, "show files", 720 CHOICE_SETTING(0, dirfilter, LANG_FILTER, SHOW_SUPPORTED, "show files",
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 19469cde1a..b6cfcd5ef5 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -3094,7 +3094,7 @@ static void run_command_queue(bool force)
3094 if (force || command_queue_is_full()) 3094 if (force || command_queue_is_full())
3095 command_queue_sync_callback(); 3095 command_queue_sync_callback();
3096 else 3096 else
3097 register_ata_idle_func(command_queue_sync_callback); 3097 register_storage_idle_func(command_queue_sync_callback);
3098} 3098}
3099 3099
3100static void queue_command(int cmd, long idx_id, int tag, long data) 3100static void queue_command(int cmd, long idx_id, int tag, long data)
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 7b05391640..7777a9f16d 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -48,6 +48,7 @@
48#include "filetypes.h" 48#include "filetypes.h"
49#include "audio.h" 49#include "audio.h"
50#include "appevents.h" 50#include "appevents.h"
51#include "storage.h"
51 52
52#define FILE_SEARCH_INSTRUCTIONS ROCKBOX_DIR "/tagnavi.config" 53#define FILE_SEARCH_INSTRUCTIONS ROCKBOX_DIR "/tagnavi.config"
53 54
@@ -1057,7 +1058,7 @@ static int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs,
1057 otherwise show it after the normal 1/2 second delay */ 1058 otherwise show it after the normal 1/2 second delay */
1058 show_search_progress( 1059 show_search_progress(
1059#ifdef HAVE_DISK_STORAGE 1060#ifdef HAVE_DISK_STORAGE
1060 ata_disk_is_active() 1061 storage_disk_is_active()
1061#else 1062#else
1062 true 1063 true
1063#endif 1064#endif
diff --git a/apps/tree.c b/apps/tree.c
index 768223ec4d..dbc47e31b6 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -41,7 +41,7 @@
41#include "settings.h" 41#include "settings.h"
42#include "status.h" 42#include "status.h"
43#include "debug.h" 43#include "debug.h"
44#include "ata.h" 44#include "storage.h"
45#include "rolo.h" 45#include "rolo.h"
46#include "icons.h" 46#include "icons.h"
47#include "lang.h" 47#include "lang.h"
@@ -828,7 +828,7 @@ static int dirbrowse()
828 return GO_TO_WPS; 828 return GO_TO_WPS;
829 if (button) 829 if (button)
830 { 830 {
831 ata_spin(); 831 storage_spin();
832 } 832 }
833 833
834 834