1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2008-04-13 12:24:47 +00:00
parent 4c5a735a02
commit 2bf4178018
6 changed files with 12 additions and 8 deletions

View file

@ -813,11 +813,9 @@ static bool fill_buffer(void)
} }
else else
{ {
#ifndef SIMULATOR
/* only spin the disk down if the filling wasn't interrupted by an /* only spin the disk down if the filling wasn't interrupted by an
event arriving in the queue. */ event arriving in the queue. */
ata_sleep(); ata_sleep();
#endif
return false; return false;
} }
} }

View file

@ -234,8 +234,8 @@ static const struct plugin_api rockbox_api = {
fdprintf, fdprintf,
read_line, read_line,
settings_parseline, settings_parseline,
#ifndef SIMULATOR
ata_sleep, ata_sleep,
#ifndef SIMULATOR
ata_disk_is_active, ata_disk_is_active,
#endif #endif
ata_spin, ata_spin,

View file

@ -120,12 +120,12 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */ #define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */ /* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 107 #define PLUGIN_API_VERSION 108
/* update this to latest version if a change to the api struct breaks /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */ new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 107 #define PLUGIN_MIN_API_VERSION 108
/* plugin return codes */ /* plugin return codes */
enum plugin_status { enum plugin_status {
@ -331,8 +331,8 @@ struct plugin_api {
int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
int (*read_line)(int fd, char* buffer, int buffer_size); int (*read_line)(int fd, char* buffer, int buffer_size);
bool (*settings_parseline)(char* line, char** name, char** value); bool (*settings_parseline)(char* line, char** name, char** value);
#ifndef SIMULATOR
void (*ata_sleep)(void); void (*ata_sleep)(void);
#ifndef SIMULATOR
bool (*ata_disk_is_active)(void); bool (*ata_disk_is_active)(void);
#endif #endif
void (*ata_spin)(void); void (*ata_spin)(void);

View file

@ -171,9 +171,7 @@ void load_settings(void){
draw_message(display, MESSAGE_ERRLOAD, 1); draw_message(display, MESSAGE_ERRLOAD, 1);
display->update(); display->update();
} }
#ifndef SIMULATOR
rb->ata_sleep(); rb->ata_sleep();
#endif
rb->sleep(HZ); rb->sleep(HZ);
} }

View file

@ -169,6 +169,7 @@ static inline void disk_buf_buffer(void)
if (!stream_get_window(&sw)) if (!stream_get_window(&sw))
{ {
disk_buf.state = TSTATE_DATA; disk_buf.state = TSTATE_DATA;
rb->ata_sleep();
break; break;
} }
@ -183,6 +184,7 @@ static inline void disk_buf_buffer(void)
/* Free space is less than one page */ /* Free space is less than one page */
disk_buf.state = TSTATE_DATA; disk_buf.state = TSTATE_DATA;
disk_buf.low_wm = DISK_BUF_LOW_WATERMARK; disk_buf.low_wm = DISK_BUF_LOW_WATERMARK;
rb->ata_sleep();
break; break;
} }
@ -204,6 +206,7 @@ static inline void disk_buf_buffer(void)
{ {
/* Error or end of stream */ /* Error or end of stream */
disk_buf.state = TSTATE_EOS; disk_buf.state = TSTATE_EOS;
rb->ata_sleep();
break; break;
} }

View file

@ -108,6 +108,11 @@ void ata_spin(void)
{ {
} }
void ata_sleep(void)
{
DEBUGF("ata_sleep()\n");
}
void ata_spindown(int s) void ata_spindown(int s)
{ {
(void)s; (void)s;