From 6d3a6f71d1f8bce9ab5e7b90ceab6a17271174b8 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Thu, 1 Sep 2011 07:32:07 +0000 Subject: 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 --- apps/codec_thread.c | 51 +++++++++++++++++++++------------------------------ apps/codec_thread.h | 4 +--- apps/playback.c | 14 ++------------ apps/voice_thread.c | 20 ++------------------ apps/voice_thread.h | 1 - 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) return global_settings.repeat_mode == REPEAT_ONE; } -/* Initialize codec API */ -void codec_init_codec_api(void) -{ - ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP, - CODEC_IDX_AUDIO); - ci.codec_get_buffer = codec_get_buffer_callback; - ci.pcmbuf_insert = codec_pcmbuf_insert_callback; - ci.set_elapsed = audio_codec_update_elapsed; - ci.read_filebuf = codec_filebuf_callback; - ci.request_buffer = codec_request_buffer_callback; - ci.advance_buffer = codec_advance_buffer_callback; - ci.seek_buffer = codec_seek_buffer_callback; - ci.seek_complete = codec_seek_complete_callback; - ci.set_offset = audio_codec_update_offset; - ci.configure = codec_configure_callback; - ci.get_command = codec_get_command_callback; - ci.loop_track = codec_loop_track_callback; -} - /** --- CODEC THREAD --- **/ @@ -626,25 +607,35 @@ static void NORETURN_ATTR codec_thread(void) /** --- Miscellaneous external interfaces -- **/ -/* Create the codec thread and init kernel objects */ -void make_codec_thread(void) -{ +/* Initialize playback's codec interface */ +void codec_thread_init(void) +{ + /* Init API */ + ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP, + CODEC_IDX_AUDIO); + ci.codec_get_buffer = codec_get_buffer_callback; + ci.pcmbuf_insert = codec_pcmbuf_insert_callback; + ci.set_elapsed = audio_codec_update_elapsed; + ci.read_filebuf = codec_filebuf_callback; + ci.request_buffer = codec_request_buffer_callback; + ci.advance_buffer = codec_advance_buffer_callback; + ci.seek_buffer = codec_seek_buffer_callback; + ci.seek_complete = codec_seek_complete_callback; + ci.set_offset = audio_codec_update_offset; + ci.configure = codec_configure_callback; + ci.get_command = codec_get_command_callback; + ci.loop_track = codec_loop_track_callback; + + /* Init threading */ queue_init(&codec_queue, false); codec_thread_id = create_thread( - codec_thread, codec_stack, sizeof(codec_stack), - CREATE_THREAD_FROZEN, + codec_thread, codec_stack, sizeof(codec_stack), 0, codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU)); queue_enable_queue_send(&codec_queue, &codec_queue_sender_list, codec_thread_id); } -/* Unfreeze the codec thread */ -void codec_thread_resume(void) -{ - thread_thaw(codec_thread_id); -} - #ifdef HAVE_PRIORITY_SCHEDULING /* Obtain codec thread's current priority */ int 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 @@ const char *get_codec_filename(int cod_spec); /* codec thread */ +void codec_thread_init(void); /* Audio MUST be stopped before requesting callback! */ void codec_thread_do_callback(void (*fn)(void), unsigned int *codec_thread_id); -void codec_init_codec_api(void); -void make_codec_thread(void); -void codec_thread_resume(void); #ifdef HAVE_PRIORITY_SCHEDULING int codec_thread_get_priority(void); int 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) pcm_init(); - codec_init_codec_api(); - - make_codec_thread(); + codec_thread_init(); /* This thread does buffer, so match its priority */ audio_thread_id = create_thread(audio_thread, audio_stack, - sizeof(audio_stack), CREATE_THREAD_FROZEN, - audio_thread_name + sizeof(audio_stack), 0, audio_thread_name IF_PRIO(, MIN(PRIORITY_BUFFERING, PRIORITY_USER_INTERFACE)) IF_COP(, CPU)); @@ -3853,11 +3850,4 @@ void audio_init(void) #ifdef HAVE_DISK_STORAGE audio_set_buffer_margin(global_settings.buffer_margin); #endif - - /* It's safe to let the threads run now */ -#ifdef PLAYBACK_VOICE - voice_thread_resume(); -#endif - codec_thread_resume(); - thread_thaw(audio_thread_id); } 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, /* Stop current voice clip from playing */ void mp3_play_stop(void) { - if(!audio_is_thread_ready()) - return; - LOGFQUEUE("mp3 >| voice Q_VOICE_STOP"); queue_send(&voice_queue, Q_VOICE_STOP, 0); } @@ -419,12 +416,6 @@ static void NORETURN_ATTR voice_thread(void) voice_data_init(&td); - /* audio thread will only set this once after it finished the final - * audio hardware init so this little construct is safe - even - * cross-core. */ - while (!audio_is_thread_ready()) - sleep(0); - while (1) { switch (state) @@ -449,18 +440,11 @@ void voice_thread_init(void) queue_init(&voice_queue, false); voice_thread_id = create_thread(voice_thread, voice_stack, - sizeof(voice_stack), CREATE_THREAD_FROZEN, - voice_thread_name IF_PRIO(, PRIORITY_VOICE) IF_COP(, CPU)); + sizeof(voice_stack), 0, voice_thread_name + IF_PRIO(, PRIORITY_VOICE) IF_COP(, CPU)); queue_enable_queue_send(&voice_queue, &voice_queue_sender_list, voice_thread_id); -} /* voice_thread_init */ - -/* Unfreeze the voice thread */ -void voice_thread_resume(void) -{ - logf("Thawing voice thread"); - thread_thaw(voice_thread_id); } #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); void voice_stop(void); void voice_thread_init(void); -void voice_thread_resume(void); #ifdef HAVE_PRIORITY_SCHEDULING void voice_thread_set_priority(int priority); #endif -- cgit v1.2.3