FreeCalypso > hg > freecalypso-citrine
comparison L1/audio_cfile/l1audio_init.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children | bb29929d4b3d |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /************* Revision Controle System Header ************* | |
2 * GSM Layer 1 software | |
3 * L1AUDIO_INIT.C | |
4 * | |
5 * Filename l1audio_init.c | |
6 * Copyright 2003 (C) Texas Instruments | |
7 * | |
8 ************* Revision Controle System Header *************/ | |
9 | |
10 /************************************/ | |
11 /* Include files... */ | |
12 /************************************/ | |
13 | |
14 #include "config.h" | |
15 #include "l1_confg.h" | |
16 #include "l1_macro.h" | |
17 | |
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_defty.h" | |
40 #include "l1audio_msgty.h" | |
41 #include "l1audio_varex.h" | |
42 | |
43 #if (L1_GTT == 1) | |
44 #include "l1gtt_const.h" | |
45 #include "l1gtt_defty.h" | |
46 #endif | |
47 //added here 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 here from e-sample for AAC | |
60 #if (L1_AAC == 1) | |
61 #include "l1aac_defty.h" | |
62 #endif | |
63 #include "l1_defty.h" | |
64 #include "cust_os.h" | |
65 #include "l1_msgty.h" | |
66 #include "l1_varex.h" | |
67 #include "l1_mftab.h" | |
68 #include "l1_tabs.h" | |
69 #include "l1_ctl.h" | |
70 | |
71 #include "l1_time.h" | |
72 #include "l1_scen.h" | |
73 #else // NOT SIMULATION | |
74 | |
75 // Layer1 and debug include files. | |
76 #include <ctype.h> | |
77 #include <math.h> | |
78 #include "l1_ver.h" | |
79 #include "l1_const.h" | |
80 #include "l1_signa.h" | |
81 | |
82 #if TESTMODE | |
83 #include "l1tm_defty.h" | |
84 #endif | |
85 | |
86 #include "l1audio_const.h" | |
87 #include "l1audio_cust.h" | |
88 #include "l1audio_defty.h" | |
89 #include "l1audio_msgty.h" | |
90 #include "l1audio_varex.h" | |
91 | |
92 #if (L1_GTT == 1) | |
93 #include "l1gtt_const.h" | |
94 #include "l1gtt_defty.h" | |
95 #endif | |
96 //added here from e-sample for AAC | |
97 #if (L1_DYN_DSP_DWNLD == 1) | |
98 #include "l1_dyn_dwl_const.h" | |
99 #include "l1_dyn_dwl_defty.h" | |
100 #endif | |
101 #if (L1_MP3 == 1) | |
102 #include "l1mp3_defty.h" | |
103 #endif | |
104 | |
105 #if (L1_MIDI == 1) | |
106 #include "l1midi_defty.h" | |
107 #endif | |
108 //added here from e-sample for AAC | |
109 #if (L1_AAC == 1) | |
110 #include "l1aac_defty.h" | |
111 #endif | |
112 | |
113 #include "l1_defty.h" | |
114 #include "../../gpf/inc/cust_os.h" | |
115 #include "l1_msgty.h" | |
116 #include "tpudrv.h" | |
117 #include "l1_varex.h" | |
118 #include "l1_proto.h" | |
119 #include "l1_mftab.h" | |
120 #include "l1_tabs.h" | |
121 #include "../../bsp/mem.h" | |
122 #include "../../bsp/armio.h" | |
123 #include "../../bsp/timer.h" | |
124 #include "../../bsp/timer1.h" | |
125 #include "../../bsp/dma.h" | |
126 #include "../../bsp/inth.h" | |
127 #include "../../bsp/ulpd.h" | |
128 #include "../../bsp/rhea_arm.h" | |
129 #include "../../bsp/clkm.h" | |
130 #include "l1_ctl.h" | |
131 #include "l1_time.h" | |
132 | |
133 #if L2_L3_SIMUL | |
134 #include "l1_scen.h" | |
135 #endif | |
136 #endif // NOT_SIMULATION | |
137 | |
138 #if (L1_DRC == 1) | |
139 extern T_DRC_MCU_DSP *drc_ndb; | |
140 #if (CODE_VERSION == SIMULATION) | |
141 extern T_DRC_MCU_DSP drc_ndb_sim; | |
142 #endif | |
143 #endif | |
144 #if(L1_BT_AUDIO ==1) | |
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 | |
163 | |
164 /**************************************/ | |
165 /* Prototypes for L1 initialization */ | |
166 /**************************************/ | |
167 void l1audio_dsp_init (void); | |
168 void l1audio_initialize_var (void); | |
169 | |
170 /**************************************/ | |
171 /* External prototypes */ | |
172 /**************************************/ | |
173 | |
174 /*-------------------------------------------------------*/ | |
175 /* l1audio_dsp_init() */ | |
176 /*-------------------------------------------------------*/ | |
177 /* */ | |
178 /* Parameters : */ | |
179 /* */ | |
180 /* Return : */ | |
181 /* */ | |
182 /* Description : Initialize the part of the API */ | |
183 /* dedicated to the audio task. */ | |
184 /* */ | |
185 /*-------------------------------------------------------*/ | |
186 void l1audio_dsp_init(void) | |
187 { | |
188 UWORD8 i, j; | |
189 | |
190 #if (KEYBEEP) | |
191 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 | |
193 l1s_dsp_com.dsp_ndb_ptr->d_dur_kb = 0; // keybeep variable | |
194 #endif | |
195 | |
196 #if ((TONE) || (VOICE_MEMO)) | |
197 l1s_dsp_com.dsp_ndb_ptr->d_k_x1_t0 = 0; // tone variable | |
198 l1s_dsp_com.dsp_ndb_ptr->d_k_x1_t1 = 0; // tone variable | |
199 l1s_dsp_com.dsp_ndb_ptr->d_k_x1_t2 = 0; // tone variable | |
200 l1s_dsp_com.dsp_ndb_ptr->d_pe_rep = 0; // tone variable | |
201 l1s_dsp_com.dsp_ndb_ptr->d_pe_off = 0; // tone variable | |
202 l1s_dsp_com.dsp_ndb_ptr->d_se_off = 0; // tone variable | |
203 l1s_dsp_com.dsp_ndb_ptr->d_bu_off = 0; // tone variable | |
204 l1s_dsp_com.dsp_ndb_ptr->d_t0_on = 0; // tone variable | |
205 l1s_dsp_com.dsp_ndb_ptr->d_t0_off = 0; // tone variable | |
206 l1s_dsp_com.dsp_ndb_ptr->d_t1_on = 0; // tone variable | |
207 l1s_dsp_com.dsp_ndb_ptr->d_t1_off = 0; // tone variable | |
208 l1s_dsp_com.dsp_ndb_ptr->d_t2_on = 0; // tone variable | |
209 l1s_dsp_com.dsp_ndb_ptr->d_t2_off = 0; // tone variable | |
210 | |
211 l1s_dsp_com.dsp_ndb_ptr->d_shiftul = 0x100; | |
212 l1s_dsp_com.dsp_ndb_ptr->d_shiftdl = 0x100; | |
213 #endif // (TONE) || (VOICE_MEMO) | |
214 #if (L1_PCM_EXTRACTION) | |
215 l1s_dsp_com.dsp_ndb_ptr->d_pcm_api_upload = 0; | |
216 l1s_dsp_com.dsp_ndb_ptr->d_pcm_api_download = 0; | |
217 l1s_dsp_com.dsp_ndb_ptr->d_pcm_api_error = 0; | |
218 #endif | |
219 | |
220 // Correction of PR G23M/L1_MCU-SPR-15494 | |
221 #if ((CHIPSET == 12) || (CHIPSET == 15)) | |
222 #if (DSP == 35) || (DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39) | |
223 l1s_dsp_com.dsp_ndb_ptr->d_cport_init = 0; | |
224 l1s_dsp_com.dsp_ndb_ptr->d_cport_ctrl = 0; | |
225 l1s_dsp_com.dsp_ndb_ptr->a_cport_cfr[0] = 0; | |
226 l1s_dsp_com.dsp_ndb_ptr->a_cport_cfr[1] = 0; | |
227 l1s_dsp_com.dsp_ndb_ptr->d_cport_tcl_tadt = 0; | |
228 l1s_dsp_com.dsp_ndb_ptr->d_cport_tdat = 0; | |
229 l1s_dsp_com.dsp_ndb_ptr->d_cport_tvs = 0; | |
230 #endif | |
231 #endif | |
232 | |
233 #if (L1_VOICE_MEMO_AMR) | |
234 l1s_dsp_com.dsp_ndb_ptr->d_shiftul = 0x100; | |
235 #endif // L1_VOICE_MEMO_AMR | |
236 | |
237 #if (MELODY_E1) | |
238 l1s_dsp_com.dsp_ndb_ptr->d_melo_osc_used = 0; | |
239 l1s_dsp_com.dsp_ndb_ptr->d_melo_osc_active = 0; | |
240 | |
241 l1s_dsp_com.dsp_ndb_ptr->a_melo_note0[0] = SC_END_OSCILLATOR_MASK; | |
242 l1s_dsp_com.dsp_ndb_ptr->a_melo_note1[0] = SC_END_OSCILLATOR_MASK; | |
243 l1s_dsp_com.dsp_ndb_ptr->a_melo_note2[0] = SC_END_OSCILLATOR_MASK; | |
244 l1s_dsp_com.dsp_ndb_ptr->a_melo_note3[0] = SC_END_OSCILLATOR_MASK; | |
245 l1s_dsp_com.dsp_ndb_ptr->a_melo_note4[0] = SC_END_OSCILLATOR_MASK; | |
246 l1s_dsp_com.dsp_ndb_ptr->a_melo_note5[0] = SC_END_OSCILLATOR_MASK; | |
247 l1s_dsp_com.dsp_ndb_ptr->a_melo_note6[0] = SC_END_OSCILLATOR_MASK; | |
248 l1s_dsp_com.dsp_ndb_ptr->a_melo_note7[0] = SC_END_OSCILLATOR_MASK; | |
249 #endif // MELODY_E1 | |
250 | |
251 // Initialize the FIR as an all band pass | |
252 // IMPORTANT NOTE: FIR/DL parameters are also initialized for DSP 36 when L1_IIR == 1 because | |
253 // in FIR loop mode, the old FIR API is still used | |
254 #if (DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39)// The FIR coefficents are in param memory | |
255 l1s_dsp_com.dsp_param_ptr->a_fir31_downlink[0] = 0x4000; | |
256 l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[0] = 0x4000; | |
257 #else | |
258 l1s_dsp_com.dsp_ndb_ptr->a_fir31_downlink[0] = 0x4000; | |
259 l1s_dsp_com.dsp_ndb_ptr->a_fir31_uplink[0] = 0x4000; | |
260 #endif | |
261 | |
262 for (i=1; i<MAX_FIR_COEF; i++) | |
263 { | |
264 #if (DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39)// The FIR coefficents are in param memory | |
265 l1s_dsp_com.dsp_param_ptr->a_fir31_downlink[i] = 0; | |
266 l1s_dsp_com.dsp_param_ptr->a_fir31_uplink[i] = 0; | |
267 #else | |
268 l1s_dsp_com.dsp_ndb_ptr->a_fir31_downlink[i] = 0; | |
269 l1s_dsp_com.dsp_ndb_ptr->a_fir31_uplink[i] = 0; | |
270 #endif | |
271 } | |
272 #if (DSP == 17) || (DSP == 32) | |
273 // start the FIR task | |
274 l1s_dsp_com.dsp_ndb_ptr->d_audio_init |= B_FIR_START; | |
275 #endif | |
276 | |
277 #if (L1_IIR == 1) | |
278 // IIR enabled by default | |
279 // Set the default configuration (all band pass - FIR only mode) | |
280 l1s_dsp_com.dsp_ndb_ptr->d_iir_nb_iir_blocks = 0; | |
281 l1s_dsp_com.dsp_ndb_ptr->d_iir_nb_fir_coefs = 0x1f; | |
282 | |
283 l1s_dsp_com.dsp_ndb_ptr->a_iir_fir_coefs[0] = 0x4000; | |
284 for (i=1; i < (l1s_dsp_com.dsp_ndb_ptr->d_iir_nb_fir_coefs - 1); i++) | |
285 l1s_dsp_com.dsp_ndb_ptr->a_iir_fir_coefs[i] = 0; | |
286 | |
287 l1s_dsp_com.dsp_ndb_ptr->d_iir_input_scaling = 0; | |
288 l1s_dsp_com.dsp_ndb_ptr->d_iir_fir_scaling = 0; | |
289 l1s_dsp_com.dsp_ndb_ptr->d_iir_input_gain_scaling = 0; | |
290 l1s_dsp_com.dsp_ndb_ptr->d_iir_output_gain_scaling = 0; | |
291 l1s_dsp_com.dsp_ndb_ptr->d_iir_output_gain = 0xffff; | |
292 l1s_dsp_com.dsp_ndb_ptr->d_iir_feedback = 0; | |
293 #endif | |
294 | |
295 #if (AUDIO_MODE) | |
296 // Reset the FIR loopback and the audio mode | |
297 l1s_dsp_com.dsp_ndb_ptr->d_audio_init &= ~(B_FIR_LOOP | B_GSM_ONLY | B_BT_HEADSET | B_BT_CORDLESS); | |
298 // Set the GSM mode | |
299 l1s_dsp_com.dsp_ndb_ptr->d_audio_init |= B_GSM_ONLY; | |
300 #else | |
301 // Reset the loopback | |
302 l1s_dsp_com.dsp_ndb_ptr->d_audio_init &= ~(B_FIR_LOOP); | |
303 #endif | |
304 | |
305 #if (W_A_DSP_SR_BGD) | |
306 // Initialize the DSP speech reco background task | |
307 | |
308 // DSP background enabled for SR. | |
309 l1s_dsp_com.dsp_param_ptr->d_gsm_bgd_mgt = (B_DSPBGD_RECO | B_DSPBGD_UPD); | |
310 l1s_dsp_com.dsp_ndb_ptr->d_max_background = 7; | |
311 | |
312 // TEMPORARY: Init DSP background interface for RECO. | |
313 if (l1s_dsp_com.dsp_param_ptr->d_gsm_bgd_mgt & B_DSPBGD_RECO) | |
314 { | |
315 l1s_dsp_com.dsp_ndb_ptr->d_background_enable &= ~(1 << C_BGD_RECOGN); | |
316 l1s_dsp_com.dsp_ndb_ptr->d_background_abort &= ~(1 << C_BGD_RECOGN); | |
317 l1s_dsp_com.dsp_ndb_ptr->a_background_tasks[C_BGD_RECOGN] = (C_BGD_RECOGN<<11) | 1; | |
318 l1s_dsp_com.dsp_ndb_ptr->a_back_task_io[C_BGD_RECOGN] = (API)(0x0000); // Not used by Recognition task. | |
319 } | |
320 if (l1s_dsp_com.dsp_param_ptr->d_gsm_bgd_mgt & B_DSPBGD_UPD) | |
321 { | |
322 l1s_dsp_com.dsp_ndb_ptr->d_background_enable &= ~(1 << C_BGD_ALIGN); | |
323 l1s_dsp_com.dsp_ndb_ptr->d_background_abort &= ~(1 << C_BGD_ALIGN); | |
324 l1s_dsp_com.dsp_ndb_ptr->a_background_tasks[C_BGD_ALIGN] = (C_BGD_ALIGN<<11) | 1; | |
325 l1s_dsp_com.dsp_ndb_ptr->a_back_task_io[C_BGD_ALIGN] = (API)(0x0000); // Not used by Alignement task. | |
326 } | |
327 #elif (DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39) | |
328 // DSP background task through pending task queue | |
329 l1s_dsp_com.dsp_param_ptr->d_gsm_bgd_mgt = 0; | |
330 #endif | |
331 | |
332 #if (MELODY_E2) | |
333 // Initalize the Audio compressor used for E2 | |
334 l1s_dsp_com.dsp_ndb_ptr->d_audio_compressor_ctrl = 0x0401; | |
335 | |
336 // Initialize the melody E2 variables | |
337 l1s_dsp_com.dsp_ndb_ptr->d_melody_e2_osc_stop = 0x0000; | |
338 l1s_dsp_com.dsp_ndb_ptr->d_melody_e2_osc_active = 0x0000; | |
339 l1s_dsp_com.dsp_ndb_ptr->d_melody_e2_semaphore = 0x0000; | |
340 for(i=0; i<SC_MELODY_E2_NUMBER_OF_OSCILLATOR; i++) | |
341 { | |
342 l1s_dsp_com.dsp_ndb_ptr->a_melody_e2_osc[i][0] = 0x0000; | |
343 } | |
344 l1s_dsp_com.dsp_ndb_ptr->d_melody_e2_globaltimefactor = 0x0000; | |
345 | |
346 for (i=0; i<(SC_AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT); i++) | |
347 { | |
348 l1s_dsp_com.dsp_ndb_ptr->a_melody_e2_instrument_ptr[i] = 0x0000; | |
349 } | |
350 | |
351 // Reset the flag to know if the DSP melody E2 task runs | |
352 l1s.melody_e2.dsp_task = FALSE; | |
353 #endif // MELODY_E2 | |
354 | |
355 #if ((DSP==33) || (DSP == 34) || (DSP==35) || (DSP==36) || (DSP == 37) || (DSP == 38) || (DSP == 39)) | |
356 // Linked to E2 melody | |
357 // 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; | |
359 #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 | |
367 | |
368 #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 | |
370 l1s_dsp_com.dsp_ndb_ptr->d_anr_ul_ctrl = 0; // ANR control | |
371 #if (L1_IIR == 1) | |
372 l1s_dsp_com.dsp_ndb_ptr->d_iir_dl_ctrl = B_IIR_ENABLE; // IIR control: enabled by default | |
373 #else | |
374 l1s_dsp_com.dsp_ndb_ptr->d_iir_dl_ctrl = 0; | |
375 #endif | |
376 l1s_dsp_com.dsp_ndb_ptr->d_lim_dl_ctrl = 0; // Limiter control | |
377 | |
378 #endif | |
379 | |
380 | |
381 #if (DSP == 38) || (DSP == 39) | |
382 | |
383 //----------------------------------- | |
384 // AUDIO control words initialization | |
385 //----------------------------------- | |
386 | |
387 l1s_dsp_com.dsp_ndb_ptr->d_es_ctrl = 0; // ES control | |
388 l1s_dsp_com.dsp_ndb_ptr->d_anr_ul_ctrl = 0; // ANR control | |
389 l1s_dsp_com.dsp_ndb_ptr->d_aec_ul_ctrl = 0; // AEC control | |
390 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_ctrl = 0; // AGC control | |
391 | |
392 #if (L1_IIR == 1) | |
393 l1s_dsp_com.dsp_ndb_ptr->d_iir_dl_ctrl = B_IIR_ENABLE; // IIR control: enabled by default | |
394 #else | |
395 l1s_dsp_com.dsp_ndb_ptr->d_iir_dl_ctrl = 0; | |
396 #endif | |
397 l1s_dsp_com.dsp_ndb_ptr->d_lim_dl_ctrl = 0; // Limiter control | |
398 l1s_dsp_com.dsp_ndb_ptr->d_drc_dl_ctrl = 0; // DRC control | |
399 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_ctrl = 0; // AGC control | |
400 l1s_dsp_com.dsp_ndb_ptr->d_audio_apps_ctrl = 0; // WCM control | |
401 l1s_dsp_com.dsp_ndb_ptr->d_audio_apps_status = 0; // WCM status | |
402 l1s_dsp_com.dsp_ndb_ptr->d_aqi_status = 0; // Initialise the status word | |
403 | |
404 #if(L1_ANR == 2) | |
405 l1s_dsp_com.dsp_ndb_ptr->d_anr_control = (API) 0; | |
406 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; | |
408 l1s_dsp_com.dsp_ndb_ptr->d_anr_tone_cnt_th = (API) 0; | |
409 #endif | |
410 | |
411 | |
412 #if(L1_IIR == 2) | |
413 // Set IIR parameters | |
414 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_control = (API) 0; | |
415 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; | |
417 | |
418 // Set parameter os FIR part | |
419 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_fir_enable = (API) 0; | |
420 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_fir_length = (API) 0; | |
421 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_fir_shift = (API) 0; | |
422 | |
423 for (i=0; i < IIR_4X_FIR_MAX_LENGTH; i++) | |
424 { | |
425 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_fir_taps[i] = (API) 0; | |
426 } | |
427 | |
428 // Set parameters for IIR part | |
429 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_enable = (API) 0; | |
430 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_number = (API) 0; | |
431 | |
432 // Set parameters for IIR part - SOS 1 | |
433 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_1 = (API) 0; | |
434 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_1 = (API) 0; | |
435 | |
436 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | |
437 { | |
438 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_1[j] = (API) 0; | |
439 } | |
440 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++) | |
441 { | |
442 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_1[j] = (API) 0; | |
443 } | |
444 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_1 = (API) 0; | |
445 | |
446 | |
447 // Set parameters for IIR part - SOS 2 | |
448 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; | |
450 | |
451 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | |
452 { | |
453 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_2[j] = (API) 0; | |
454 } | |
455 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++) | |
456 { | |
457 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_2[j] = (API) 0; | |
458 } | |
459 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_2 = (API) 0; | |
460 | |
461 | |
462 // Set parameters for IIR part - SOS 3 | |
463 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; | |
465 | |
466 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | |
467 { | |
468 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_3[j] = (API) 0; | |
469 } | |
470 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++) | |
471 { | |
472 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_3[j] = (API) 0; | |
473 } | |
474 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_3 = (API) 0; | |
475 | |
476 | |
477 // Set parameters for IIR part - SOS 4 | |
478 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; | |
480 | |
481 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | |
482 { | |
483 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_4[j] = (API) 0; | |
484 } | |
485 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++) | |
486 { | |
487 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_4[j] = (API) 0; | |
488 } | |
489 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_4 = (API) 0; | |
490 | |
491 | |
492 // Set parameters for IIR part - SOS 5 | |
493 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; | |
495 | |
496 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | |
497 { | |
498 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_5[j] = (API) 0; | |
499 } | |
500 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++) | |
501 { | |
502 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_5[j] = (API) 0; | |
503 } | |
504 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_5 = (API) 0; | |
505 | |
506 | |
507 // Set parameters for IIR part - SOS 6 | |
508 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; | |
510 | |
511 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++) | |
512 { | |
513 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_6[j] = (API) 0; | |
514 } | |
515 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++) | |
516 { | |
517 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_6[j] = (API) 0; | |
518 } | |
519 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_6 = (API) 0; | |
520 | |
521 | |
522 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_gain = (API) 0; | |
523 | |
524 #endif | |
525 | |
526 #if(L1_AGC_UL == 1) | |
527 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_control = (API) 0; | |
528 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_frame_size = (API) 0; | |
529 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_targeted_level = (API) 0; | |
530 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_signal_up = (API) 0; | |
531 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_signal_down = (API) 0; | |
532 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_max_scale = (API) 0; | |
533 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_gain_smooth_alpha = (API) 0; | |
534 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_gain_smooth_alpha_fast = (API) 0; | |
535 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_gain_smooth_beta = (API) 0; | |
536 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_gain_smooth_beta_fast = (API) 0; | |
537 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_gain_intp_flag = (API) 0; | |
538 #endif | |
539 | |
540 #if(L1_AGC_DL == 1) | |
541 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_control = (API) 0; | |
542 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_frame_size = (API) 0; | |
543 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_targeted_level = (API) 0; | |
544 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_signal_up = (API) 0; | |
545 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_signal_down = (API) 0; | |
546 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_max_scale = (API) 0; | |
547 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_gain_smooth_alpha = (API) 0; | |
548 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_gain_smooth_alpha_fast = (API) 0; | |
549 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_gain_smooth_beta = (API) 0; | |
550 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_gain_smooth_beta_fast = (API) 0; | |
551 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_gain_intp_flag = (API) 0; | |
552 #endif | |
553 | |
554 #if(L1_WCM == 1) | |
555 | |
556 l1s_dsp_com.dsp_ndb_ptr->d_wcm_mode = (API) 0; | |
557 l1s_dsp_com.dsp_ndb_ptr->d_wcm_frame_size = (API) 0; | |
558 l1s_dsp_com.dsp_ndb_ptr->d_wcm_num_sub_frames = (API) 0; | |
559 l1s_dsp_com.dsp_ndb_ptr->d_wcm_ratio = (API) 0; | |
560 l1s_dsp_com.dsp_ndb_ptr->d_wcm_threshold = (API) 0; | |
561 #endif | |
562 | |
563 #endif // DSP 38 | |
564 | |
565 } | |
566 | |
567 | |
568 #if (AUDIO_TASK == 1) | |
569 | |
570 /*-------------------------------------------------------*/ | |
571 /* l1audio_initialize_var() */ | |
572 /*-------------------------------------------------------*/ | |
573 /* */ | |
574 /* Parameters : */ | |
575 /* */ | |
576 /* Return : */ | |
577 /* */ | |
578 /* Description : Initialize the part of l1a, l1s and */ | |
579 /* l1a_l1s_com dedicated to the audio task.*/ | |
580 /* */ | |
581 /*-------------------------------------------------------*/ | |
582 void l1audio_initialize_var(void) | |
583 { | |
584 UWORD8 i, j; | |
585 | |
586 // Initialize the state of the L1S maanger... | |
587 //-------------------------------------------- | |
588 for(i=0; i<NBR_AUDIO_MANAGER; i++) | |
589 { | |
590 l1s.audio_state[i] = 0; | |
591 } | |
592 | |
593 #if (L1_EXTERNAL_AUDIO_VOICE_ONOFF == 1) | |
594 l1a_l1s_com.audio_onoff_task.parameters.onoff_value = FALSE; | |
595 #endif | |
596 l1a_l1s_com.audio_forced_by_l1s = FALSE; | |
597 | |
598 #if (MELODY_E1) | |
599 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]); | |
601 l1s.melody0.oscillator[2] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note2[0]); | |
602 l1s.melody0.oscillator[3] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note3[0]); | |
603 l1s.melody0.oscillator[4] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note4[0]); | |
604 l1s.melody0.oscillator[5] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note5[0]); | |
605 l1s.melody0.oscillator[6] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note6[0]); | |
606 l1s.melody0.oscillator[7] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note7[0]); | |
607 | |
608 l1s.melody1.oscillator[0] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note0[0]); | |
609 l1s.melody1.oscillator[1] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note1[0]); | |
610 l1s.melody1.oscillator[2] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note2[0]); | |
611 l1s.melody1.oscillator[3] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note3[0]); | |
612 l1s.melody1.oscillator[4] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note4[0]); | |
613 l1s.melody1.oscillator[5] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note5[0]); | |
614 l1s.melody1.oscillator[6] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note6[0]); | |
615 l1s.melody1.oscillator[7] = &(l1s_dsp_com.dsp_ndb_ptr->a_melo_note7[0]); | |
616 #endif // MELODY_E1 | |
617 | |
618 #if (MELODY_E2) | |
619 // Initialization ofthe audio background melody E2 load insturment variable | |
620 audioback_melody_e2.allowed_size = | |
621 SC_AUDIO_MELODY_E2_MAX_SIZE_OF_INSTRUMENT; | |
622 audioback_melody_e2.API_address = | |
623 l1s_dsp_com.dsp_ndb_ptr->a_melody_e2_instrument_wave; | |
624 | |
625 for (i=0; i < SC_AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT; i++) | |
626 { | |
627 audioback_melody_e2.number_of_user[i] = 0; | |
628 } | |
629 #endif // MELODY_E2 | |
630 | |
631 #if (L1_STEREOPATH == 1) | |
632 // Reset the stereopath L1S commands | |
633 l1a_l1s_com.stereopath_drv_task.command.start = FALSE; | |
634 l1a_l1s_com.stereopath_drv_task.command.stop = FALSE; | |
635 #endif | |
636 | |
637 // Triton Audio ON/OFF Changes | |
638 #if (L1_AUDIO_MCU_ONOFF == 1) | |
639 l1s.audio_on_off_ctl.l1_audio_switch_on_ul_request = 0; | |
640 l1s.audio_on_off_ctl.l1_audio_switch_on_dl_request = 0; | |
641 | |
642 l1s.audio_on_off_ctl.l1_audio_ul_on2off_hold_time = | |
643 L1_AUDIO_ON2OFF_UL_HOLD_TIME; | |
644 l1s.audio_on_off_ctl.l1_audio_dl_on2off_hold_time = | |
645 L1_AUDIO_ON2OFF_DL_HOLD_TIME; | |
646 | |
647 l1s.audio_on_off_ctl.l1_audio_ul_action = L1_AUDIO_NO_ACTION; | |
648 l1s.audio_on_off_ctl.l1_audio_dl_action = L1_AUDIO_NO_ACTION; | |
649 | |
650 l1s.audio_on_off_ctl.l1_audio_ul_switched_on = FALSE; | |
651 l1s.audio_on_off_ctl.l1_audio_dl_switched_on = FALSE; | |
652 | |
653 l1s.audio_on_off_ctl.l1_audio_ul_switched_off = TRUE; | |
654 l1s.audio_on_off_ctl.l1_audio_dl_switched_off = TRUE; | |
655 #endif // L1_AUDIO_MCU_ONOFF | |
656 | |
657 | |
658 #if (L1_DRC == 1) | |
659 | |
660 // init DRC NDB | |
661 drc_ndb = (T_DRC_MCU_DSP *)API_address_dsp2mcu(C_DRC_API_BASE_ADDRESS); | |
662 #if (CODE_VERSION == SIMULATION) | |
663 { | |
664 drc_ndb = &drc_ndb_sim; | |
665 } | |
666 #endif | |
667 | |
668 drc_ndb->d_drc_speech_mode_samp_f =(API)0; | |
669 drc_ndb->d_drc_num_subbands =(API)0; | |
670 drc_ndb->d_drc_frame_len =(API)0; | |
671 drc_ndb->d_drc_expansion_knee_fb_bs =(API)0; | |
672 drc_ndb->d_drc_expansion_knee_md_hg =(API)0; | |
673 drc_ndb->d_drc_expansion_ratio_fb_bs =(API)0; | |
674 drc_ndb->d_drc_expansion_ratio_md_hg =(API)0; | |
675 drc_ndb->d_drc_max_amplification_fb_bs =(API)0; | |
676 drc_ndb->d_drc_max_amplification_md_hg =(API)0; | |
677 drc_ndb->d_drc_compression_knee_fb_bs =(API)0; | |
678 drc_ndb->d_drc_compression_knee_md_hg =(API)0; | |
679 drc_ndb->d_drc_compression_ratio_fb_bs =(API)0; | |
680 drc_ndb->d_drc_compression_ratio_md_hg =(API)0; | |
681 drc_ndb->d_drc_energy_limiting_th_fb_bs =(API)0; | |
682 drc_ndb->d_drc_energy_limiting_th_md_hg =(API)0; | |
683 drc_ndb->d_drc_limiter_threshold_fb =(API)0; | |
684 drc_ndb->d_drc_limiter_threshold_bs =(API)0; | |
685 drc_ndb->d_drc_limiter_threshold_md =(API)0; | |
686 drc_ndb->d_drc_limiter_threshold_hg =(API)0; | |
687 drc_ndb->d_drc_limiter_hangover_spect_preserve =(API)0; | |
688 drc_ndb->d_drc_limiter_release_fb_bs =(API)0; | |
689 drc_ndb->d_drc_limiter_release_md_hg =(API)0; | |
690 drc_ndb->d_drc_gain_track_fb_bs =(API)0; | |
691 drc_ndb->d_drc_gain_track_md_hg =(API)0; | |
692 for (j=0; j < DRC_LPF_LENGTH; j++) | |
693 { | |
694 drc_ndb->a_drc_low_pass_filter[j] = (API)0; | |
695 } | |
696 for (j=0; j < DRC_BPF_LENGTH; j++) | |
697 { | |
698 drc_ndb->a_drc_mid_band_filter[j] = (API)0; | |
699 } | |
700 #endif | |
701 | |
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 } | |
722 | |
723 #endif // AUDIO_TASK |