summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-09-01 07:32:07 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-09-01 07:32:07 +0000
commit6d3a6f71d1f8bce9ab5e7b90ceab6a17271174b8 (patch)
tree3769e0c1036de254182761c48d25d9a079d36295
parent67f52495593ea66660bd3b63c1bb7bfbe7e5cef1 (diff)
downloadrockbox-6d3a6f71d1f8bce9ab5e7b90ceab6a17271174b8.tar.gz
rockbox-6d3a6f71d1f8bce9ab5e7b90ceab6a17271174b8.zip
Remove obsolete init cruft from audio system because of diminished dependencies. All talk/voice dependency in playback.c should be imminently removable.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30401 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codec_thread.c51
-rw-r--r--apps/codec_thread.h4
-rw-r--r--apps/playback.c14
-rw-r--r--apps/voice_thread.c20
-rw-r--r--apps/voice_thread.h1
5 files changed, 26 insertions, 64 deletions
diff --git a/apps/codec_thread.c b/apps/codec_thread.c
index 90cf07be9f..0498858be2 100644
--- a/apps/codec_thread.c
+++ b/apps/codec_thread.c
@@ -411,25 +411,6 @@ static bool codec_loop_track_callback(void)
411 return global_settings.repeat_mode == REPEAT_ONE; 411 return global_settings.repeat_mode == REPEAT_ONE;
412} 412}
413 413
414/* Initialize codec API */
415void codec_init_codec_api(void)
416{
417 ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP,
418 CODEC_IDX_AUDIO);
419 ci.codec_get_buffer = codec_get_buffer_callback;
420 ci.pcmbuf_insert = codec_pcmbuf_insert_callback;
421 ci.set_elapsed = audio_codec_update_elapsed;
422 ci.read_filebuf = codec_filebuf_callback;
423 ci.request_buffer = codec_request_buffer_callback;
424 ci.advance_buffer = codec_advance_buffer_callback;
425 ci.seek_buffer = codec_seek_buffer_callback;
426 ci.seek_complete = codec_seek_complete_callback;
427 ci.set_offset = audio_codec_update_offset;
428 ci.configure = codec_configure_callback;
429 ci.get_command = codec_get_command_callback;
430 ci.loop_track = codec_loop_track_callback;
431}
432
433 414
434/** --- CODEC THREAD --- **/ 415/** --- CODEC THREAD --- **/
435 416
@@ -626,25 +607,35 @@ static void NORETURN_ATTR codec_thread(void)
626 607
627/** --- Miscellaneous external interfaces -- **/ 608/** --- Miscellaneous external interfaces -- **/
628 609
629/* Create the codec thread and init kernel objects */ 610/* Initialize playback's codec interface */
630void make_codec_thread(void) 611void codec_thread_init(void)
631{ 612{
613 /* Init API */
614 ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP,
615 CODEC_IDX_AUDIO);
616 ci.codec_get_buffer = codec_get_buffer_callback;
617 ci.pcmbuf_insert = codec_pcmbuf_insert_callback;
618 ci.set_elapsed = audio_codec_update_elapsed;
619 ci.read_filebuf = codec_filebuf_callback;
620 ci.request_buffer = codec_request_buffer_callback;
621 ci.advance_buffer = codec_advance_buffer_callback;
622 ci.seek_buffer = codec_seek_buffer_callback;
623 ci.seek_complete = codec_seek_complete_callback;
624 ci.set_offset = audio_codec_update_offset;
625 ci.configure = codec_configure_callback;
626 ci.get_command = codec_get_command_callback;
627 ci.loop_track = codec_loop_track_callback;
628
629 /* Init threading */
632 queue_init(&codec_queue, false); 630 queue_init(&codec_queue, false);
633 codec_thread_id = create_thread( 631 codec_thread_id = create_thread(
634 codec_thread, codec_stack, sizeof(codec_stack), 632 codec_thread, codec_stack, sizeof(codec_stack), 0,
635 CREATE_THREAD_FROZEN,
636 codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK) 633 codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK)
637 IF_COP(, CPU)); 634 IF_COP(, CPU));
638 queue_enable_queue_send(&codec_queue, &codec_queue_sender_list, 635 queue_enable_queue_send(&codec_queue, &codec_queue_sender_list,
639 codec_thread_id); 636 codec_thread_id);
640} 637}
641 638
642/* Unfreeze the codec thread */
643void codec_thread_resume(void)
644{
645 thread_thaw(codec_thread_id);
646}
647
648#ifdef HAVE_PRIORITY_SCHEDULING 639#ifdef HAVE_PRIORITY_SCHEDULING
649/* Obtain codec thread's current priority */ 640/* Obtain codec thread's current priority */
650int codec_thread_get_priority(void) 641int codec_thread_get_priority(void)
diff --git a/apps/codec_thread.h b/apps/codec_thread.h
index 14551dcf48..65f64c377e 100644
--- a/apps/codec_thread.h
+++ b/apps/codec_thread.h
@@ -28,14 +28,12 @@
28const char *get_codec_filename(int cod_spec); 28const char *get_codec_filename(int cod_spec);
29 29
30/* codec thread */ 30/* codec thread */
31void codec_thread_init(void);
31 32
32/* Audio MUST be stopped before requesting callback! */ 33/* Audio MUST be stopped before requesting callback! */
33void codec_thread_do_callback(void (*fn)(void), 34void codec_thread_do_callback(void (*fn)(void),
34 unsigned int *codec_thread_id); 35 unsigned int *codec_thread_id);
35 36
36void codec_init_codec_api(void);
37void make_codec_thread(void);
38void codec_thread_resume(void);
39#ifdef HAVE_PRIORITY_SCHEDULING 37#ifdef HAVE_PRIORITY_SCHEDULING
40int codec_thread_get_priority(void); 38int codec_thread_get_priority(void);
41int codec_thread_set_priority(int priority); 39int codec_thread_set_priority(int priority);
diff --git a/apps/playback.c b/apps/playback.c
index 1b883b8319..9fd25b975d 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -3813,14 +3813,11 @@ void audio_init(void)
3813 3813
3814 pcm_init(); 3814 pcm_init();
3815 3815
3816 codec_init_codec_api(); 3816 codec_thread_init();
3817
3818 make_codec_thread();
3819 3817
3820 /* This thread does buffer, so match its priority */ 3818 /* This thread does buffer, so match its priority */
3821 audio_thread_id = create_thread(audio_thread, audio_stack, 3819 audio_thread_id = create_thread(audio_thread, audio_stack,
3822 sizeof(audio_stack), CREATE_THREAD_FROZEN, 3820 sizeof(audio_stack), 0, audio_thread_name
3823 audio_thread_name
3824 IF_PRIO(, MIN(PRIORITY_BUFFERING, PRIORITY_USER_INTERFACE)) 3821 IF_PRIO(, MIN(PRIORITY_BUFFERING, PRIORITY_USER_INTERFACE))
3825 IF_COP(, CPU)); 3822 IF_COP(, CPU));
3826 3823
@@ -3853,11 +3850,4 @@ void audio_init(void)
3853#ifdef HAVE_DISK_STORAGE 3850#ifdef HAVE_DISK_STORAGE
3854 audio_set_buffer_margin(global_settings.buffer_margin); 3851 audio_set_buffer_margin(global_settings.buffer_margin);
3855#endif 3852#endif
3856
3857 /* It's safe to let the threads run now */
3858#ifdef PLAYBACK_VOICE
3859 voice_thread_resume();
3860#endif
3861 codec_thread_resume();
3862 thread_thaw(audio_thread_id);
3863} 3853}
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 5a3ad46801..2f216cde9d 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -217,9 +217,6 @@ void mp3_play_data(const unsigned char* start, int size,
217/* Stop current voice clip from playing */ 217/* Stop current voice clip from playing */
218void mp3_play_stop(void) 218void mp3_play_stop(void)
219{ 219{
220 if(!audio_is_thread_ready())
221 return;
222
223 LOGFQUEUE("mp3 >| voice Q_VOICE_STOP"); 220 LOGFQUEUE("mp3 >| voice Q_VOICE_STOP");
224 queue_send(&voice_queue, Q_VOICE_STOP, 0); 221 queue_send(&voice_queue, Q_VOICE_STOP, 0);
225} 222}
@@ -419,12 +416,6 @@ static void NORETURN_ATTR voice_thread(void)
419 416
420 voice_data_init(&td); 417 voice_data_init(&td);
421 418
422 /* audio thread will only set this once after it finished the final
423 * audio hardware init so this little construct is safe - even
424 * cross-core. */
425 while (!audio_is_thread_ready())
426 sleep(0);
427
428 while (1) 419 while (1)
429 { 420 {
430 switch (state) 421 switch (state)
@@ -449,18 +440,11 @@ void voice_thread_init(void)
449 queue_init(&voice_queue, false); 440 queue_init(&voice_queue, false);
450 441
451 voice_thread_id = create_thread(voice_thread, voice_stack, 442 voice_thread_id = create_thread(voice_thread, voice_stack,
452 sizeof(voice_stack), CREATE_THREAD_FROZEN, 443 sizeof(voice_stack), 0, voice_thread_name
453 voice_thread_name IF_PRIO(, PRIORITY_VOICE) IF_COP(, CPU)); 444 IF_PRIO(, PRIORITY_VOICE) IF_COP(, CPU));
454 445
455 queue_enable_queue_send(&voice_queue, &voice_queue_sender_list, 446 queue_enable_queue_send(&voice_queue, &voice_queue_sender_list,
456 voice_thread_id); 447 voice_thread_id);
457} /* voice_thread_init */
458
459/* Unfreeze the voice thread */
460void voice_thread_resume(void)
461{
462 logf("Thawing voice thread");
463 thread_thaw(voice_thread_id);
464} 448}
465 449
466#ifdef HAVE_PRIORITY_SCHEDULING 450#ifdef HAVE_PRIORITY_SCHEDULING
diff --git a/apps/voice_thread.h b/apps/voice_thread.h
index 1529f7efe8..5f6547fb76 100644
--- a/apps/voice_thread.h
+++ b/apps/voice_thread.h
@@ -31,7 +31,6 @@ void voice_wait(void);
31void voice_stop(void); 31void voice_stop(void);
32 32
33void voice_thread_init(void); 33void voice_thread_init(void);
34void voice_thread_resume(void);
35#ifdef HAVE_PRIORITY_SCHEDULING 34#ifdef HAVE_PRIORITY_SCHEDULING
36void voice_thread_set_priority(int priority); 35void voice_thread_set_priority(int priority);
37#endif 36#endif