summaryrefslogtreecommitdiff
path: root/apps/playback.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/apps/playback.c b/apps/playback.c
index fe7a9f6ab1..89caec92aa 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -194,9 +194,9 @@ static bool audio_is_initialized = false;
194/* TBD: Split out "audio" and "playback" (ie. calling) threads */ 194/* TBD: Split out "audio" and "playback" (ie. calling) threads */
195 195
196/* Main state control */ 196/* Main state control */
197static volatile bool audio_codec_loaded; /* Is codec loaded? (C/A-) */ 197static volatile bool audio_codec_loaded NOCACHEBSS_ATTR;/* Codec loaded? (C/A-) */
198static volatile bool playing; /* Is audio playing? (A) */ 198static volatile bool playing NOCACHEBSS_ATTR; /* Is audio playing? (A) */
199static volatile bool paused; /* Is audio paused? (A/C-) */ 199static volatile bool paused NOCACHEBSS_ATTR; /* Is audio paused? (A/C-) */
200static volatile bool filling IDATA_ATTR; /* Is file buffer refilling? (A/C-) */ 200static volatile bool filling IDATA_ATTR; /* Is file buffer refilling? (A/C-) */
201 201
202/* Ring buffer where compressed audio and codecs are loaded */ 202/* Ring buffer where compressed audio and codecs are loaded */
@@ -290,7 +290,7 @@ static void audio_reset_buffer(size_t pcmbufsize);
290 290
291/* Codec thread */ 291/* Codec thread */
292extern struct codec_api ci; 292extern struct codec_api ci;
293static struct event_queue codec_queue; 293static struct event_queue codec_queue NOCACHEBSS_ATTR;
294static long codec_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)] 294static long codec_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)]
295IBSS_ATTR; 295IBSS_ATTR;
296static const char codec_thread_name[] = "codec"; 296static const char codec_thread_name[] = "codec";
@@ -304,7 +304,7 @@ static volatile int current_codec IDATA_ATTR; /* Current codec (normal/voice) */
304extern struct codec_api ci_voice; 304extern struct codec_api ci_voice;
305 305
306static struct thread_entry *voice_thread_p = NULL; 306static struct thread_entry *voice_thread_p = NULL;
307static struct event_queue voice_queue; 307static struct event_queue voice_queue NOCACHEBSS_ATTR;
308static long voice_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)] 308static long voice_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)]
309IBSS_ATTR_VOICE_STACK; 309IBSS_ATTR_VOICE_STACK;
310static const char voice_thread_name[] = "voice codec"; 310static const char voice_thread_name[] = "voice codec";
@@ -324,12 +324,12 @@ static unsigned char *iram_buf[2] = { NULL, NULL };
324/* Pointer to DRAM buffers for normal/voice codecs */ 324/* Pointer to DRAM buffers for normal/voice codecs */
325static unsigned char *dram_buf[2] = { NULL, NULL }; 325static unsigned char *dram_buf[2] = { NULL, NULL };
326/* Mutex to control which codec (normal/voice) is running */ 326/* Mutex to control which codec (normal/voice) is running */
327static struct mutex mutex_codecthread; 327static struct mutex mutex_codecthread NOCACHEBSS_ATTR;
328 328
329/* Voice state */ 329/* Voice state */
330static volatile bool voice_thread_start; /* Triggers voice playback (A/V) */ 330static volatile bool voice_thread_start; /* Triggers voice playback (A/V) */
331static volatile bool voice_is_playing; /* Is voice currently playing? (V) */ 331static volatile bool voice_is_playing NOCACHEBSS_ATTR; /* Is voice currently playing? (V) */
332static volatile bool voice_codec_loaded; /* Is voice codec loaded (V/A-) */ 332static volatile bool voice_codec_loaded NOCACHEBSS_ATTR; /* Is voice codec loaded (V/A-) */
333static char *voicebuf; 333static char *voicebuf;
334static size_t voice_remaining; 334static size_t voice_remaining;
335 335
@@ -863,7 +863,8 @@ void audio_preinit(void)
863 queue_init(&codec_queue, true); 863 queue_init(&codec_queue, true);
864 864
865 create_thread(audio_thread, audio_stack, sizeof(audio_stack), 865 create_thread(audio_thread, audio_stack, sizeof(audio_stack),
866 audio_thread_name IF_PRIO(, PRIORITY_BUFFERING)); 866 audio_thread_name IF_PRIO(, PRIORITY_BUFFERING)
867 IF_COP(, CPU, false));
867} 868}
868 869
869void audio_init(void) 870void audio_init(void)
@@ -888,7 +889,7 @@ void voice_init(void)
888 queue_init(&voice_queue, true); 889 queue_init(&voice_queue, true);
889 voice_thread_p = create_thread(voice_thread, voice_stack, 890 voice_thread_p = create_thread(voice_thread, voice_stack,
890 sizeof(voice_stack), voice_thread_name 891 sizeof(voice_stack), voice_thread_name
891 IF_PRIO(, PRIORITY_PLAYBACK)); 892 IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU, false));
892 893
893 while (!voice_codec_loaded) 894 while (!voice_codec_loaded)
894 yield(); 895 yield();
@@ -3533,7 +3534,8 @@ static void audio_playback_init(void)
3533 3534
3534 codec_thread_p = create_thread( 3535 codec_thread_p = create_thread(
3535 codec_thread, codec_stack, sizeof(codec_stack), 3536 codec_thread, codec_stack, sizeof(codec_stack),
3536 codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK)); 3537 codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK)
3538 IF_COP(, COP, true));
3537 3539
3538 while (1) 3540 while (1)
3539 { 3541 {