diff options
-rw-r--r-- | apps/plugin.c | 2 | ||||
-rw-r--r-- | apps/plugin.h | 6 | ||||
-rw-r--r-- | apps/plugins/clock/clock_settings.c | 2 | ||||
-rw-r--r-- | apps/plugins/jpeg/jpeg.c | 2 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/disk_buf.c | 6 | ||||
-rw-r--r-- | apps/plugins/video.c | 2 | ||||
-rw-r--r-- | apps/plugins/wavplay.c | 2 | ||||
-rw-r--r-- | firmware/drivers/sd.c | 13 | ||||
-rw-r--r-- | firmware/export/mmc.h | 3 | ||||
-rw-r--r-- | firmware/export/nand.h | 3 | ||||
-rw-r--r-- | firmware/export/sd.h | 3 | ||||
-rw-r--r-- | firmware/export/storage.h | 18 | ||||
-rw-r--r-- | firmware/target/arm/ata-nand-telechips.c | 13 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/ata-nand-s5l8700.c | 23 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c | 28 |
15 files changed, 97 insertions, 29 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 4b7eb28b3d..84200bbf05 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -284,11 +284,9 @@ static const struct plugin_api rockbox_api = { | |||
284 | fdprintf, | 284 | fdprintf, |
285 | read_line, | 285 | read_line, |
286 | settings_parseline, | 286 | settings_parseline, |
287 | #ifdef HAVE_DISK_STORAGE | ||
288 | storage_sleep, | 287 | storage_sleep, |
289 | storage_spin, | 288 | storage_spin, |
290 | storage_spindown, | 289 | storage_spindown, |
291 | #endif | ||
292 | #if USING_STORAGE_CALLBACK | 290 | #if USING_STORAGE_CALLBACK |
293 | register_storage_idle_func, | 291 | register_storage_idle_func, |
294 | unregister_storage_idle_func, | 292 | unregister_storage_idle_func, |
diff --git a/apps/plugin.h b/apps/plugin.h index ebb2518c78..a946f42a14 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -129,12 +129,12 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
129 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 129 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
130 | 130 | ||
131 | /* increase this every time the api struct changes */ | 131 | /* increase this every time the api struct changes */ |
132 | #define PLUGIN_API_VERSION 163 | 132 | #define PLUGIN_API_VERSION 164 |
133 | 133 | ||
134 | /* update this to latest version if a change to the api struct breaks | 134 | /* update this to latest version if a change to the api struct breaks |
135 | backwards compatibility (and please take the opportunity to sort in any | 135 | backwards compatibility (and please take the opportunity to sort in any |
136 | new function which are "waiting" at the end of the function table) */ | 136 | new function which are "waiting" at the end of the function table) */ |
137 | #define PLUGIN_MIN_API_VERSION 163 | 137 | #define PLUGIN_MIN_API_VERSION 164 |
138 | 138 | ||
139 | /* plugin return codes */ | 139 | /* plugin return codes */ |
140 | enum plugin_status { | 140 | enum plugin_status { |
@@ -395,11 +395,9 @@ struct plugin_api { | |||
395 | int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); | 395 | int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); |
396 | int (*read_line)(int fd, char* buffer, int buffer_size); | 396 | int (*read_line)(int fd, char* buffer, int buffer_size); |
397 | bool (*settings_parseline)(char* line, char** name, char** value); | 397 | bool (*settings_parseline)(char* line, char** name, char** value); |
398 | #ifdef HAVE_DISK_STORAGE | ||
399 | void (*storage_sleep)(void); | 398 | void (*storage_sleep)(void); |
400 | void (*storage_spin)(void); | 399 | void (*storage_spin)(void); |
401 | void (*storage_spindown)(int seconds); | 400 | void (*storage_spindown)(int seconds); |
402 | #endif | ||
403 | #if USING_STORAGE_CALLBACK | 401 | #if USING_STORAGE_CALLBACK |
404 | void (*register_storage_idle_func)(storage_idle_notify function); | 402 | void (*register_storage_idle_func)(storage_idle_notify function); |
405 | void (*unregister_storage_idle_func)(storage_idle_notify function, bool run); | 403 | void (*unregister_storage_idle_func)(storage_idle_notify function, bool run); |
diff --git a/apps/plugins/clock/clock_settings.c b/apps/plugins/clock/clock_settings.c index ef3114a943..d765cbb0da 100644 --- a/apps/plugins/clock/clock_settings.c +++ b/apps/plugins/clock/clock_settings.c | |||
@@ -173,9 +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 | #ifdef HAVE_DISK_STORAGE | ||
177 | rb->storage_sleep(); | 176 | rb->storage_sleep(); |
178 | #endif | ||
179 | rb->sleep(HZ); | 177 | rb->sleep(HZ); |
180 | } | 178 | } |
181 | 179 | ||
diff --git a/apps/plugins/jpeg/jpeg.c b/apps/plugins/jpeg/jpeg.c index 685122bb1a..fc98834a7d 100644 --- a/apps/plugins/jpeg/jpeg.c +++ b/apps/plugins/jpeg/jpeg.c | |||
@@ -1038,9 +1038,7 @@ int load_and_show(char* filename) | |||
1038 | else if(immediate_ata_off) | 1038 | else if(immediate_ata_off) |
1039 | { | 1039 | { |
1040 | /* running slideshow and time is long enough: power down disk */ | 1040 | /* running slideshow and time is long enough: power down disk */ |
1041 | #ifdef HAVE_DISK_STORAGE | ||
1042 | rb->storage_sleep(); | 1041 | rb->storage_sleep(); |
1043 | #endif | ||
1044 | } | 1042 | } |
1045 | #endif | 1043 | #endif |
1046 | 1044 | ||
diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c index 4328606a1e..defd8ef81d 100644 --- a/apps/plugins/mpegplayer/disk_buf.c +++ b/apps/plugins/mpegplayer/disk_buf.c | |||
@@ -172,9 +172,7 @@ static inline void disk_buf_buffer(void) | |||
172 | if (!stream_get_window(&sw)) | 172 | if (!stream_get_window(&sw)) |
173 | { | 173 | { |
174 | disk_buf.state = TSTATE_DATA; | 174 | disk_buf.state = TSTATE_DATA; |
175 | #ifdef HAVE_DISK_STORAGE | ||
176 | rb->storage_sleep(); | 175 | rb->storage_sleep(); |
177 | #endif | ||
178 | break; | 176 | break; |
179 | } | 177 | } |
180 | 178 | ||
@@ -189,9 +187,7 @@ static inline void disk_buf_buffer(void) | |||
189 | /* Free space is less than one page */ | 187 | /* Free space is less than one page */ |
190 | disk_buf.state = TSTATE_DATA; | 188 | disk_buf.state = TSTATE_DATA; |
191 | disk_buf.low_wm = DISK_BUF_LOW_WATERMARK; | 189 | disk_buf.low_wm = DISK_BUF_LOW_WATERMARK; |
192 | #ifdef HAVE_DISK_STORAGE | ||
193 | rb->storage_sleep(); | 190 | rb->storage_sleep(); |
194 | #endif | ||
195 | break; | 191 | break; |
196 | } | 192 | } |
197 | 193 | ||
@@ -213,9 +209,7 @@ static inline void disk_buf_buffer(void) | |||
213 | { | 209 | { |
214 | /* Error or end of stream */ | 210 | /* Error or end of stream */ |
215 | disk_buf.state = TSTATE_EOS; | 211 | disk_buf.state = TSTATE_EOS; |
216 | #ifdef HAVE_DISK_STORAGE | ||
217 | rb->storage_sleep(); | 212 | rb->storage_sleep(); |
218 | #endif | ||
219 | break; | 213 | break; |
220 | } | 214 | } |
221 | 215 | ||
diff --git a/apps/plugins/video.c b/apps/plugins/video.c index 8ead0a72f3..6b0a47c7c6 100644 --- a/apps/plugins/video.c +++ b/apps/plugins/video.c | |||
@@ -681,9 +681,7 @@ int PlayTick(int fd) | |||
681 | #endif | 681 | #endif |
682 | ) | 682 | ) |
683 | { | 683 | { |
684 | #ifdef HAVE_DISK_STORAGE | ||
685 | rb->storage_sleep(); /* no point in leaving the disk run til timeout */ | 684 | rb->storage_sleep(); /* no point in leaving the disk run til timeout */ |
686 | #endif | ||
687 | gPlay.bDiskSleep = true; | 685 | gPlay.bDiskSleep = true; |
688 | } | 686 | } |
689 | 687 | ||
diff --git a/apps/plugins/wavplay.c b/apps/plugins/wavplay.c index 9cb784b54d..368d8e3475 100644 --- a/apps/plugins/wavplay.c +++ b/apps/plugins/wavplay.c | |||
@@ -3596,9 +3596,7 @@ int play_file(char* filename) | |||
3596 | if (free_space <= 0) | 3596 | if (free_space <= 0) |
3597 | { | 3597 | { |
3598 | filling = false; | 3598 | filling = false; |
3599 | #ifdef HAVE_DISK_STORAGE | ||
3600 | rb->storage_sleep(); | 3599 | rb->storage_sleep(); |
3601 | #endif | ||
3602 | } | 3600 | } |
3603 | else | 3601 | else |
3604 | { | 3602 | { |
diff --git a/firmware/drivers/sd.c b/firmware/drivers/sd.c index fdc05c73b7..4034b9453d 100644 --- a/firmware/drivers/sd.c +++ b/firmware/drivers/sd.c | |||
@@ -66,6 +66,19 @@ void sd_parse_csd(tCardInfo *card) | |||
66 | logf("nsac: %d taac: %d r2w: %d", card->nsac, card->taac, card->r2w_factor); | 66 | logf("nsac: %d taac: %d r2w: %d", card->nsac, card->taac, card->r2w_factor); |
67 | } | 67 | } |
68 | 68 | ||
69 | void sd_sleep(void) | ||
70 | { | ||
71 | } | ||
72 | |||
73 | void sd_spin(void) | ||
74 | { | ||
75 | } | ||
76 | |||
77 | void sd_spindown(int seconds) | ||
78 | { | ||
79 | (void)seconds; | ||
80 | } | ||
81 | |||
69 | #ifdef STORAGE_GET_INFO | 82 | #ifdef STORAGE_GET_INFO |
70 | void sd_get_info(IF_MV2(int drive,) struct storage_info *info) | 83 | void sd_get_info(IF_MV2(int drive,) struct storage_info *info) |
71 | { | 84 | { |
diff --git a/firmware/export/mmc.h b/firmware/export/mmc.h index bd4b7f93ec..06d99d219e 100644 --- a/firmware/export/mmc.h +++ b/firmware/export/mmc.h | |||
@@ -28,6 +28,8 @@ | |||
28 | struct storage_info; | 28 | struct storage_info; |
29 | 29 | ||
30 | void mmc_enable(bool on); | 30 | void mmc_enable(bool on); |
31 | void mmc_spindown(int seconds); | ||
32 | void mmc_sleep(void); | ||
31 | void mmc_sleepnow(void); | 33 | void mmc_sleepnow(void); |
32 | bool mmc_disk_is_active(void); | 34 | bool mmc_disk_is_active(void); |
33 | int mmc_soft_reset(void); | 35 | int mmc_soft_reset(void); |
@@ -35,6 +37,7 @@ int mmc_init(void); | |||
35 | void mmc_close(void); | 37 | void mmc_close(void); |
36 | int mmc_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); | 38 | int mmc_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); |
37 | int mmc_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); | 39 | int mmc_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); |
40 | void mmc_spin(void); | ||
38 | int mmc_spinup_time(void); | 41 | int mmc_spinup_time(void); |
39 | 42 | ||
40 | #ifdef STORAGE_GET_INFO | 43 | #ifdef STORAGE_GET_INFO |
diff --git a/firmware/export/nand.h b/firmware/export/nand.h index 64416b9de5..a5b0a1ceee 100644 --- a/firmware/export/nand.h +++ b/firmware/export/nand.h | |||
@@ -28,12 +28,15 @@ | |||
28 | struct storage_info; | 28 | struct storage_info; |
29 | 29 | ||
30 | void nand_enable(bool on); | 30 | void nand_enable(bool on); |
31 | void nand_spindown(int seconds); | ||
32 | void nand_sleep(void); | ||
31 | bool nand_disk_is_active(void); | 33 | bool nand_disk_is_active(void); |
32 | int nand_soft_reset(void); | 34 | int nand_soft_reset(void); |
33 | int nand_init(void); | 35 | int nand_init(void); |
34 | void nand_close(void); | 36 | void nand_close(void); |
35 | int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); | 37 | int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); |
36 | int nand_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); | 38 | int nand_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); |
39 | void nand_spin(void); | ||
37 | 40 | ||
38 | #ifdef STORAGE_GET_INFO | 41 | #ifdef STORAGE_GET_INFO |
39 | void nand_get_info(IF_MV2(int drive,) struct storage_info *info); | 42 | void nand_get_info(IF_MV2(int drive,) struct storage_info *info); |
diff --git a/firmware/export/sd.h b/firmware/export/sd.h index f100f3025f..d313a4c2e1 100644 --- a/firmware/export/sd.h +++ b/firmware/export/sd.h | |||
@@ -30,12 +30,15 @@ | |||
30 | struct storage_info; | 30 | struct storage_info; |
31 | 31 | ||
32 | void sd_enable(bool on); | 32 | void sd_enable(bool on); |
33 | void sd_spindown(int seconds); | ||
34 | void sd_sleep(void); | ||
33 | bool sd_disk_is_active(void); | 35 | bool sd_disk_is_active(void); |
34 | int sd_soft_reset(void); | 36 | int sd_soft_reset(void); |
35 | int sd_init(void); | 37 | int sd_init(void); |
36 | void sd_close(void); | 38 | void sd_close(void); |
37 | int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); | 39 | int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); |
38 | int sd_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); | 40 | int sd_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); |
41 | void sd_spin(void); | ||
39 | 42 | ||
40 | #ifdef STORAGE_GET_INFO | 43 | #ifdef STORAGE_GET_INFO |
41 | void sd_get_info(IF_MV2(int drive,) struct storage_info *info); | 44 | void sd_get_info(IF_MV2(int drive,) struct storage_info *info); |
diff --git a/firmware/export/storage.h b/firmware/export/storage.h index 73ec970635..47d8abda52 100644 --- a/firmware/export/storage.h +++ b/firmware/export/storage.h | |||
@@ -81,9 +81,9 @@ struct storage_info | |||
81 | #define storage_present(drive) ata_present(IF_MV(drive)) | 81 | #define storage_present(drive) ata_present(IF_MV(drive)) |
82 | #endif | 82 | #endif |
83 | #elif (CONFIG_STORAGE & STORAGE_SD) | 83 | #elif (CONFIG_STORAGE & STORAGE_SD) |
84 | #define storage_spindown(seconds) (void)0 | 84 | #define storage_spindown sd_spindown |
85 | #define storage_sleep() (void)0 | 85 | #define storage_sleep sd_sleep |
86 | #define storage_spin() (void)0 | 86 | #define storage_spin sd_spin |
87 | 87 | ||
88 | #define storage_enable(on) sd_enable(on) | 88 | #define storage_enable(on) sd_enable(on) |
89 | #define storage_sleepnow() sd_sleepnow() | 89 | #define storage_sleepnow() sd_sleepnow() |
@@ -105,9 +105,9 @@ struct storage_info | |||
105 | #define storage_present(drive) sd_present(IF_MV(drive)) | 105 | #define storage_present(drive) sd_present(IF_MV(drive)) |
106 | #endif | 106 | #endif |
107 | #elif (CONFIG_STORAGE & STORAGE_MMC) | 107 | #elif (CONFIG_STORAGE & STORAGE_MMC) |
108 | #define storage_spindown(seconds) (void)0 | 108 | #define storage_spindown mmc_spindown |
109 | #define storage_sleep() (void)0 | 109 | #define storage_sleep mmc_sleep |
110 | #define storage_spin() (void)0 | 110 | #define storage_spin mmc_spin |
111 | 111 | ||
112 | #define storage_enable(on) mmc_enable(on) | 112 | #define storage_enable(on) mmc_enable(on) |
113 | #define storage_sleepnow() mmc_sleepnow() | 113 | #define storage_sleepnow() mmc_sleepnow() |
@@ -129,9 +129,9 @@ struct storage_info | |||
129 | #define storage_present(drive) mmc_present(IF_MV(drive)) | 129 | #define storage_present(drive) mmc_present(IF_MV(drive)) |
130 | #endif | 130 | #endif |
131 | #elif (CONFIG_STORAGE & STORAGE_NAND) | 131 | #elif (CONFIG_STORAGE & STORAGE_NAND) |
132 | #define storage_spindown(seconds) (void)0 | 132 | #define storage_spindown nand_spindown |
133 | #define storage_sleep() (void)0 | 133 | #define storage_sleep nand_sleep |
134 | #define storage_spin() (void)0 | 134 | #define storage_spin nand_spin |
135 | 135 | ||
136 | #define storage_enable(on) (void)0 | 136 | #define storage_enable(on) (void)0 |
137 | #define storage_sleepnow() nand_sleepnow() | 137 | #define storage_sleepnow() nand_sleepnow() |
diff --git a/firmware/target/arm/ata-nand-telechips.c b/firmware/target/arm/ata-nand-telechips.c index 698f2b9d42..8bef57ee21 100644 --- a/firmware/target/arm/ata-nand-telechips.c +++ b/firmware/target/arm/ata-nand-telechips.c | |||
@@ -900,3 +900,16 @@ long nand_last_disk_activity(void) | |||
900 | { | 900 | { |
901 | return last_disk_activity; | 901 | return last_disk_activity; |
902 | } | 902 | } |
903 | |||
904 | void nand_sleep(void) | ||
905 | { | ||
906 | } | ||
907 | |||
908 | void nand_spin(void) | ||
909 | { | ||
910 | } | ||
911 | |||
912 | void nand_spindown(int seconds) | ||
913 | { | ||
914 | (void)seconds; | ||
915 | } | ||
diff --git a/firmware/target/arm/s5l8700/ata-nand-s5l8700.c b/firmware/target/arm/s5l8700/ata-nand-s5l8700.c index 183ef18f40..ee1e581270 100644 --- a/firmware/target/arm/s5l8700/ata-nand-s5l8700.c +++ b/firmware/target/arm/s5l8700/ata-nand-s5l8700.c | |||
@@ -64,6 +64,29 @@ int nand_write_sectors(IF_MV2(int drive,) unsigned long start, int count, | |||
64 | return 0; | 64 | return 0; |
65 | } | 65 | } |
66 | 66 | ||
67 | void nand_spindown(int seconds) | ||
68 | { | ||
69 | (void)seconds; | ||
70 | } | ||
71 | |||
72 | bool nand_disk_is_active(void) | ||
73 | { | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | void nand_sleep(void) | ||
78 | { | ||
79 | } | ||
80 | |||
81 | void nand_spin(void) | ||
82 | { | ||
83 | } | ||
84 | |||
85 | int nand_soft_reset(void) | ||
86 | { | ||
87 | return 0; | ||
88 | } | ||
89 | |||
67 | void nand_enable(bool on) | 90 | void nand_enable(bool on) |
68 | { | 91 | { |
69 | (void)on; | 92 | (void)on; |
diff --git a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c index 28325033b0..d9189280e8 100644 --- a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c | |||
@@ -685,6 +685,34 @@ int nand_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const | |||
685 | return -1; | 685 | return -1; |
686 | } | 686 | } |
687 | 687 | ||
688 | void nand_spindown(int seconds) | ||
689 | { | ||
690 | /* null */ | ||
691 | (void)seconds; | ||
692 | } | ||
693 | |||
694 | bool nand_disk_is_active(void) | ||
695 | { | ||
696 | /* null */ | ||
697 | return false; | ||
698 | } | ||
699 | |||
700 | void nand_sleep(void) | ||
701 | { | ||
702 | /* null */ | ||
703 | } | ||
704 | |||
705 | void nand_spin(void) | ||
706 | { | ||
707 | /* null */ | ||
708 | } | ||
709 | |||
710 | int nand_soft_reset(void) | ||
711 | { | ||
712 | /* null */ | ||
713 | return 0; | ||
714 | } | ||
715 | |||
688 | void nand_enable(bool on) | 716 | void nand_enable(bool on) |
689 | { | 717 | { |
690 | /* null - flash controller is enabled/disabled as needed. */ | 718 | /* null - flash controller is enabled/disabled as needed. */ |