summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-04-13 12:24:47 +0000
committerJens Arnold <amiconn@rockbox.org>2008-04-13 12:24:47 +0000
commit2bf4178018930b8af6d7082f7dd1a3302e09932b (patch)
tree3f6e2177e31f09157fc782d4239b944a6f6d8963
parent4c5a735a023755cedc264a4cad89f1ab0c256e17 (diff)
downloadrockbox-2bf4178018930b8af6d7082f7dd1a3302e09932b.tar.gz
rockbox-2bf4178018930b8af6d7082f7dd1a3302e09932b.zip
Make mpegplayer sleep the disk after buffering to save battery. * Add a simulator stub for ata_sleep(), and un-ifdef most calls to it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17096 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/buffering.c2
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h6
-rw-r--r--apps/plugins/clock/clock_settings.c2
-rw-r--r--apps/plugins/mpegplayer/disk_buf.c3
-rw-r--r--uisimulator/common/stubs.c5
6 files changed, 12 insertions, 8 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index 99a4a3b058..f123d8fcc3 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -813,11 +813,9 @@ static bool fill_buffer(void)
813 } 813 }
814 else 814 else
815 { 815 {
816#ifndef SIMULATOR
817 /* only spin the disk down if the filling wasn't interrupted by an 816 /* only spin the disk down if the filling wasn't interrupted by an
818 event arriving in the queue. */ 817 event arriving in the queue. */
819 ata_sleep(); 818 ata_sleep();
820#endif
821 return false; 819 return false;
822 } 820 }
823} 821}
diff --git a/apps/plugin.c b/apps/plugin.c
index 7a8e0e04be..a7baa6d314 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -234,8 +234,8 @@ static const struct plugin_api rockbox_api = {
234 fdprintf, 234 fdprintf,
235 read_line, 235 read_line,
236 settings_parseline, 236 settings_parseline,
237#ifndef SIMULATOR
238 ata_sleep, 237 ata_sleep,
238#ifndef SIMULATOR
239 ata_disk_is_active, 239 ata_disk_is_active,
240#endif 240#endif
241 ata_spin, 241 ata_spin,
diff --git a/apps/plugin.h b/apps/plugin.h
index c638688753..2db38eda4c 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -120,12 +120,12 @@
120#define PLUGIN_MAGIC 0x526F634B /* RocK */ 120#define PLUGIN_MAGIC 0x526F634B /* RocK */
121 121
122/* increase this every time the api struct changes */ 122/* increase this every time the api struct changes */
123#define PLUGIN_API_VERSION 107 123#define PLUGIN_API_VERSION 108
124 124
125/* update this to latest version if a change to the api struct breaks 125/* update this to latest version if a change to the api struct breaks
126 backwards compatibility (and please take the opportunity to sort in any 126 backwards compatibility (and please take the opportunity to sort in any
127 new function which are "waiting" at the end of the function table) */ 127 new function which are "waiting" at the end of the function table) */
128#define PLUGIN_MIN_API_VERSION 107 128#define PLUGIN_MIN_API_VERSION 108
129 129
130/* plugin return codes */ 130/* plugin return codes */
131enum plugin_status { 131enum plugin_status {
@@ -331,8 +331,8 @@ struct plugin_api {
331 int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); 331 int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
332 int (*read_line)(int fd, char* buffer, int buffer_size); 332 int (*read_line)(int fd, char* buffer, int buffer_size);
333 bool (*settings_parseline)(char* line, char** name, char** value); 333 bool (*settings_parseline)(char* line, char** name, char** value);
334#ifndef SIMULATOR
335 void (*ata_sleep)(void); 334 void (*ata_sleep)(void);
335#ifndef SIMULATOR
336 bool (*ata_disk_is_active)(void); 336 bool (*ata_disk_is_active)(void);
337#endif 337#endif
338 void (*ata_spin)(void); 338 void (*ata_spin)(void);
diff --git a/apps/plugins/clock/clock_settings.c b/apps/plugins/clock/clock_settings.c
index fddea57c34..233be6565f 100644
--- a/apps/plugins/clock/clock_settings.c
+++ b/apps/plugins/clock/clock_settings.c
@@ -171,9 +171,7 @@ void load_settings(void){
171 draw_message(display, MESSAGE_ERRLOAD, 1); 171 draw_message(display, MESSAGE_ERRLOAD, 1);
172 display->update(); 172 display->update();
173 } 173 }
174#ifndef SIMULATOR
175 rb->ata_sleep(); 174 rb->ata_sleep();
176#endif
177 rb->sleep(HZ); 175 rb->sleep(HZ);
178} 176}
179 177
diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c
index 46a060221d..7ecf51c168 100644
--- a/apps/plugins/mpegplayer/disk_buf.c
+++ b/apps/plugins/mpegplayer/disk_buf.c
@@ -169,6 +169,7 @@ static inline void disk_buf_buffer(void)
169 if (!stream_get_window(&sw)) 169 if (!stream_get_window(&sw))
170 { 170 {
171 disk_buf.state = TSTATE_DATA; 171 disk_buf.state = TSTATE_DATA;
172 rb->ata_sleep();
172 break; 173 break;
173 } 174 }
174 175
@@ -183,6 +184,7 @@ static inline void disk_buf_buffer(void)
183 /* Free space is less than one page */ 184 /* Free space is less than one page */
184 disk_buf.state = TSTATE_DATA; 185 disk_buf.state = TSTATE_DATA;
185 disk_buf.low_wm = DISK_BUF_LOW_WATERMARK; 186 disk_buf.low_wm = DISK_BUF_LOW_WATERMARK;
187 rb->ata_sleep();
186 break; 188 break;
187 } 189 }
188 190
@@ -204,6 +206,7 @@ static inline void disk_buf_buffer(void)
204 { 206 {
205 /* Error or end of stream */ 207 /* Error or end of stream */
206 disk_buf.state = TSTATE_EOS; 208 disk_buf.state = TSTATE_EOS;
209 rb->ata_sleep();
207 break; 210 break;
208 } 211 }
209 212
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index c40d10082c..18e7a242d0 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -108,6 +108,11 @@ void ata_spin(void)
108{ 108{
109} 109}
110 110
111void ata_sleep(void)
112{
113 DEBUGF("ata_sleep()\n");
114}
115
111void ata_spindown(int s) 116void ata_spindown(int s)
112{ 117{
113 (void)s; 118 (void)s;