comparison src/cs/services/audio/audio_task.c @ 519:838eeafb0051

Main and Audio source directories lowercased
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 22 Jul 2018 07:41:05 +0000
parents src/cs/services/Audio/audio_task.c@945cf7f506b2
children
comparison
equal deleted inserted replaced
518:4b7e0dba42f6 519:838eeafb0051
1 /****************************************************************************/
2 /* */
3 /* Name audio_task.c */
4 /* */
5 /* Function this file contains the main AUDIO function: audio_task */
6 /* It contains the body of the AUDIO task. */
7 /* It will initialize the AUDIO and then wait for messages */
8 /* or functions calls. */
9 /* */
10 /* Version 0.1 */
11 /* */
12 /* Date Modification */
13 /* ------------------------------------ */
14 /* 18 May 2001 Create */
15 /* */
16 /* Author Francois Mazard - Stephanie Gerthoux */
17 /* */
18 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
19 /****************************************************************************/
20
21 #include "rv/rv_defined_swe.h"
22
23 #ifdef RVM_AUDIO_MAIN_SWE
24 #ifndef _WINDOWS
25 #include "config/swconfig.cfg"
26 #include "config/sys.cfg"
27 #include "config/chipset.cfg"
28 #endif
29
30 #include "l1_confg.h"
31 #include "rvf/rvf_api.h"
32 #include "rv/rv_general.h"
33 #include "rvm/rvm_gen.h"
34 #include "audio/audio_features_i.h"
35 #include "audio/audio_api.h"
36 #include "audio/audio_env_i.h"
37 #include "audio/audio_ffs_i.h"
38 #include "audio/audio_structs_i.h"
39 #include "audio/audio_macro_i.h"
40 #include "rvf/rvf_target.h"
41 #include "audio/audio_const_i.h"
42 #include "audio/audio_var_i.h"
43 #include "audio/audio_error_hdlr_i.h"
44 #include "audio/audio_messages_i.h"
45 #if (L1_GTT == 1)
46 #include "tty/tty_i.h"
47 #include "l1gtt_signa.h"
48 #endif
49
50 #ifndef _WINDOWS
51 /* include the usefull L1 header */
52 #define BOOL_FLAG
53 #define CHAR_FLAG
54 #include "l1_types.h"
55 #include "cust_os.h"
56 #include "l1audio_cust.h"
57 #include "l1audio_msgty.h"
58 #include "l1audio_signa.h"
59 #include "l1_signa.h"
60 #else
61 /* include the usefull L1 header */
62 #define BOOL_FLAG
63 //#define CHAR_FLAG
64 #include "l1_types.h"
65 #include "l1audio_const.h"
66 #include "l1audio_cust.h"
67 #include "l1audio_defty.h"
68 #include "l1audio_msgty.h"
69 #include "l1audio_signa.h"
70 #include "l1_const.h"
71 #include "l1_defty.h"
72 #include "l1_msgty.h"
73 #include "l1_signa.h"
74 #include "l1_varex.h"
75 #include "audio/tests/audio_test.h"
76 #endif
77
78 #ifndef _WINDOWS
79 #if (TRACE_TYPE==4)
80 extern void l1_trace_message(xSignalHeaderRec *msg);
81 #endif
82 #endif
83 #if (L1_GTT == 1)
84 extern void tty_manager (T_RV_HDR *p_message);
85 extern T_TTY_ENV_CTRL_BLK *tty_env_ctrl_blk_p;
86 #endif
87 #if (L1_MIDI==1)
88 extern UINT8 audio_midi_message_switch(T_RV_HDR *p_message);
89 #endif
90 extern BOOLEAN audio_compatibilities_manager (T_RV_HDR *p_message);
91
92
93 /********************************************************************************/
94 /* */
95 /* Function Name: audio_allocate_l1_message */
96 /* */
97 /* Purpose: This function is called to allocate a buffer for the message */
98 /* to the l1 */
99 /* */
100 /* Input Parameters: */
101 /* Size */
102 /* */
103 /* Output Parameters: */
104 /* None. */
105 /* */
106 /* Note: */
107 /* None. */
108 /* */
109 /* Revision History: */
110 /* None. */
111 /* */
112 /********************************************************************************/
113 void *audio_allocate_l1_message(UINT16 size)
114 {
115 void *buffer = NULL;
116
117 #ifdef _WINDOWS
118 T_RVF_MB_STATUS mb_status;
119 /* allocate a buffer in the riviera environement */
120 if (size == 0)
121 {
122 /* allocate the memory for a message without parameter */
123 mb_status = rvf_get_buf (p_audio_gbl_var->mb_internal,
124 sizeof(T_RV_HDR),
125 (T_RVF_BUFFER **) (&buffer));
126 }
127 else
128 {
129 /* allocate the memory for a message with some parameters */
130 mb_status = rvf_get_buf (p_audio_gbl_var->mb_internal,
131 size,
132 (T_RVF_BUFFER **) (&buffer));
133 }
134
135 /* If insufficient resources, then report a memory error and abort. */
136 if (mb_status == RVF_YELLOW)
137 {
138 /* deallocate the memory */
139 rvf_free_buf((T_RVF_BUFFER *)buffer);
140 audio_error_trace(AUDIO_ENTITY_NO_MEMORY);
141 return (NULL);
142 }
143 else
144 if (mb_status == RVF_RED)
145 {
146 audio_error_trace(AUDIO_ENTITY_NO_MEMORY);
147 return (NULL);
148 }
149
150 #else
151 /* allocate a buffer in the L1 environement */
152 /* allocate a buffer in the L1 environement */
153 xSignalHeaderRec* p_msg;
154
155 p_msg = os_alloc_sig(size);
156
157 buffer = (void*)p_msg->SigP;
158 #endif
159
160 return(buffer);
161 }
162
163 /********************************************************************************/
164 /* */
165 /* Function Name: audio_deallocate_l1_message */
166 /* */
167 /* Purpose: This function is called to deallocate a buffer for the message */
168 /* to the l1. */
169 /* */
170 /* Input Parameters: */
171 /* Audio Key Beep Parameters, */
172 /* */
173 /* Output Parameters: */
174 /* None. */
175 /* */
176 /* Note: */
177 /* None. */
178 /* */
179 /* Revision History: */
180 /* None. */
181 /* */
182 /********************************************************************************/
183 void audio_deallocate_l1_message(void *message)
184 {
185 #ifdef _WINDOWS
186 T_RV_RET status;
187
188 /* deallocate the memory */
189 status = rvf_free_buf((T_RVF_BUFFER *)message);
190 if (status != RVF_GREEN)
191 {
192 AUDIO_SEND_TRACE(" AUDIO ERROR (env). A wrong message is deallocated ",
193 RV_TRACE_LEVEL_ERROR);
194 }
195
196 #else
197 /* deallocate a buffer in the L1 environement */
198 os_free_sig((xSignalHeaderRec*)message);
199 #endif
200 }
201
202 /********************************************************************************/
203 /* */
204 /* Function Name: audio_send_l1_message */
205 /* */
206 /* Purpose: This function is called to send the message to the L1 */
207 /* */
208 /* Input Parameters: */
209 /* the message id and the message, */
210 /* */
211 /* Output Parameters: */
212 /* None. */
213 /* */
214 /* Note: */
215 /* None. */
216 /* */
217 /* Revision History: */
218 /* None. */
219 /* */
220 /********************************************************************************/
221 T_RV_RET audio_send_l1_message(INT16 message_id, void *message)
222 {
223 #ifdef _WINDOWS
224 #if ((AUDIO_REGR == SW_COMPILED) || (AUDIO_MISC == SW_COMPILED))
225 ((T_RV_HDR *)message)->msg_id = message_id;
226
227 switch (message_id)
228 {
229 /* send the messsage to the audio entity */
230 #if (KEYBEEP)
231 case MMI_KEYBEEP_START_REQ:
232 case MMI_KEYBEEP_STOP_REQ:
233 {
234 rvf_send_msg (p_audio_gbl_var->keybeep.return_path.addr_id,
235 message);
236 break;
237 }
238 #endif
239 #if (TONE)
240 case MMI_TONE_START_REQ:
241 case MMI_TONE_STOP_REQ:
242 {
243 rvf_send_msg (p_audio_gbl_var->tones.return_path.addr_id,
244 message);
245 break;
246 }
247 #endif
248 #if (MELODY_E1)
249 case MMI_MELODY0_START_REQ:
250 case MMI_MELODY0_STOP_REQ:
251 {
252 rvf_send_msg (p_audio_gbl_var->melody_E1_0.return_path.addr_id,
253 message);
254 break;
255 }
256 case MMI_MELODY1_START_REQ:
257 case MMI_MELODY1_STOP_REQ:
258 {
259 rvf_send_msg (p_audio_gbl_var->melody_E1_1.return_path.addr_id,
260 message);
261 break;
262 }
263 #endif
264 #if (MELODY_E2)
265 case MMI_MELODY0_E2_START_REQ:
266 case MMI_MELODY0_E2_STOP_REQ:
267 {
268 rvf_send_msg (p_audio_gbl_var->melody_E2_0.return_path.addr_id,
269 message);
270 break;
271 }
272 case MMI_MELODY1_E2_START_REQ:
273 case MMI_MELODY1_E2_STOP_REQ:
274 {
275 rvf_send_msg (p_audio_gbl_var->melody_E2_1.return_path.addr_id,
276 message);
277 break;
278 }
279 #endif
280 #if (VOICE_MEMO)
281 case MMI_VM_PLAY_START_REQ:
282 case MMI_VM_PLAY_STOP_REQ:
283 {
284 rvf_send_msg (p_audio_gbl_var->vm_play.return_path.addr_id,
285 message);
286 break;
287 }
288 case MMI_VM_RECORD_START_REQ:
289 case MMI_VM_RECORD_STOP_REQ:
290 {
291 rvf_send_msg (p_audio_gbl_var->vm_record.return_path.addr_id,
292 message);
293 break;
294 }
295 #endif
296 #if (SPEECH_RECO)
297 case MMI_SR_ENROLL_START_REQ:
298 case MMI_SR_ENROLL_STOP_REQ:
299 {
300 rvf_send_msg (p_audio_gbl_var->speech_reco.sr_enroll.return_path.addr_id,
301 message);
302 break;
303 }
304 case MMI_SR_UPDATE_START_REQ:
305 case MMI_SR_UPDATE_STOP_REQ:
306 case MMI_SR_UPDATE_CHECK_START_REQ:
307 case MMI_SR_UPDATE_CHECK_STOP_REQ:
308 {
309 rvf_send_msg (p_audio_gbl_var->speech_reco.sr_update.return_path.addr_id,
310 message);
311 break;
312 }
313 case MMI_SR_RECO_START_REQ:
314 case MMI_SR_RECO_STOP_REQ:
315 {
316 rvf_send_msg (p_audio_gbl_var->speech_reco.sr_reco.return_path.addr_id,
317 message);
318 break;
319 }
320 #endif
321 #if (L1_GTT == 1)
322 case MMI_GTT_START_REQ:
323 case MMI_GTT_STOP_REQ:
324 {
325 rvf_send_msg (tty_env_ctrl_blk_p->return_path.addr_id,
326 message);
327 }
328 break;
329 #endif
330 #if (L1_MIDI==1)
331 case MMI_MIDI_START_REQ:
332 case MMI_MIDI_STOP_REQ:
333 {
334 rvf_send_msg(p_audio_gbl_var->addrId,message);
335 break;
336 }
337 #endif
338 #if (FIR)
339 case MMI_AUDIO_FIR_CON:
340 case MMI_AUDIO_FIR_REQ:
341 #endif
342 #if (AEC)
343 case MMI_AEC_CON:
344 case MMI_AEC_REQ:
345 #endif
346 #if (AUDIO_MODE)
347 case MMI_AUDIO_MODE_CON:
348 case MMI_AUDIO_MODE_REQ:
349 #endif
350 case OML1_STOP_DAI_TEST_REQ:
351 case OML1_STOP_DAI_TEST_CON:
352 {
353 rvf_send_msg (p_audio_test->test_addr_id,
354 message);
355 break;
356 }
357 }
358 return(RV_OK);
359 #endif
360 #else
361 xSignalHeaderRec *p_signal;
362
363 p_signal = (xSignalHeaderRec*)(message);
364 p_signal--;
365 p_signal->SigP = (DummyStruct*)(message);
366 p_signal->SignalCode = message_id;
367
368 #if (TRACE_TYPE==4)
369 l1_trace_message(p_signal);
370 #endif
371
372
373 /* send a message in the L1 environement */
374 os_send_sig(p_signal, L1C1_QUEUE);
375
376 return(RV_OK);
377 #endif
378 }
379
380 /********************************************************************************/
381 /* Function audio_core */
382 /* */
383 /* Description Core of the audio task, which initiliazes the audio SWE and */
384 /* waits for messages. */
385 /* */
386 /********************************************************************************/
387 T_RV_RET audio_core(void)
388 {
389 /* Declare local variables */
390 BOOLEAN error_occured = FALSE;
391 T_RV_HDR *p_message = NULL;
392 UINT16 received_event= 0x0000;
393 T_RV_RET status;
394
395 AUDIO_SEND_TRACE("AUDIO_TASK started",RV_TRACE_LEVEL_DEBUG_HIGH);
396
397 /* loop to process messages */
398 while (error_occured == FALSE)
399 {
400 /* Wait for the necessary events (all events and no time out). */
401 received_event = rvf_wait (AUDIO_ALL_EVENT_FLAGS, AUDIO_NOT_TIME_OUT);
402
403 #if (MELODY_E1) || (MELODY_E2) || (VOICE_MEMO)
404 /* the time out for the AUDIO FFS downloader is expired */
405 if (received_event & AUDIO_FFS_TIMER_EVT_MASK)
406 {
407 audio_ffs_downloader();
408 }
409 #endif /* MELODY_E1 || MELODY_E2 || VOICE_MEMO
410
411 /* If an event is received, then ....*/
412 if (received_event & AUDIO_TASK_MBOX_EVT_MASK)
413 {
414 /* Read the message in the audio mailbox */
415 p_message = (T_RV_HDR *) rvf_read_mbox(AUDIO_MBOX);
416
417 if (p_message != NULL)
418 {
419 p_audio_gbl_var->message_processed = FALSE;
420
421 #if (MELODY_E1) || (MELODY_E2) || (VOICE_MEMO)
422 if ( (p_message->msg_id == AUDIO_FFS_FLASH_2_RAM_START_REQ) ||
423 (p_message->msg_id == AUDIO_FFS_RAM_2_FLASH_START_REQ) ||
424 (p_message->msg_id == AUDIO_FFS_STOP_REQ) )
425 {
426 AUDIO_SEND_TRACE_PARAM("AUDIO FFS MANAGER with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
427 /* process FFS message */
428 audio_ffs_manager(p_message);
429 p_audio_gbl_var->message_processed = TRUE;
430 }
431 #endif /* MELODY_E1 || MELODY_E2 || VOICE_MEMO */
432
433 #if (AUDIO_MEM_MANAGER)
434 if (audio_mem_message_switch(p_message) == 1)
435 {
436 AUDIO_SEND_TRACE_PARAM("AUDIO MEMORY MANAGER with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
437 /* process FFS message */
438 audio_mem_manager(p_message);
439 p_audio_gbl_var->message_processed = TRUE;
440 }
441 #endif // AUDIO_MEM_MANAGER
442
443 /* Check the compatibility with the active audio task */
444 if (audio_compatibilities_manager(p_message))
445 {
446 #if (KEYBEEP)
447 if ( (p_message->msg_id == AUDIO_KEYBEEP_START_REQ) ||
448 (p_message->msg_id == AUDIO_KEYBEEP_STOP_REQ) ||
449 (p_message->msg_id == MMI_KEYBEEP_START_CON) ||
450 (p_message->msg_id == MMI_KEYBEEP_STOP_CON) )
451 {
452 AUDIO_SEND_TRACE_PARAM("AUDIO KEYBEEP with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
453 /* process the keybeep manager */
454 audio_keybeep_manager(p_message);
455 p_audio_gbl_var->message_processed = TRUE;
456 }
457 #endif
458 #if (TONE)
459 if ( (p_message->msg_id == AUDIO_TONES_START_REQ) ||
460 (p_message->msg_id == AUDIO_TONES_STOP_REQ) ||
461 (p_message->msg_id == MMI_TONE_START_CON) ||
462 (p_message->msg_id == MMI_TONE_STOP_CON) )
463 {
464 AUDIO_SEND_TRACE_PARAM("AUDIO TONES with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
465 /* process the tones manager */
466 audio_tones_manager(p_message);
467 p_audio_gbl_var->message_processed = TRUE;
468 }
469 #endif
470 #if (SPEECH_RECO)
471 if ( (p_message->msg_id == AUDIO_SR_ENROLL_START_REQ) ||
472 (p_message->msg_id == AUDIO_SR_ENROLL_STOP_REQ) ||
473 (p_message->msg_id == MMI_SR_ENROLL_START_CON) ||
474 (p_message->msg_id == MMI_SR_ENROLL_STOP_CON) )
475 {
476 AUDIO_SEND_TRACE_PARAM("AUDIO SR ENROLL with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
477 audio_sr_enroll_manager(p_message);
478 p_audio_gbl_var->message_processed = TRUE;
479 }
480 if ( (p_message->msg_id == AUDIO_SR_UPDATE_START_REQ) ||
481 (p_message->msg_id == AUDIO_SR_UPDATE_STOP_REQ) ||
482 (p_message->msg_id == MMI_SR_UPDATE_START_CON) ||
483 (p_message->msg_id == MMI_SR_UPDATE_STOP_CON) ||
484 (p_message->msg_id == MMI_SR_UPDATE_CHECK_START_CON) ||
485 (p_message->msg_id == MMI_SR_UPDATE_CHECK_STOP_CON) )
486 {
487 AUDIO_SEND_TRACE_PARAM("AUDIO SR UPDATE with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
488 audio_sr_update_manager(p_message);
489 p_audio_gbl_var->message_processed = TRUE;
490 }
491 if ( (p_message->msg_id == AUDIO_SR_RECO_START_REQ) ||
492 (p_message->msg_id == AUDIO_SR_RECO_STOP_REQ) ||
493 (p_message->msg_id == MMI_SR_RECO_START_CON) ||
494 (p_message->msg_id == MMI_SR_RECO_STOP_CON) )
495 {
496 AUDIO_SEND_TRACE_PARAM("AUDIO SR RECO with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
497 audio_sr_reco_manager(p_message);
498 p_audio_gbl_var->message_processed = TRUE;
499 }
500 #ifndef _WINDOWS
501 /* add the management of the background task in the audio entity */
502 if ( (p_message->msg_id == L1_SRBACK_SAVE_DATA_REQ) ||
503 (p_message->msg_id == L1_SRBACK_LOAD_MODEL_REQ) ||
504 (p_message->msg_id == L1_SRBACK_TEMP_SAVE_DATA_REQ) )
505 {
506 AUDIO_SEND_TRACE_PARAM("AUDIO SR BACKGROUND with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
507 audio_sr_background_manager(p_message);
508 p_audio_gbl_var->message_processed = TRUE;
509 }
510 #endif
511 #endif
512 #if (MELODY_E1)
513 /* determine which melody id is involved by this start or stop message */
514 switch (audio_melody_E1_message_switch(p_message))
515 {
516 /* The message is for the melody number 0 */
517 case AUDIO_MELODY_E1_0:
518 {
519 AUDIO_SEND_TRACE_PARAM("AUDIO MELODY E1.0 with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
520 /* process the melody E1 manager 0 */
521 audio_melody_E1_manager_0(p_message);
522 p_audio_gbl_var->message_processed = TRUE;
523 break;
524 }
525 /* The message is for the melody number 1 */
526 case AUDIO_MELODY_E1_1:
527 {
528 AUDIO_SEND_TRACE_PARAM("AUDIO MELODY E1.1 with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
529 /* process the melody E1 manager 1 */
530 audio_melody_E1_manager_1(p_message);
531 p_audio_gbl_var->message_processed = TRUE;
532 break;
533 }
534 } /* switch */
535 #endif
536 #if (MELODY_E2)
537 /* determine which melody id is involved by this start or stop messsage */
538 switch (audio_melody_E2_message_switch(p_message))
539 {
540 /* The message is for the melody number 0 */
541 case AUDIO_MELODY_E2_0:
542 {
543 AUDIO_SEND_TRACE_PARAM("AUDIO MELODY E2.0 with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
544 /* process the melody E2 manager 0 */
545 audio_melody_E2_manager_0(p_message);
546 p_audio_gbl_var->message_processed = TRUE;
547 break;
548 }
549 /* The message is for the melody number 1 */
550 case AUDIO_MELODY_E2_1:
551 {
552 AUDIO_SEND_TRACE_PARAM("AUDIO MELODY E2.1 with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
553 /* process the melody E2 manager 1 */
554 audio_melody_E2_manager_1(p_message);
555 p_audio_gbl_var->message_processed = TRUE;
556 break;
557 }
558 } /* switch */
559 #ifndef _WINDOWS
560 /* add the management of the melody E2 background task in the audio entity */
561 if ( (p_message->msg_id == L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ) ||
562 (p_message->msg_id == L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ) )
563 {
564 AUDIO_SEND_TRACE_PARAM("AUDIO MELODY E2 BACKGROUND with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
565 audio_background_melody_e2_download_instrument_manager(p_message);
566 p_audio_gbl_var->message_processed = TRUE;
567 }
568 #endif
569 #endif
570 #if (VOICE_MEMO)
571 switch (audio_voice_memo_message_switch(p_message))
572 {
573 /* The message is for the voice memo play*/
574 case AUDIO_VM_PLAY:
575 {
576 AUDIO_SEND_TRACE_PARAM("AUDIO VM PLAY with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
577 /* process the voice memo play manager */
578 audio_vm_play_manager(p_message);
579 p_audio_gbl_var->message_processed = TRUE;
580 break;
581 }
582 /* The message is for the voice memo record */
583 case AUDIO_VM_RECORD:
584 {
585 AUDIO_SEND_TRACE_PARAM("AUDIO VM RECORD with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
586 /* process the voice memo record manager */
587 audio_vm_record_manager(p_message);
588 p_audio_gbl_var->message_processed = TRUE;
589 break;
590 }
591 } /* switch */
592 #endif
593 #if (L1_GTT == 1)
594 if ( (p_message->msg_id == TTY_START_REQ) ||
595 (p_message->msg_id == TTY_STOP_REQ) ||
596 (p_message->msg_id == MMI_GTT_START_CON) ||
597 (p_message->msg_id == MMI_GTT_STOP_CON))
598 {
599 AUDIO_SEND_TRACE_PARAM("TTY with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
600 /* process the TTY manager */
601 tty_manager(p_message);
602 p_audio_gbl_var->message_processed = TRUE;
603 }
604 #endif
605 #if (L1_VOICE_MEMO_AMR)&&(AUDIO_MEM_MANAGER)
606 switch (audio_voice_memo_amr_memory_message_switch(p_message))
607 {
608 /* The message is for the voice memo play*/
609 case AUDIO_VM_AMR_PLAY:
610 {
611 AUDIO_SEND_TRACE_PARAM("AUDIO VM AMR MMS PLAY from memory with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
612 /* process the voice memo play manager */
613 audio_vm_amr_play_from_memory_manager(p_message);
614 p_audio_gbl_var->message_processed = TRUE;
615 }
616 break;
617 /* The message is for the voice memo record */
618 case AUDIO_VM_AMR_RECORD:
619 {
620 AUDIO_SEND_TRACE_PARAM("AUDIO VM AMR MMS RECORD to memory with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
621 /* process the voice memo record manager */
622 audio_vm_amr_record_to_memory_manager(p_message);
623 p_audio_gbl_var->message_processed = TRUE;
624 }
625 break;
626 } /* switch */
627 #endif
628
629 #if (L1_MIDI==1)
630 if(audio_midi_message_switch(p_message)==AUDIO_MIDI)
631 {
632 AUDIO_SEND_TRACE_PARAM("AUDIO MIDI with the msg",p_message->msg_id,RV_TRACE_LEVEL_DEBUG_LOW);
633 audio_midi_manager(p_message);
634 p_audio_gbl_var->message_processed = TRUE;
635 }
636 #endif
637
638 #if (L1_AUDIO_DRIVER)
639 switch (audio_driver_message_switch(p_message))
640 {
641 /* The message is for the voice memo play*/
642 case AUDIO_DRIVER_SWITCH:
643 {
644 AUDIO_SEND_TRACE_PARAM("AUDIO DRIVER with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
645 /* process the voice memo play manager */
646 audio_driver_manager(p_message);
647 p_audio_gbl_var->message_processed = TRUE;
648 }
649 break;
650 case AUDIO_DRIVER_VM_AMR_RECORD_SESSION_SWITCH:
651 {
652 AUDIO_SEND_TRACE_PARAM("AUDIO DRIVER VM AMR RECORD with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
653 /* process the voice memo record manager */
654 audio_driver_manager(p_message);
655 p_audio_gbl_var->message_processed = TRUE;
656 }
657 break;
658 case AUDIO_DRIVER_VM_AMR_PLAY_SESSION_SWITCH:
659 {
660 AUDIO_SEND_TRACE_PARAM("AUDIO DRIVER VM AMR PLAY with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
661 /* process the voice memo record manager */
662 audio_driver_manager(p_message);
663 p_audio_gbl_var->message_processed = TRUE;
664 }
665 break;
666 case AUDIO_DRIVER_MIDI_SESSION_SWITCH:
667 {
668 AUDIO_SEND_TRACE_PARAM("AUDIO DRIVER MIDI with the msg",p_message->msg_id,RV_TRACE_LEVEL_DEBUG_LOW);
669 /* process the voice memo record manager */
670 audio_driver_manager(p_message);
671 p_audio_gbl_var->message_processed=TRUE;
672 }
673 break;
674 } /* switch */
675 #endif
676 switch(audio_mode_message_switch(p_message))
677 {
678 case AUDIO_FULL_ACCESS_WRITE:
679 {
680 AUDIO_SEND_TRACE_PARAM("AUDIO MODE FULL ACCESS WRITE with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
681 audio_mode_full_access_write_manager(p_message);
682 p_audio_gbl_var->message_processed = TRUE;
683 break;
684 }
685 case AUDIO_MODE_SAVE:
686 {
687 AUDIO_SEND_TRACE_PARAM("AUDIO MODE SAVE with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
688 audio_mode_save_manager(p_message);
689 p_audio_gbl_var->message_processed = TRUE;
690 break;
691 }
692 case AUDIO_MODE_LOAD:
693 {
694 AUDIO_SEND_TRACE_PARAM("AUDIO MODE LOAD with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
695 audio_mode_load_manager(p_message);
696 p_audio_gbl_var->message_processed = TRUE;
697 break;
698 }
699 case AUDIO_SPEAKER_VOLUME:
700 {
701 AUDIO_SEND_TRACE_PARAM("AUDIO MODE SPEAKER VOLUME with the msg", p_message->msg_id, RV_TRACE_LEVEL_DEBUG_LOW);
702 audio_mode_speaker_volume_manager (p_message);
703 p_audio_gbl_var->message_processed = TRUE;
704 break;
705 }
706
707 }
708
709 #ifdef _WINDOWS
710 #if (L1_MIDI == 1)
711 // l1 simulator for MIDI
712 if(p_message->msg_id==MMI_MIDI_START_REQ || p_message->msg_id==MMI_MIDI_STOP_REQ)
713 {
714 AUDIO_SEND_TRACE_PARAM("AUDIO MIDI SIMUL with the msg",p_message->msg_id,RV_TRACE_LEVEL_DEBUG_LOW);
715 audio_midi_l1_simulator(received_event,p_message);
716 p_audio_gbl_var->message_processed = TRUE;
717 }
718 #endif
719 #endif // _WINDOWS
720
721 } /* audio_compatibilities_manager */
722
723 if (p_audio_gbl_var->message_processed == FALSE)
724 {
725 AUDIO_SEND_TRACE_PARAM(" AUDIO ERROR (env). A wrong message is received ",
726 p_message->msg_id, RV_TRACE_LEVEL_ERROR);
727 }
728 status = rvf_free_buf((T_RVF_BUFFER *)p_message);
729 if (status != RVF_GREEN)
730 {
731 AUDIO_SEND_TRACE(" AUDIO ERROR (env). A wrong message is deallocated ",
732 RV_TRACE_LEVEL_ERROR);
733 }
734 } /* if (p_message != NULL) */
735 else
736 {
737 AUDIO_SEND_TRACE(" AUDIO ERROR (env). Can't read the message received ",
738 RV_TRACE_LEVEL_ERROR);
739 }
740 } /* if (received_event & AUDIO_TASK_MBOX_EVT_MASK) */
741
742 /* Wait timer simulation event to send notifications */
743 #ifdef _WINDOWS
744 #if (L1_MIDI == 1)
745 if(received_event & AUDIO_MIDI_L1_SIMUL_TIMER_EVT_MASK)
746 audio_midi_l1_simulator(received_event,p_message);
747 #endif
748 #endif
749
750 /* If one of the occured events is unexpected (due to an unassigned */
751 /* mailbox), then report an internal error. */
752 #ifdef _WINDOWS
753 if(received_event & ~(AUDIO_TASK_MBOX_EVT_MASK | AUDIO_FFS_TIMER_EVT_MASK| AUDIO_MIDI_L1_SIMUL_TIMER_EVT_MASK))
754 #else
755 if(received_event & ~(AUDIO_TASK_MBOX_EVT_MASK | AUDIO_FFS_TIMER_EVT_MASK))
756 #endif
757 {
758 AUDIO_SEND_TRACE(" AUDIO ERROR (env). One of the occured events is unexpected ",
759 RV_TRACE_LEVEL_ERROR);
760
761 error_occured = TRUE;
762 }
763 } /* end of While */
764 return(RV_INTERNAL_ERR);
765 } /****************************** End of audio_task function **************************/
766
767 #endif /* #ifdef RVM_AUDIO_MAIN_SWE */