FreeCalypso > hg > freecalypso-citrine
comparison L1/audio_cfile/l1audio_init.c @ 14:bb29929d4b3d
l1audio_init.c: initial import of reconstructed TCS211 version
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 10 Jun 2016 06:22:47 +0000 |
parents | 75a11d740a02 |
children | 002303327705 |
comparison
equal
deleted
inserted
replaced
13:a2723de00e06 | 14:bb29929d4b3d |
---|---|
9 | 9 |
10 /************************************/ | 10 /************************************/ |
11 /* Include files... */ | 11 /* Include files... */ |
12 /************************************/ | 12 /************************************/ |
13 | 13 |
14 #include "config.h" | 14 #include "l1_macro.h" |
15 #include "l1_confg.h" | 15 #include "l1_confg.h" |
16 #include "l1_macro.h" | |
17 | 16 |
18 | 17 |
19 #include "l1_types.h" | 18 #include "l1_types.h" |
20 #include "sys_types.h" | 19 #include "sys_types.h" |
21 | 20 |
109 #if (L1_AAC == 1) | 108 #if (L1_AAC == 1) |
110 #include "l1aac_defty.h" | 109 #include "l1aac_defty.h" |
111 #endif | 110 #endif |
112 | 111 |
113 #include "l1_defty.h" | 112 #include "l1_defty.h" |
114 #include "../../gpf/inc/cust_os.h" | 113 #include "cust_os.h" |
115 #include "l1_msgty.h" | 114 #include "l1_msgty.h" |
116 #include "tpudrv.h" | 115 #include "tpudrv.h" // TPU drivers. ("eva3.lib") |
117 #include "l1_varex.h" | 116 #include "l1_varex.h" |
118 #include "l1_proto.h" | 117 #include "l1_proto.h" |
119 #include "l1_mftab.h" | 118 #include "l1_mftab.h" |
120 #include "l1_tabs.h" | 119 #include "l1_tabs.h" |
121 #include "../../bsp/mem.h" | 120 #include "mem.h" |
122 #include "../../bsp/armio.h" | 121 #include "armio.h" |
123 #include "../../bsp/timer.h" | 122 #include "timer.h" |
124 #include "../../bsp/timer1.h" | 123 #include "timer1.h" |
125 #include "../../bsp/dma.h" | 124 #include "dma.h" |
126 #include "../../bsp/inth.h" | 125 #include "inth.h" |
127 #include "../../bsp/ulpd.h" | 126 #include "ulpd.h" |
128 #include "../../bsp/rhea_arm.h" | 127 #include "rhea_arm.h" |
129 #include "../../bsp/clkm.h" | 128 #include "clkm.h" // Clockm ("eva3.lib") |
130 #include "l1_ctl.h" | 129 #include "l1_ctl.h" |
131 #include "l1_time.h" | 130 #include "l1_time.h" |
132 | 131 |
133 #if L2_L3_SIMUL | 132 #if L2_L3_SIMUL |
134 #include "l1_scen.h" | 133 #include "l1_scen.h" |
139 extern T_DRC_MCU_DSP *drc_ndb; | 138 extern T_DRC_MCU_DSP *drc_ndb; |
140 #if (CODE_VERSION == SIMULATION) | 139 #if (CODE_VERSION == SIMULATION) |
141 extern T_DRC_MCU_DSP drc_ndb_sim; | 140 extern T_DRC_MCU_DSP drc_ndb_sim; |
142 #endif | 141 #endif |
143 #endif | 142 #endif |
143 | |
144 #if(L1_BT_AUDIO ==1) | 144 #if(L1_BT_AUDIO ==1) |
145 extern T_L1_BT_AUDIO bt_audio; | 145 extern T_L1_BT_AUDIO bt_audio; |
146 #endif | |
147 | |
148 /* | |
149 * FreeCalypso hack: the version of l1_confg.h in the Leonardo semi-src | |
150 * sets AUDIO_TASK to 1 unconditionally, thus it appears that by the | |
151 * time TCS211 came around, TI stopped supporting and testing the | |
152 * sans-AUDIO_TASK configuration. We do wish to support it in FreeCalypso | |
153 * though. Attempting to compile this module w/o AUDIO_TASK failed | |
154 * because some preprocessor constant definitions were missing. | |
155 * All 3 offending constants are defined in l1audio_const.h, but only | |
156 * when AUDIO_TASK is enabled. The following hack is our workaround. | |
157 */ | |
158 #if !AUDIO_TASK | |
159 #define C_BGD_RECOGN 5 | |
160 #define C_BGD_ALIGN 6 | |
161 #define NO_MELODY_SELECTED (0) | |
162 #endif | 146 #endif |
163 | 147 |
164 /**************************************/ | 148 /**************************************/ |
165 /* Prototypes for L1 initialization */ | 149 /* Prototypes for L1 initialization */ |
166 /**************************************/ | 150 /**************************************/ |
184 /* */ | 168 /* */ |
185 /*-------------------------------------------------------*/ | 169 /*-------------------------------------------------------*/ |
186 void l1audio_dsp_init(void) | 170 void l1audio_dsp_init(void) |
187 { | 171 { |
188 UWORD8 i, j; | 172 UWORD8 i, j; |
173 | |
174 //----------------------------------- | |
175 // AUDIO control words initialization | |
176 //----------------------------------- | |
177 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init = 0; // MCU/DSP audio task com. register | |
178 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_status = 0; // MCU/DSP audio task com. register | |
189 | 179 |
190 #if (KEYBEEP) | 180 #if (KEYBEEP) |
191 l1s_dsp_com.dsp_ndb_ptr->d_k_x1_kt0 = 0; // keybeep variable | 181 l1s_dsp_com.dsp_ndb_ptr->d_k_x1_kt0 = 0; // keybeep variable |
192 l1s_dsp_com.dsp_ndb_ptr->d_k_x1_kt1 = 0; // keybeep variable | 182 l1s_dsp_com.dsp_ndb_ptr->d_k_x1_kt1 = 0; // keybeep variable |
193 l1s_dsp_com.dsp_ndb_ptr->d_dur_kb = 0; // keybeep variable | 183 l1s_dsp_com.dsp_ndb_ptr->d_dur_kb = 0; // keybeep variable |
346 for (i=0; i<(SC_AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT); i++) | 336 for (i=0; i<(SC_AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT); i++) |
347 { | 337 { |
348 l1s_dsp_com.dsp_ndb_ptr->a_melody_e2_instrument_ptr[i] = 0x0000; | 338 l1s_dsp_com.dsp_ndb_ptr->a_melody_e2_instrument_ptr[i] = 0x0000; |
349 } | 339 } |
350 | 340 |
341 /* FreeCalypso: reconstructed from disassembly of TCS211 object */ | |
342 l1s_dsp_com.dsp_ndb_ptr->d_melody_e2_deltatime = 0; | |
343 | |
351 // Reset the flag to know if the DSP melody E2 task runs | 344 // Reset the flag to know if the DSP melody E2 task runs |
352 l1s.melody_e2.dsp_task = FALSE; | 345 l1s.melody_e2.dsp_task = FALSE; |
353 #endif // MELODY_E2 | 346 #endif // MELODY_E2 |
354 | 347 |
355 #if ((DSP==33) || (DSP == 34) || (DSP==35) || (DSP==36) || (DSP == 37) || (DSP == 38) || (DSP == 39)) | 348 #if ((DSP==33) || (DSP == 34) || (DSP==35) || (DSP==36) || (DSP == 37) || (DSP == 38) || (DSP == 39)) |
356 // Linked to E2 melody | 349 // Linked to E2 melody |
357 // In case of WCP, there is a WCP variable at this address | 350 // In case of WCP, there is a WCP variable at this address |
358 l1s_dsp_com.dsp_ndb_ptr->d_melody_selection = NO_MELODY_SELECTED; | 351 l1s_dsp_com.dsp_ndb_ptr->d_melody_selection = NO_MELODY_SELECTED; |
359 #endif | 352 #endif |
360 | |
361 //----------------------------------- | |
362 // AUDIO control words initialization | |
363 //----------------------------------- | |
364 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_init = 0; // MCU/DSP audio task com. register | |
365 l1s_dsp_com.dsp_ndb_ptr->d_toneskb_status = 0; // MCU/DSP audio task com. register | |
366 | 353 |
367 | 354 |
368 #if ((CHIPSET == 4) || (CHIPSET == 12) || (CHIPSET == 15) || ((CHIPSET==10) && (OP_WCP==1))) && ((DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39)) | 355 #if ((CHIPSET == 4) || (CHIPSET == 12) || (CHIPSET == 15) || ((CHIPSET==10) && (OP_WCP==1))) && ((DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39)) |
369 l1s_dsp_com.dsp_ndb_ptr->d_es_ctrl = 0; // ES control | 356 l1s_dsp_com.dsp_ndb_ptr->d_es_ctrl = 0; // ES control |
370 l1s_dsp_com.dsp_ndb_ptr->d_anr_ul_ctrl = 0; // ANR control | 357 l1s_dsp_com.dsp_ndb_ptr->d_anr_ul_ctrl = 0; // ANR control |
374 l1s_dsp_com.dsp_ndb_ptr->d_iir_dl_ctrl = 0; | 361 l1s_dsp_com.dsp_ndb_ptr->d_iir_dl_ctrl = 0; |
375 #endif | 362 #endif |
376 l1s_dsp_com.dsp_ndb_ptr->d_lim_dl_ctrl = 0; // Limiter control | 363 l1s_dsp_com.dsp_ndb_ptr->d_lim_dl_ctrl = 0; // Limiter control |
377 | 364 |
378 #endif | 365 #endif |
379 | |
380 | 366 |
381 #if (DSP == 38) || (DSP == 39) | 367 #if (DSP == 38) || (DSP == 39) |
382 | 368 |
383 //----------------------------------- | 369 //----------------------------------- |
384 // AUDIO control words initialization | 370 // AUDIO control words initialization |
406 l1s_dsp_com.dsp_ndb_ptr->d_anr_ns_level = (API) 0; | 392 l1s_dsp_com.dsp_ndb_ptr->d_anr_ns_level = (API) 0; |
407 l1s_dsp_com.dsp_ndb_ptr->d_anr_tone_ene_th = (API) 0; | 393 l1s_dsp_com.dsp_ndb_ptr->d_anr_tone_ene_th = (API) 0; |
408 l1s_dsp_com.dsp_ndb_ptr->d_anr_tone_cnt_th = (API) 0; | 394 l1s_dsp_com.dsp_ndb_ptr->d_anr_tone_cnt_th = (API) 0; |
409 #endif | 395 #endif |
410 | 396 |
411 | |
412 #if(L1_IIR == 2) | 397 #if(L1_IIR == 2) |
413 // Set IIR parameters | 398 // Set IIR parameters |
414 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_control = (API) 0; | 399 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_control = (API) 0; |
415 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_frame_size = (API) 0; | 400 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_frame_size = (API) 0; |
416 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_fir_swap = (API) 0; | 401 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_fir_swap = (API) 0; |
441 { | 426 { |
442 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_1[j] = (API) 0; | 427 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_1[j] = (API) 0; |
443 } | 428 } |
444 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_1 = (API) 0; | 429 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_1 = (API) 0; |
445 | 430 |
446 | |
447 // Set parameters for IIR part - SOS 2 | 431 // Set parameters for IIR part - SOS 2 |
448 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_2 = (API) 0; | 432 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_2 = (API) 0; |
449 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_2 = (API) 0; | 433 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_2 = (API) 0; |
450 | 434 |
451 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | 435 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) |
456 { | 440 { |
457 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_2[j] = (API) 0; | 441 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_2[j] = (API) 0; |
458 } | 442 } |
459 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_2 = (API) 0; | 443 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_2 = (API) 0; |
460 | 444 |
461 | |
462 // Set parameters for IIR part - SOS 3 | 445 // Set parameters for IIR part - SOS 3 |
463 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_3 = (API) 0; | 446 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_3 = (API) 0; |
464 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_3 = (API) 0; | 447 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_3 = (API) 0; |
465 | 448 |
466 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | 449 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) |
471 { | 454 { |
472 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_3[j] = (API) 0; | 455 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_3[j] = (API) 0; |
473 } | 456 } |
474 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_3 = (API) 0; | 457 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_3 = (API) 0; |
475 | 458 |
476 | |
477 // Set parameters for IIR part - SOS 4 | 459 // Set parameters for IIR part - SOS 4 |
478 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_4 = (API) 0; | 460 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_4 = (API) 0; |
479 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_4 = (API) 0; | 461 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_4 = (API) 0; |
480 | 462 |
481 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | 463 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) |
486 { | 468 { |
487 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_4[j] = (API) 0; | 469 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_4[j] = (API) 0; |
488 } | 470 } |
489 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_4 = (API) 0; | 471 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_4 = (API) 0; |
490 | 472 |
491 | |
492 // Set parameters for IIR part - SOS 5 | 473 // Set parameters for IIR part - SOS 5 |
493 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_5 = (API) 0; | 474 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_5 = (API) 0; |
494 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_5 = (API) 0; | 475 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_5 = (API) 0; |
495 | 476 |
496 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | 477 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) |
501 { | 482 { |
502 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_5[j] = (API) 0; | 483 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_5[j] = (API) 0; |
503 } | 484 } |
504 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_5 = (API) 0; | 485 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_5 = (API) 0; |
505 | 486 |
506 | |
507 // Set parameters for IIR part - SOS 6 | 487 // Set parameters for IIR part - SOS 6 |
508 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_6 = (API) 0; | 488 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_6 = (API) 0; |
509 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_6 = (API) 0; | 489 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_6 = (API) 0; |
510 | 490 |
511 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | 491 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) |
515 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++) | 495 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++) |
516 { | 496 { |
517 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_6[j] = (API) 0; | 497 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_6[j] = (API) 0; |
518 } | 498 } |
519 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_6 = (API) 0; | 499 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_6 = (API) 0; |
520 | |
521 | 500 |
522 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_gain = (API) 0; | 501 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_gain = (API) 0; |
523 | 502 |
524 #endif | 503 #endif |
525 | 504 |
591 } | 570 } |
592 | 571 |
593 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) | 572 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) |
594 l1a_l1s_com.audio_onoff_task.parameters.onoff_value = FALSE; | 573 l1a_l1s_com.audio_onoff_task.parameters.onoff_value = FALSE; |
595 #endif | 574 #endif |
596 l1a_l1s_com.audio_forced_by_l1s = FALSE; | 575 #if 0 /* FreeCalypso TCS211 reconstruction */ |
576 l1a_l1s_com.audio_forced_by_l1s = FALSE; | |
577 #endif | |
597 | 578 |
598 #if (MELODY_E1) | 579 #if (MELODY_E1) |
599 l1s.melody0.oscillator[0] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note0[0]); | 580 l1s.melody0.oscillator[0] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note0[0]); |
600 l1s.melody0.oscillator[1] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note1[0]); | 581 l1s.melody0.oscillator[1] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note1[0]); |
601 l1s.melody0.oscillator[2] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note2[0]); | 582 l1s.melody0.oscillator[2] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note2[0]); |
697 { | 678 { |
698 drc_ndb->a_drc_mid_band_filter[j] = (API)0; | 679 drc_ndb->a_drc_mid_band_filter[j] = (API)0; |
699 } | 680 } |
700 #endif | 681 #endif |
701 | 682 |
702 l1a_l1s_com.outen_cfg_task.outen1 = | |
703 l1a_l1s_com.outen_cfg_task.outen2 = | |
704 l1a_l1s_com.outen_cfg_task.outen3 = | |
705 l1a_l1s_com.outen_cfg_task.command_requested = | |
706 l1a_l1s_com.outen_cfg_task.command_commited = 0; | |
707 //voice and stereo path configuration for L1 standalone mode CQ- OMAPS00088143 | |
708 #if (OP_L1_STANDALONE == 1) | |
709 // Voice path and Stereo path | |
710 l1a_l1s_com.outen_cfg_task.outen3 = 0; | |
711 l1a_l1s_com.outen_cfg_task.outen2 = 0x03; | |
712 l1a_l1s_com.outen_cfg_task.outen1 = 0; | |
713 #endif | |
714 #if(L1_BT_AUDIO ==1) | |
715 bt_audio.pcm_data_pending = 0; | |
716 bt_audio.pcm_data_end = 0; | |
717 bt_audio.pcm_data_ready = 0; | |
718 bt_audio.pcm_data_failed = 0; | |
719 bt_audio.connected_status = FALSE; | |
720 #endif | |
721 } | 683 } |
722 | 684 |
723 #endif // AUDIO_TASK | 685 #endif // AUDIO_TASK |