diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2005-08-28 14:16:03 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2005-08-28 14:16:03 +0000 |
commit | 29aad55d978282901e5bd3b95a3d2e71c0ac6c9e (patch) | |
tree | 8ae9962909983243a78de768f808c3005507ee4f /apps | |
parent | d682b73749da208c38ea5f04eab38d3ab3c86bd4 (diff) | |
download | rockbox-29aad55d978282901e5bd3b95a3d2e71c0ac6c9e.tar.gz rockbox-29aad55d978282901e5bd3b95a3d2e71c0ac6c9e.zip |
Fixed iriver cpu boosting problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7410 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/pcmbuf.c | 2 | ||||
-rw-r--r-- | apps/pcmbuf.h | 1 | ||||
-rw-r--r-- | apps/playback.c | 27 |
3 files changed, 24 insertions, 6 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index d0bbeb0265..bf5269a32e 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c | |||
@@ -93,7 +93,7 @@ void (*pcmbuf_watermark_event)(int bytes_left); | |||
93 | static int last_chunksize; | 93 | static int last_chunksize; |
94 | static long mixpos = 0; | 94 | static long mixpos = 0; |
95 | 95 | ||
96 | static void pcmbuf_boost(bool state) | 96 | void pcmbuf_boost(bool state) |
97 | { | 97 | { |
98 | static bool boost_state = false; | 98 | static bool boost_state = false; |
99 | 99 | ||
diff --git a/apps/pcmbuf.h b/apps/pcmbuf.h index f2533defe6..cce7c4ec77 100644 --- a/apps/pcmbuf.h +++ b/apps/pcmbuf.h | |||
@@ -33,6 +33,7 @@ bool pcmbuf_add_chunk(void *addr, int size, void (*callback)(void)); | |||
33 | int pcmbuf_num_used_buffers(void); | 33 | int pcmbuf_num_used_buffers(void); |
34 | void pcmbuf_set_watermark(int numbytes, void (*callback)(int bytes_left)); | 34 | void pcmbuf_set_watermark(int numbytes, void (*callback)(int bytes_left)); |
35 | 35 | ||
36 | void pcmbuf_boost(bool state); | ||
36 | void pcmbuf_set_boost_mode(bool state); | 37 | void pcmbuf_set_boost_mode(bool state); |
37 | bool pcmbuf_is_lowdata(void); | 38 | bool pcmbuf_is_lowdata(void); |
38 | void pcmbuf_flush_audio(void); | 39 | void pcmbuf_flush_audio(void); |
diff --git a/apps/playback.c b/apps/playback.c index 95005815fe..ffd298fbdf 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -131,6 +131,7 @@ static struct mp3entry id3_voice; | |||
131 | static char *voicebuf; | 131 | static char *voicebuf; |
132 | static int voice_remaining; | 132 | static int voice_remaining; |
133 | static bool voice_is_playing; | 133 | static bool voice_is_playing; |
134 | static bool voice_cpu_boosted = false; | ||
134 | static void (*voice_getmore)(unsigned char** start, int* size); | 135 | static void (*voice_getmore)(unsigned char** start, int* size); |
135 | 136 | ||
136 | /* Is file buffer currently being refilled? */ | 137 | /* Is file buffer currently being refilled? */ |
@@ -254,6 +255,17 @@ static void swap_codec(void) | |||
254 | logf("codec resuming:%d", current_codec); | 255 | logf("codec resuming:%d", current_codec); |
255 | } | 256 | } |
256 | 257 | ||
258 | static void voice_boost_cpu(bool state) | ||
259 | { | ||
260 | if (state != voice_cpu_boosted) | ||
261 | { | ||
262 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
263 | cpu_boost(state); | ||
264 | #endif | ||
265 | voice_cpu_boosted = state; | ||
266 | } | ||
267 | } | ||
268 | |||
257 | bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2, | 269 | bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2, |
258 | long length) | 270 | long length) |
259 | { | 271 | { |
@@ -306,9 +318,9 @@ bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2, | |||
306 | if (voice_is_playing && pcmbuf_usage() > 30 | 318 | if (voice_is_playing && pcmbuf_usage() > 30 |
307 | && pcmbuf_mix_usage() < 20) | 319 | && pcmbuf_mix_usage() < 20) |
308 | { | 320 | { |
309 | cpu_boost(true); | 321 | voice_boost_cpu(true); |
310 | swap_codec(); | 322 | swap_codec(); |
311 | cpu_boost(false); | 323 | voice_boost_cpu(false); |
312 | } | 324 | } |
313 | break ; | 325 | break ; |
314 | 326 | ||
@@ -436,8 +448,13 @@ void* voice_request_data(long *realsize, long reqsize) | |||
436 | { | 448 | { |
437 | swap_codec(); | 449 | swap_codec(); |
438 | } | 450 | } |
439 | if (!voice_is_playing) | 451 | else if (!voice_is_playing) |
452 | { | ||
453 | voice_boost_cpu(false); | ||
454 | if (!pcm_is_playing()) | ||
455 | pcmbuf_boost(false); | ||
440 | sleep(HZ/16); | 456 | sleep(HZ/16); |
457 | } | ||
441 | 458 | ||
442 | if (voice_remaining) | 459 | if (voice_remaining) |
443 | { | 460 | { |
@@ -1277,11 +1294,11 @@ void initialize_buffer_fill(void) | |||
1277 | fill_bytesleft = filebuflen - filebufused; | 1294 | fill_bytesleft = filebuflen - filebufused; |
1278 | cur_ti->start_pos = ci.curpos; | 1295 | cur_ti->start_pos = ci.curpos; |
1279 | 1296 | ||
1280 | pcmbuf_set_boost_mode(true); | ||
1281 | |||
1282 | if (filling) | 1297 | if (filling) |
1283 | return ; | 1298 | return ; |
1284 | 1299 | ||
1300 | pcmbuf_set_boost_mode(true); | ||
1301 | |||
1285 | filling = true; | 1302 | filling = true; |
1286 | 1303 | ||
1287 | /* Calculate real track count after throwing away old tracks. */ | 1304 | /* Calculate real track count after throwing away old tracks. */ |