comparison src/cs/layer1/audio_cfile/l1audio_afunc.c @ 234:b870b6a44d31

l1audio and l1tm reconstructed source imported from tcs211-l1-reconst
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 20 Mar 2017 00:51:20 +0000
parents
children
comparison
equal deleted inserted replaced
233:17d79c62e638 234:b870b6a44d31
1 /************* Revision Controle System Header *************
2 * GSM Layer 1 software
3 * L1AUDIO_AFUNC.C
4 *
5 * Filename l1audio_afunc.c
6 * Copyright 2003 (C) Texas Instruments
7 *
8 ************* Revision Controle System Header *************/
9
10 /************************************/
11 /* Include files... */
12 /************************************/
13
14 #include "l1_macro.h"
15 #include "l1_confg.h"
16
17 #if (AUDIO_TASK == 1)
18
19 #include "l1_types.h"
20 #include "sys_types.h"
21
22 #if (CODE_VERSION == SIMULATION) && (AUDIO_SIMULATION)
23
24
25 #include <stdlib.h>
26 #include <string.h>
27
28 #include "iq.h" // Debug / Init hardware ("eva3.lib")
29 #include "l1_ver.h"
30 #include "l1_const.h"
31 #include "l1_signa.h"
32
33 #if TESTMODE
34 #include "l1tm_defty.h"
35 #endif
36
37 #include "l1audio_const.h"
38 #include "l1audio_cust.h"
39 #include "l1audio_signa.h"
40 #include "l1audio_defty.h"
41 #include "l1audio_msgty.h"
42
43 #if (L1_GTT == 1)
44 #include "l1gtt_const.h"
45 #include "l1gtt_defty.h"
46 #endif
47 //added from e-sample for AAC
48 #if (L1_DYN_DSP_DWNLD == 1)
49 #include "l1_dyn_dwl_const.h"
50 #include "l1_dyn_dwl_defty.h"
51 #endif
52 #if (L1_MP3 == 1)
53 #include "l1mp3_defty.h"
54 #endif
55
56 #if (L1_MIDI == 1)
57 #include "l1midi_defty.h"
58 #endif
59 //added from e-sample for AAC
60 #if (L1_AAC == 1)
61 #include "l1aac_defty.h"
62 #endif
63
64 #include "l1_defty.h"
65 #include "cust_os.h"
66 #include "l1_msgty.h"
67 #include "l1_varex.h"
68
69 #include "l1_mftab.h"
70 #include "l1_tabs.h"
71 #include "l1_ctl.h"
72
73 #include "l1_time.h"
74 #include "l1_scen.h"
75
76 #include "l1audio_proto.h"
77
78 #else
79 // Layer1 and debug include files.
80
81 #include <ctype.h>
82 #include <math.h>
83 #include "l1_ver.h"
84 #include "l1_const.h"
85 #include "l1_signa.h"
86 #include "cust_os.h"
87
88 #if TESTMODE
89 #include "l1tm_defty.h"
90 #endif
91
92 #include "l1audio_const.h"
93 #include "l1audio_cust.h"
94 #include "l1audio_signa.h"
95 #include "l1audio_defty.h"
96 #include "l1audio_msgty.h"
97 #include "l1audio_proto.h"
98
99 #if (L1_GTT == 1)
100 #include "l1gtt_const.h"
101 #include "l1gtt_defty.h"
102 #endif
103 //added from e-sample for AAC
104 #if (L1_DYN_DSP_DWNLD == 1)
105 #include "l1_dyn_dwl_const.h"
106 #include "l1_dyn_dwl_defty.h"
107 #endif
108 #if (L1_MP3 == 1)
109 #include "l1mp3_defty.h"
110 #endif
111
112 #if (L1_MIDI == 1)
113 #include "l1midi_defty.h"
114 #endif
115 //added from e-smaple for AAC
116 #if (L1_AAC == 1)
117 #include "l1aac_defty.h"
118 #endif
119
120 #if (RF_FAM == 61)
121 #include "l1_rf61.h"
122 #endif
123
124 #include "l1_defty.h"
125 #include "l1_msgty.h"
126 #include "tpudrv.h" // TPU drivers. ("eva3.lib")
127 #include "l1_varex.h"
128
129 #include "l1_proto.h"
130 #include "l1_mftab.h"
131 #include "l1_tabs.h"
132 #include "mem.h"
133 #include "armio.h"
134 #include "timer.h"
135 #include "timer1.h"
136 #include "dma.h"
137 #include "inth.h"
138 #include "ulpd.h"
139 #include "rhea_arm.h"
140 #include "clkm.h" // Clockm ("eva3.lib")
141 #include "l1_ctl.h"
142
143 #include "l1_time.h"
144 #if L2_L3_SIMUL
145 #include "l1_scen.h"
146 #endif
147
148 #if (OP_RIV_AUDIO == 1)
149 #include "rv_general.h"
150 #include "audio_api.h"
151 #include "audio_structs_i.h"
152 #include "audio_var_i.h"
153 #include "audio_macro_i.h"
154 #include "audio_const_i.h"
155 #endif
156 #endif
157
158 // This macro avoids to duplicate the code.
159 #if (OP_RIV_AUDIO == 1)
160 #define AUDIO_MSG (p_message)
161 #else
162 #define AUDIO_MSG (msg->SigP)
163 #endif
164
165 /*-------------------------------------------------------*/
166 /* l1a_audio_send_confirmation() */
167 /*-------------------------------------------------------*/
168 /* */
169 /* Parameters : Signal Code ofthe message */
170 /* */
171 /* Return : */
172 /* */
173 /* Description : Send a confirmation message to the MMI */
174 /* for an audio task. */
175 /* */
176 /*-------------------------------------------------------*/
177 void l1a_audio_send_confirmation(UWORD32 SignalCode)
178 {
179 #if (OP_RIV_AUDIO == 1)
180
181 void *p_message;
182 T_RVF_MB_STATUS mb_status; //omaps00090550
183
184 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
185 sizeof (T_RV_HDR),
186 (T_RVF_BUFFER **) (&p_message));
187
188 /* If insufficient resources, then report a memory error and abort. */
189 if (mb_status == RVF_RED)
190 {
191 /* the memory is insufficient to continue the non regression test */
192 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
193 return;
194 }
195
196 /* fill the message id */
197 ((T_RV_HDR *)p_message)->msg_id = SignalCode;
198
199 /* send the messsage to the audio entity */
200 rvf_send_msg (p_audio_gbl_var->addrId,
201 p_message);
202
203 #else // OP_RIV_AUDIO
204
205 xSignalHeaderRec *msg;
206
207 msg = os_alloc_sig(0);
208 DEBUGMSG(status,NU_ALLOC_ERR)
209 msg->SignalCode = SignalCode;
210
211 #if (TRACE_TYPE==1) || (TRACE_TYPE==4)
212 l1_trace_message(msg);
213 #endif
214
215 os_send_sig(msg, MMI_QUEUE);
216 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
217
218 #endif // OP_RIV_AUDIO
219 }
220
221 /*-------------------------------------------------------*/
222 /* l1a_audio_send_result() */
223 /*-------------------------------------------------------*/
224 /* Parameters : */
225 /* Return : */
226 /* Functionality : Send a result message to the MMI. */
227 /*-------------------------------------------------------*/
228 void l1a_audio_send_result(UWORD32 SignalCode, xSignalHeaderRec *msg, UWORD8 queue)
229 {
230 #if (OP_RIV_AUDIO == 1)
231
232 void *p_message;
233 T_RVF_MB_STATUS mb_status; //omaps00090550
234
235 switch (SignalCode)
236 {
237 #if (L1_AUDIO_DRIVER == 1)
238 case AUDIO_DRIVER_NOTIFICATION_MSG:
239 {
240 T_AUDIO_DRIVER_SESSION *p_session;
241 T_RV_RETURN *return_path;
242 UINT8 channel_id;
243
244 /* get driver session */
245 channel_id = ((T_L1_AUDIO_DRIVER_IND *)msg->SigP)->channel_id;
246 p_session = &(p_audio_gbl_var->audio_driver_session[channel_id]);
247 return_path = &(p_session->session_req.return_path);
248
249 /* Translate the l1 message into the Riviera compliant message */
250 /* Allocate the Riviera buffer */
251 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
252 sizeof (T_AUDIO_DRIVER_NOTIFICATION),
253 (T_RVF_BUFFER **) (&p_message));
254 /* If insufficient resources, then report a memory error and abort. */
255 if (mb_status == RVF_RED)
256 {
257 /* the memory is insufficient to continue the non regression test */
258 AUDIO_SEND_TRACE("AUDIO entity has no memory for driver notification",RV_TRACE_LEVEL_ERROR);
259 return;
260 }
261
262 /* Fill the message ID + parameters */
263 ((T_AUDIO_DRIVER_NOTIFICATION *)p_message)->header.msg_id = SignalCode;
264 ((T_AUDIO_DRIVER_NOTIFICATION *)p_message)->channel_id = channel_id;
265 ((T_AUDIO_DRIVER_NOTIFICATION *)p_message)->p_buffer = ((T_L1_AUDIO_DRIVER_IND *)(msg->SigP))->p_buffer;
266
267 /* send answer */
268 if (return_path->callback_func == NULL)
269 rvf_send_msg (return_path->addr_id, p_message);
270 else
271 {
272 (*return_path->callback_func)((void *)(p_message));
273 rvf_free_buf((T_RVF_BUFFER *)p_message);
274 }
275
276 // This return is important because there is another rvf_send_msg at the end of the switch
277 return;
278 }
279 //omaps00090550 break;
280 #endif
281 #if (L1_VOICE_MEMO_AMR)
282 case MMI_VM_AMR_RECORD_STOP_CON:
283 {
284 /* Translate the l1 message into the Riviera compliant message */
285 /* Allocate the Riviera buffer */
286 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
287 sizeof (T_MMI_VM_AMR_RECORD_CON),
288 (T_RVF_BUFFER **) (&p_message));
289
290 /* If insufficient resources, then report a memory error and abort. */
291 if (mb_status == RVF_RED)
292 {
293 /* the memory is insufficient to continue the non regression test */
294 AUDIO_SEND_TRACE("AUDIO entity has no memory for MMI_VM_AMR_RECORD_STOP_CON",RV_TRACE_LEVEL_ERROR);
295 return;
296 }
297
298 // recorded size includes the end mask
299 ((T_MMI_VM_AMR_RECORD_CON *)p_message)->recorded_size = ((T_L1_VM_AMR_RECORD_CON *)(msg->SigP))->recorded_size;
300 }
301 break;
302 #endif
303 #if (VOICE_MEMO)
304 case MMI_VM_RECORD_STOP_CON:
305 {
306 /* Translate the l1 message into the Riviera compliant message */
307
308 /* Allocate the Riviera buffer */
309 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
310 sizeof (T_MMI_VM_RECORD_CON),
311 (T_RVF_BUFFER **) (&p_message));
312
313 /* If insufficient resources, then report a memory error and abort. */
314 if (mb_status == RVF_RED)
315 {
316 /* the memory is insufficient to continue the non regression test */
317 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
318 return;
319 }
320
321 ((T_MMI_VM_RECORD_CON *)p_message)->recorded_size =
322 ((T_L1_VM_RECORD_CON *)(msg->SigP))->recorded_size;
323
324 break;
325 }
326 #endif
327 #if (L1_PCM_EXTRACTION)
328 case MMI_PCM_UPLOAD_STOP_CON:
329 {
330 /* Translate the l1 message into the Riviera compliant message */
331
332 /* Allocate the Riviera buffer */
333 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_external,
334 sizeof (T_MMI_PCM_UPLOAD_STOP_CON),
335 (T_RVF_BUFFER **) (&p_message));
336
337 /* If insufficient resources, then report a memory error and abort. */
338 if (mb_status == RVF_RED)
339 {
340 /* the memory is insufficient to continue the non regression test */
341 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
342 return;
343 }
344
345 ((T_MMI_PCM_UPLOAD_STOP_CON *)p_message)->uploaded_size =
346 ((T_L1_PCM_UPLOAD_STOP_CON *)(msg->SigP))->uploaded_size;
347
348 break;
349 }
350 #endif /* L1_PCM_EXTRACTION */
351
352 #if (SPEECH_RECO)
353 case MMI_SR_ENROLL_STOP_CON:
354 {
355 /* Translate the l1 message into the Riviera compliant message */
356
357 /* Allocate the Riviera buffer */
358 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
359 sizeof (T_MMI_SR_ENROLL_STOP_CON),
360 (T_RVF_BUFFER **) (&p_message));
361
362 /* If insufficient resources, then report a memory error and abort. */
363 if (mb_status == RVF_RED)
364 {
365 /* the memory is insufficient to continue the non regression test */
366 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
367 return;
368 }
369
370 /* Fill the message parameter */
371 ((T_MMI_SR_ENROLL_STOP_CON *)(p_message))->error_id =
372 ((T_L1_SR_ENROLL_STOP_CON *)(msg->SigP))->error_id;
373
374 break;
375 }
376 case MMI_SR_UPDATE_STOP_CON:
377 {
378 /* Translate the l1 message into the Riviera compliant message */
379
380 /* Allocate the Riviera buffer */
381 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
382 sizeof (T_MMI_SR_UPDATE_STOP_CON),
383 (T_RVF_BUFFER **) (&p_message));
384
385 /* If insufficient resources, then report a memory error and abort. */
386 if (mb_status == RVF_RED)
387 {
388 /* the memory is insufficient to continue the non regression test */
389 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
390 return;
391 }
392
393 /* Fill the message parameter */
394 ((T_MMI_SR_UPDATE_STOP_CON *)(p_message))->error_id =
395 ((T_L1_SR_UPDATE_STOP_CON *)(msg->SigP))->error_id;
396
397 break;
398 }
399 case MMI_SR_RECO_STOP_CON:
400 {
401 /* Translate the l1 message into the Riviera compliant message */
402
403 /* Allocate the Riviera buffer */
404 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
405 sizeof (T_MMI_SR_RECO_STOP_CON),
406 (T_RVF_BUFFER **) (&p_message));
407
408 /* If insufficient resources, then report a memory error and abort. */
409 if (mb_status == RVF_RED)
410 {
411 /* the memory is insufficient to continue the non regression test */
412 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
413 return;
414 }
415
416 /* Fill the message parameter */
417 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->error_id =
418 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->error_id;
419 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->best_word_index =
420 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->best_word_index;
421 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->best_word_score =
422 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->best_word_score;
423 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->second_best_word_index =
424 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->second_best_word_index;
425 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->second_best_word_score =
426 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->second_best_word_score;
427 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->third_best_word_index =
428 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->third_best_word_index;
429 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->third_best_word_score =
430 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->third_best_word_score;
431 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->fourth_best_word_index =
432 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->fourth_best_word_index;
433 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->fourth_best_word_score =
434 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->fourth_best_word_score;
435 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->d_sr_model_size =
436 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->d_sr_model_size;
437 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->d_sr_db_level =
438 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->d_sr_db_level;
439 ((T_MMI_SR_RECO_STOP_CON *)(p_message))->d_sr_db_noise =
440 ((T_L1_SR_RECO_STOP_IND *)(msg->SigP))->d_sr_db_noise;
441
442 break;
443 }
444
445 case MMI_SR_UPDATE_CHECK_STOP_CON:
446 {
447 /* Translate the l1 message into the Riviera compliant message */
448
449 /* Allocate the Riviera buffer */
450 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
451 sizeof (T_MMI_SR_UPDATE_CHECK_STOP_CON),
452 (T_RVF_BUFFER **) (&p_message));
453
454 /* If insufficient resources, then report a memory error and abort. */
455 if (mb_status == RVF_RED)
456 {
457 /* the memory is insufficient to continue the non regression test */
458 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
459 return;
460 }
461
462 /* Fill the message parameter */
463 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->error_id =
464 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->error_id;
465 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->best_word_index =
466 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->best_word_index;
467 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->best_word_score =
468 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->best_word_score;
469 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->second_best_word_index =
470 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->second_best_word_index;
471 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->second_best_word_score =
472 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->second_best_word_score;
473 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->third_best_word_index =
474 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->third_best_word_index;
475 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->third_best_word_score =
476 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->third_best_word_score;
477 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->fourth_best_word_index =
478 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->fourth_best_word_index;
479 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->fourth_best_word_score =
480 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->fourth_best_word_score;
481 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->d_sr_model_size =
482 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->d_sr_model_size;
483 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->d_sr_db_level =
484 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->d_sr_db_level;
485 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(p_message))->d_sr_db_noise =
486 ((T_MMI_SR_UPDATE_CHECK_STOP_CON *)(msg->SigP))->d_sr_db_noise;
487
488 break;
489 }
490
491 #endif /* SPEECH_RECO */
492
493
494 #if (L1_CPORT == 1)
495 case MMI_CPORT_CONFIGURE_CON:
496 {
497 /* Translate the l1 message into the Riviera compliant message */
498 /* Allocate the Riviera buffer */
499 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_external,
500 sizeof (T_MMI_CPORT_CONFIGURE_CON),
501 (T_RVF_BUFFER **) (&p_message));
502
503 /* If insufficient resources, then report a memory error and abort. */
504 if (mb_status == RVF_RED)
505 {
506 /* the memory is insufficient to continue the non regression test */
507 AUDIO_SEND_TRACE("AUDIO entity has no memory for MMI_CPORT_CONFIGURE_CON",RV_TRACE_LEVEL_ERROR);
508 return;
509 }
510
511 // recorded size includes the end mask
512 ((T_MMI_CPORT_CONFIGURE_CON *)p_message)->register_id = ((T_L1_CPORT_CONFIGURE_CON *)(msg->SigP))->register_id;
513 ((T_MMI_CPORT_CONFIGURE_CON *)p_message)->register_value = ((T_L1_CPORT_CONFIGURE_CON *)(msg->SigP))->register_value;
514 }
515 break;
516 #endif
517
518 #if(L1_ANR == 2)
519 case MMI_AQI_ANR_CON:
520 {
521 /* Translate the l1 message into the Riviera compliant message */
522 /* Allocate the Riviera buffer */
523 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_external,
524 sizeof (T_MMI_AQI_ANR_CON),
525 (T_RVF_BUFFER **) (&p_message));
526
527 /* If insufficient resources, then report a memory error and abort. */
528 if (mb_status == RVF_RED)
529 {
530 /* the memory is insufficient to continue the non regression test */
531 AUDIO_SEND_TRACE("AUDIO entity has no memory for MMI_AQI_ANR_CON",RV_TRACE_LEVEL_ERROR);
532 return;
533 }
534
535 // recorded size includes the end mask
536 ((T_MMI_AQI_ANR_CON *)p_message)->anr_ul_action = ((T_L1_AQI_ANR_CON *)(msg->SigP))->anr_ul_action;
537 }
538 break;
539 #endif
540
541 #if(L1_IIR == 2)
542 case MMI_AQI_IIR_DL_CON:
543 {
544 /* Translate the l1 message into the Riviera compliant message */
545 /* Allocate the Riviera buffer */
546 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_external,
547 sizeof (T_MMI_AQI_IIR_DL_CON),
548 (T_RVF_BUFFER **) (&p_message));
549
550 /* If insufficient resources, then report a memory error and abort. */
551 if (mb_status == RVF_RED)
552 {
553 /* the memory is insufficient to continue the non regression test */
554 AUDIO_SEND_TRACE("AUDIO entity has no memory for MMI_AQI_IIR_DL_CON",RV_TRACE_LEVEL_ERROR);
555 return;
556 }
557
558 // recorded size includes the end mask
559 ((T_MMI_AQI_IIR_DL_CON *)p_message)->iir_dl_action = ((T_L1_AQI_IIR_DL_CON *)(msg->SigP))->iir_dl_action;
560 }
561 break;
562 #endif
563
564 #if(L1_AGC_UL == 1)
565 case MMI_AQI_AGC_UL_CON:
566 {
567 /* Translate the l1 message into the Riviera compliant message */
568 /* Allocate the Riviera buffer */
569 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_external,
570 sizeof (T_MMI_AQI_AGC_UL_CON),
571 (T_RVF_BUFFER **) (&p_message));
572
573 /* If insufficient resources, then report a memory error and abort. */
574 if (mb_status == RVF_RED)
575 {
576 /* the memory is insufficient to continue the non regression test */
577 AUDIO_SEND_TRACE("AUDIO entity has no memory for MMI_AQI_AGC_UL_CON",RV_TRACE_LEVEL_ERROR);
578 return;
579 }
580
581 // recorded size includes the end mask
582 ((T_MMI_AQI_AGC_UL_CON *)p_message)->agc_ul_action = ((T_L1_AQI_AGC_UL_CON *)(msg->SigP))->agc_ul_action;
583 }
584 break;
585 #endif
586
587 #if(L1_AGC_DL == 1)
588 case MMI_AQI_AGC_DL_CON:
589 {
590 /* Translate the l1 message into the Riviera compliant message */
591 /* Allocate the Riviera buffer */
592 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_external,
593 sizeof (T_MMI_AQI_AGC_DL_CON),
594 (T_RVF_BUFFER **) (&p_message));
595
596 /* If insufficient resources, then report a memory error and abort. */
597 if (mb_status == RVF_RED)
598 {
599 /* the memory is insufficient to continue the non regression test */
600 AUDIO_SEND_TRACE("AUDIO entity has no memory for MMI_AQI_AGC_DL_CON",RV_TRACE_LEVEL_ERROR);
601 return;
602 }
603
604 // recorded size includes the end mask
605 ((T_MMI_AQI_AGC_DL_CON *)p_message)->agc_dl_action = ((T_L1_AQI_AGC_DL_CON *)(msg->SigP))->agc_dl_action;
606 }
607 break;
608 #endif
609
610 #if(L1_WCM == 1)
611 case MMI_AQI_WCM_CON:
612 {
613 /* Translate the l1 message into the Riviera compliant message */
614 /* Allocate the Riviera buffer */
615 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_external,
616 sizeof (T_MMI_AQI_WCM_CON),
617 (T_RVF_BUFFER **) (&p_message));
618
619 /* If insufficient resources, then report a memory error and abort. */
620 if (mb_status == RVF_RED)
621 {
622 /* the memory is insufficient to continue the non regression test */
623 AUDIO_SEND_TRACE("AUDIO entity has no memory for MMI_AQI_WCM_CON",RV_TRACE_LEVEL_ERROR);
624 return;
625 }
626
627 // recorded size includes the end mask
628 ((T_MMI_AQI_WCM_CON *)p_message)->wcm_action = ((T_L1_AQI_WCM_CON *)(msg->SigP))->wcm_action;
629 }
630 break;
631 #endif
632
633
634 #if(L1_DRC == 1)
635 case MMI_AQI_DRC_CON:
636 {
637 /* Translate the l1 message into the Riviera compliant message */
638 /* Allocate the Riviera buffer */
639 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_external,
640 sizeof (T_MMI_AQI_DRC_CON),
641 (T_RVF_BUFFER **) (&p_message));
642
643 /* If insufficient resources, then report a memory error and abort. */
644 if (mb_status == RVF_RED)
645 {
646 /* the memory is insufficient to continue the non regression test */
647 AUDIO_SEND_TRACE("AUDIO entity has no memory for MMI_AQI_DRC_CON",RV_TRACE_LEVEL_ERROR);
648 return;
649 }
650
651 // recorded size includes the end mask
652 ((T_MMI_AQI_DRC_CON *)p_message)->drc_dl_action = ((T_L1_AQI_DRC_CON *)(msg->SigP))->drc_dl_action;
653 }
654 break;
655 #endif
656
657 #if(L1_AEC == 2)
658 case MMI_AQI_AEC_CON:
659 {
660 /* Translate the l1 message into the Riviera compliant message */
661 /* Allocate the Riviera buffer */
662 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_external,
663 sizeof (T_MMI_AQI_AEC_CON),
664 (T_RVF_BUFFER **) (&p_message));
665
666 /* If insufficient resources, then report a memory error and abort. */
667 if (mb_status == RVF_RED)
668 {
669 /* the memory is insufficient to continue the non regression test */
670 AUDIO_SEND_TRACE("AUDIO entity has no memory for MMI_AQI_AEC_CON",RV_TRACE_LEVEL_ERROR);
671 return;
672 }
673
674 // recorded size includes the end mask
675 ((T_MMI_AQI_AEC_CON *)p_message)->aec_action = ((T_L1_AQI_AEC_CON *)(msg->SigP))->aec_action;
676 }
677 break;
678 #endif
679
680
681 default:
682 {
683 AUDIO_SEND_TRACE("AUDIO entity: wrong L1 confirmation message",RV_TRACE_LEVEL_ERROR);
684 break;
685 }
686 }
687
688 /* Fill the message ID */
689 ((T_RV_HDR *)p_message)->msg_id = SignalCode;
690 /* send the messsage to the audio entity */
691 rvf_send_msg (p_audio_gbl_var->addrId,
692 p_message);
693
694 #else // OP_RIV_AUDIO
695
696 // Set flag to avoid the FREE(msg) in L1ASYNC.
697 l1a.l1_msg_forwarded = TRUE;
698
699 msg->SignalCode = SignalCode;
700
701 #if (TRACE_TYPE==1) || (TRACE_TYPE==4)
702 l1_trace_message(msg);
703 #endif
704
705 os_send_sig(msg, queue);
706 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
707
708 #endif // OP_RIV_AUDIO
709 }
710
711 #if (SPEECH_RECO)
712 /*-------------------------------------------------------*/
713 /* l1_send_sr_background_msg() */
714 /*-------------------------------------------------------*/
715 /* */
716 /* Parameters : Signal Code ofthe message */
717 /* */
718 /* Return : */
719 /* */
720 /* Description : Send a message to the SR background */
721 /* task. */
722 /* */
723 /*-------------------------------------------------------*/
724 void l1_send_sr_background_msg(UWORD32 SignalCode)
725 {
726 #if (OP_RIV_AUDIO == 1)
727 void *p_message;
728 T_RVF_MB_STATUS mb_status; //omaps00090550
729 #else
730 xSignalHeaderRec *msg;
731 #endif
732
733 switch (SignalCode)
734 {
735 case L1_SRBACK_SAVE_DATA_REQ:
736 {
737 // Allocate the partition
738 #if (OP_RIV_AUDIO == 1)
739 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
740 sizeof (T_L1_SRBACK_SAVE_DATA_REQ),
741 (T_RVF_BUFFER **) (&p_message));
742
743 /* If insufficient resources, then report a memory error and abort. */
744 if (mb_status == RVF_RED)
745 {
746 /* the memory is insufficient to continue the non regression test */
747 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
748 return;
749 }
750 #else // OP_RIV_AUDIO
751 msg = os_alloc_sig(sizeof(T_L1_SRBACK_SAVE_DATA_REQ));
752 DEBUGMSG(status,NU_ALLOC_ERR)
753 #endif // OP_RIV_AUDIO
754
755 // Fill the message
756 ((T_L1_SRBACK_SAVE_DATA_REQ *)(AUDIO_MSG))->database_id = l1a_l1s_com.speechreco_task.parameters.database_id;
757 ((T_L1_SRBACK_SAVE_DATA_REQ *)(AUDIO_MSG))->model_index = l1a_l1s_com.speechreco_task.parameters.word_index;
758 ((T_L1_SRBACK_SAVE_DATA_REQ *)(AUDIO_MSG))->model_RAM_address = l1a_l1s_com.speechreco_task.parameters.model_address;
759 ((T_L1_SRBACK_SAVE_DATA_REQ *)(AUDIO_MSG))->speech = l1a_l1s_com.speechreco_task.parameters.speech;
760 ((T_L1_SRBACK_SAVE_DATA_REQ *)(AUDIO_MSG))->start_buffer = l1a_l1s_com.speechreco_task.parameters.speech_address;
761 ((T_L1_SRBACK_SAVE_DATA_REQ *)(AUDIO_MSG))->stop_buffer = l1a_l1s_com.speechreco_task.parameters.speech_address + SC_SR_MMI_2_L1_SPEECH_SIZE;
762 ((T_L1_SRBACK_SAVE_DATA_REQ *)(AUDIO_MSG))->start_address = l1a_l1s_com.speechreco_task.parameters.start_address;
763 ((T_L1_SRBACK_SAVE_DATA_REQ *)(AUDIO_MSG))->stop_address = l1a_l1s_com.speechreco_task.parameters.stop_address;
764 }
765 break;
766
767 case L1_SRBACK_LOAD_MODEL_REQ:
768 {
769 // Allocate the partition
770 #if (OP_RIV_AUDIO == 1)
771 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
772 sizeof (T_L1_SRBACK_LOAD_MODEL_REQ),
773 (T_RVF_BUFFER **) (&p_message));
774
775 /* If insufficient resources, then report a memory error and abort. */
776 if (mb_status == RVF_RED)
777 {
778 /* the memory is insufficient to continue the non regression test */
779 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
780 return;
781 }
782 #else // OP_RIV_AUDIO
783 msg = os_alloc_sig(sizeof(T_L1_SRBACK_LOAD_MODEL_REQ));
784 DEBUGMSG(status,NU_ALLOC_ERR)
785 #endif // OP_RIV_AUDIO
786
787 // Fill the message
788 ((T_L1_SRBACK_LOAD_MODEL_REQ *)(AUDIO_MSG))->database_id = l1a_l1s_com.speechreco_task.parameters.database_id;
789 ((T_L1_SRBACK_LOAD_MODEL_REQ *)(AUDIO_MSG))->model_index = l1a_l1s_com.speechreco_task.parameters.word_index;
790 ((T_L1_SRBACK_LOAD_MODEL_REQ *)(AUDIO_MSG))->model_RAM_address = l1a_l1s_com.speechreco_task.parameters.model_address;
791 ((T_L1_SRBACK_LOAD_MODEL_REQ *)(AUDIO_MSG))->CTO_enable = l1a_l1s_com.speechreco_task.parameters.CTO_algorithm;
792 }
793 break;
794
795 case L1_SRBACK_TEMP_SAVE_DATA_REQ:
796 {
797 // Allocate the partition
798 #if (OP_RIV_AUDIO == 1)
799 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
800 sizeof (T_L1_SRBACK_TEMP_SAVE_DATA_REQ),
801 (T_RVF_BUFFER **) (&p_message));
802
803 /* If insufficient resources, then report a memory error and abort. */
804 if (mb_status == RVF_RED)
805 {
806 /* the memory is insufficient to continue the non regression test */
807 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
808 return;
809 }
810 #else // OP_RIV_AUDIO
811 msg = os_alloc_sig(sizeof(T_L1_SRBACK_TEMP_SAVE_DATA_REQ));
812 DEBUGMSG(status,NU_ALLOC_ERR)
813 #endif // OP_RIV_AUDIO
814
815 // Fill the message
816 ((T_L1_SRBACK_TEMP_SAVE_DATA_REQ *)(AUDIO_MSG))->model_RAM_address_input = l1a_l1s_com.speechreco_task.parameters.model_address;
817 ((T_L1_SRBACK_TEMP_SAVE_DATA_REQ *)(AUDIO_MSG))->model_RAM_address_output = l1a_l1s_com.speechreco_task.parameters.model_temp_address;
818 }
819 break;
820 }
821
822 #if (OP_RIV_AUDIO == 1)
823 /* fill the message id */
824 ((T_RV_HDR *)p_message)->msg_id = SignalCode;
825
826 /* send the messsage to the audio entity */
827 rvf_send_msg (p_audio_gbl_var->addrId,
828 p_message);
829 #else // OP_RIV_AUDIO
830 msg->SignalCode = SignalCode;
831
832 #if (TRACE_TYPE==1) || (TRACE_TYPE==4)
833 l1_trace_message(msg);
834 #endif
835
836 os_send_sig(msg, SRBACK_QUEUE);
837 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
838 #endif // OP_RIV_AUDIO
839 }
840 #endif
841 #if (MELODY_E2)
842 /*-------------------------------------------------------*/
843 /* l1_send_melody_e2_background_msg() */
844 /*-------------------------------------------------------*/
845 /* */
846 /* Parameters : Signal Code of the message */
847 /* melody ID (0 or 1) */
848 /* */
849 /* Return : */
850 /* */
851 /* Description : Send a message to the audio background */
852 /* for the melody E2 feature. */
853 /* */
854 /*-------------------------------------------------------*/
855 void l1_send_melody_e2_background_msg(UWORD32 SignalCode, UWORD8 melody_id)
856 {
857 #if (OP_RIV_AUDIO == 1)
858 void *p_message;
859 T_RVF_MB_STATUS mb_status; //omaps00090550
860 #else
861 xSignalHeaderRec *msg;
862 #endif
863
864 UWORD8 i;
865
866 if ( SignalCode == L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ )
867 {
868 // Allocate the partition
869 #if (OP_RIV_AUDIO == 1)
870 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
871 sizeof (T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ),
872 (T_RVF_BUFFER **) (&p_message));
873
874 /* If insufficient resources, then report a memory error and abort. */
875 if (mb_status == RVF_RED)
876 {
877 /* the memory is insufficient to continue the non regression test */
878 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
879 return;
880 }
881 #else // OP_RIV_AUDIO
882 msg = os_alloc_sig(sizeof(T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ));
883 DEBUGMSG(status,NU_ALLOC_ERR)
884 #endif // OP_RIV_AUDIO
885
886 ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ *)(AUDIO_MSG))->melody_id =
887 melody_id;
888
889 if (melody_id == 0)
890 {
891 // Load instrument for the melody 0
892 // Fill the message
893 ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ *)(AUDIO_MSG))->number_of_instrument =
894 l1a_l1s_com.melody0_e2_task.parameters.number_of_instrument;
895 for(i=0; i<SC_AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT; i++)
896 {
897 ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ *)(AUDIO_MSG))->waves_table_id[i] =
898 l1a_l1s_com.melody0_e2_task.parameters.waves_table_id[i];
899 }
900 }
901 if (melody_id == 1)
902 {
903 // Load instrument for the melody 1
904 // Fill the message
905 ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ *)(AUDIO_MSG))->number_of_instrument =
906 l1a_l1s_com.melody1_e2_task.parameters.number_of_instrument;
907 for(i=0; i<SC_AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT; i++)
908 {
909 ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ *)(AUDIO_MSG))->waves_table_id[i] =
910 l1a_l1s_com.melody1_e2_task.parameters.waves_table_id[i];
911 }
912 }
913 }
914 else
915 if (SignalCode == L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ)
916 {
917 // Allocate the partition
918 #if (OP_RIV_AUDIO == 1)
919 mb_status = rvf_get_buf ( p_audio_gbl_var->mb_internal,
920 sizeof (T_L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ),
921 (T_RVF_BUFFER **) (&p_message));
922
923 /* If insufficient resources, then report a memory error and abort. */
924 if (mb_status == RVF_RED)
925 {
926 /* the memory is insufficient to continue the non regression test */
927 AUDIO_SEND_TRACE("AUDIO entity has no memory for L1 confirm",RV_TRACE_LEVEL_ERROR);
928 return;
929 }
930 #else // OP_RIV_AUDIO
931 msg = os_alloc_sig(sizeof(T_L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ));
932 DEBUGMSG(status,NU_ALLOC_ERR)
933 #endif // OP_RIV_AUDIO
934
935 ((T_L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ *)(AUDIO_MSG))->melody_id =
936 melody_id;
937
938 if (melody_id == 0)
939 {
940 ((T_L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ *)(AUDIO_MSG))->number_of_instrument =
941 l1a_l1s_com.melody0_e2_task.parameters.number_of_instrument;
942 }
943 else
944 if (melody_id == 1)
945 {
946 ((T_L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ *)(AUDIO_MSG))->number_of_instrument =
947 l1a_l1s_com.melody1_e2_task.parameters.number_of_instrument;
948 }
949 }
950
951 #if (OP_RIV_AUDIO == 1)
952 ((T_RV_HDR *)p_message)->msg_id = SignalCode;
953
954 /* send the messsage to the audio entity */
955 rvf_send_msg (p_audio_gbl_var->addrId,
956 p_message);
957 #else // OP_RIV_AUDIO
958 msg->SignalCode = SignalCode;
959
960 #if (TRACE_TYPE==1) || (TRACE_TYPE==4)
961 l1_trace_message(msg);
962 #endif
963
964 os_send_sig(msg, SRBACK_QUEUE);
965 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
966 #endif // OP_RIV_AUDIO
967 }
968 #endif // MELODY_E2
969
970 #endif // AUDIO_TASK