FreeCalypso > hg > fc-tourmaline
comparison src/cs/layer1/dyn_dwl_cfile/l1_dyn_dwl_async.c @ 0:4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:23:26 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4e78acac3d88 |
---|---|
1 /************* Revision Controle System Header ************* | |
2 * GSM Layer 1 software | |
3 * L1_DYN_DWL_ASYNC.C | |
4 * | |
5 * Filename l1_dyn_dwl_async.c | |
6 * Copyright 2004 (C) Texas Instruments | |
7 * | |
8 ************* Revision Controle System Header *************/ | |
9 #include <stdio.h> | |
10 #include <string.h> | |
11 #include "nucleus.h" | |
12 #include "l1_confg.h" | |
13 #include "l1_types.h" | |
14 #include "sys_types.h" | |
15 #include "cust_os.h" | |
16 #include "l1audio_signa.h" | |
17 #include "l1audio_const.h" | |
18 #include "l1audio_cust.h" | |
19 #include "l1audio_defty.h" | |
20 #include "l1_const.h" | |
21 #include "l1tm_defty.h" | |
22 #if (L1_GTT == 1) | |
23 #include "l1gtt_const.h" | |
24 #include "l1gtt_defty.h" | |
25 #endif | |
26 #if (L1_DYN_DSP_DWNLD==1) | |
27 #include "l1_dyn_dwl_defty.h" | |
28 #include "l1_dyn_dwl_msgty.h" | |
29 #include "l1_dyn_dwl_const.h" | |
30 #include "l1_dyn_dwl_signa.h" | |
31 #include "l1_dyn_dwl_error.h" | |
32 #include "l1_dyn_dwl_proto.h" | |
33 #endif | |
34 #if (L1_MP3 == 1) | |
35 #include "l1mp3_defty.h" | |
36 #endif //L1_MP3 | |
37 #if (L1_MIDI == 1) | |
38 #include "l1midi_defty.h" | |
39 #endif | |
40 #if (L1_AAC == 1) | |
41 #include "l1aac_defty.h" | |
42 #endif //L1_AAC | |
43 | |
44 #include "l1_defty.h" | |
45 #include "l1_varex.h" | |
46 #include "l1_trace.h" | |
47 #include "sys_dma.h" | |
48 | |
49 #if (OP_RIV_AUDIO == 1) | |
50 #include "rv/rv_general.h" | |
51 #endif | |
52 | |
53 | |
54 #if (L1_DYN_DSP_DWNLD == 1) | |
55 #if(CODE_VERSION == SIMULATION) | |
56 extern VOID trace_fct_simu_dyn_dwnld(CHAR *fct_name); | |
57 #endif // CODE_VERSION == SIMULATION | |
58 | |
59 | |
60 | |
61 extern UWORD32 dyn_dwnld_address_vect[]; | |
62 extern const UWORD8 *dyn_dwnld_copy_MCU_vect[]; | |
63 extern UWORD16 dyn_dwnld_crc_vect[]; | |
64 extern UWORD16 size_vect[]; | |
65 | |
66 /*---------------------------------------------------------------------------------------------------------*/ | |
67 /* l1_patch_id2string */ | |
68 /*---------------------------------------------------------------------------------------------------------*/ | |
69 /* */ | |
70 /* Parameters : patch identificator "patch_id", string vector "vector" which identifies the patch */ | |
71 /* */ | |
72 /* Return : Fills the string vector containing the patch id by reference */ | |
73 /* */ | |
74 /* */ | |
75 /* Description : Links the patch ID number to its string value */ | |
76 /* */ | |
77 /* */ | |
78 /*---------------------------------------------------------------------------------------------------------*/ | |
79 | |
80 #if 0 | |
81 void l1_patch_id2string(UWORD16 patch_id, char* vect) | |
82 { | |
83 | |
84 switch(patch_id) | |
85 { | |
86 | |
87 #if ((CODE_VERSION == SIMULATION) || (((CHIPSET == 12) || (CHIPSET == 15)))) | |
88 case MP3_PATCH: | |
89 { | |
90 vect[0] = 'M'; | |
91 vect[1] = 'P'; | |
92 vect[2] = '3'; | |
93 vect[3] = '\0'; | |
94 } | |
95 break; | |
96 #endif | |
97 case MMS_PATCH: | |
98 { | |
99 vect[0] = 'M'; | |
100 vect[1] = 'M'; | |
101 vect[2] = 'S'; | |
102 vect[3] = '\0'; | |
103 } | |
104 break; | |
105 | |
106 #if ((CODE_VERSION == SIMULATION) || (((CHIPSET == 12) || (CHIPSET == 15)))) | |
107 case E2_PATCH: | |
108 { | |
109 vect[0] = 'E'; | |
110 vect[1] = '2'; | |
111 vect[2] = ' '; | |
112 vect[3] = '\0'; | |
113 } | |
114 break; | |
115 #endif | |
116 case TTY_PATCH: | |
117 { | |
118 vect[0] = 'T'; | |
119 vect[1] = 'T'; | |
120 vect[2] = 'Y'; | |
121 vect[3] = '\0'; | |
122 } | |
123 break; | |
124 case SPEECH_ACOUSTIC_PATCH: | |
125 { | |
126 vect[0] = 'A'; | |
127 vect[1] = 'N'; | |
128 vect[2] = 'R'; | |
129 vect[3] = '\0'; | |
130 } | |
131 break; | |
132 #if ((CODE_VERSION == SIMULATION) || (CHIPSET == 12) || (CHIPSET == 15)) | |
133 case AAC_PATCH: | |
134 { | |
135 vect[0] = 'A'; | |
136 vect[1] = 'A'; | |
137 vect[2] = 'C'; | |
138 vect[3] = '\0'; | |
139 } | |
140 break; | |
141 #endif | |
142 #if ((CODE_VERSION == SIMULATION) || (CHIPSET == 12) || (CHIPSET == 15)) | |
143 case PCM_EXTRACTION_PATCH: | |
144 { | |
145 vect[0] = 'P'; | |
146 vect[1] = 'C'; | |
147 vect[2] = 'M'; | |
148 vect[3] = '\0'; | |
149 } | |
150 break; | |
151 #endif | |
152 | |
153 } | |
154 } | |
155 #endif | |
156 | |
157 /*----------------------------------------------------------------------------------------*/ | |
158 /* l1_dynamic_download_manager */ | |
159 /*----------------------------------------------------------------------------------------*/ | |
160 /* */ | |
161 /* Parameters : Signal Code of the message, delay flag */ | |
162 /* */ | |
163 /* Return : True if the primitives triggers a dynamic download and sets all the */ | |
164 /* parameters to perform a dynamic download, false otherwise */ | |
165 /* */ | |
166 /* Description : Implements the dynamic download manager algorithm */ | |
167 /* */ | |
168 /* */ | |
169 /*----------------------------------------------------------------------------------------*/ | |
170 | |
171 | |
172 BOOL l1_dynamic_download_manager(UWORD32 SignalCode, BOOL delay_flag) | |
173 { | |
174 | |
175 UWORD16 temp_patch_array[MAX_NUM_OF_PATCH_IDS]; | |
176 UWORD16 temp_num_patch; | |
177 UWORD16 num_of_patch_id_to_dwnld; | |
178 UWORD16 num_of_uninstall_elem; | |
179 UWORD16 i; | |
180 UWORD16 patch_id_uninstall_vect[MAX_NUM_OF_PATCH_IDS]; | |
181 UWORD16 patch_id; | |
182 UWORD16 temp_patch_id[MAX_NUM_OF_PATCH_IDS]; | |
183 BOOL return_flag = FALSE; | |
184 | |
185 // Primitive is processed only if it triggers a dynamic download or there is a delay | |
186 if(delay_flag == TRUE || l1_does_the_incoming_primitive_trigger_dynamic_dwnld(SignalCode, FALSE) == TRUE) | |
187 { | |
188 | |
189 //---------------------------------------------------------------------- | |
190 // Compute which patch ids (passed by reference) and the number of patches to install | |
191 //---------------------------------------------------------------------- | |
192 | |
193 temp_num_patch= l1_lookup_primitive_patch_matrix(SignalCode,temp_patch_array); | |
194 i=0; | |
195 num_of_patch_id_to_dwnld = 0; | |
196 | |
197 //-------------------------------------------- | |
198 // Check if there is any patch that still must be installed | |
199 //-------------------------------------------- | |
200 | |
201 while(i < temp_num_patch) | |
202 { | |
203 if(l1_is_patch_already_installed(temp_patch_array[i]) == FALSE) | |
204 { | |
205 l1a.dyn_dwnld.next_patch_id[num_of_patch_id_to_dwnld++] = temp_patch_array[i]; | |
206 } | |
207 i++; | |
208 } | |
209 | |
210 //-------------------------- | |
211 // Manage patch incompatibilities | |
212 //-------------------------- | |
213 | |
214 // if there's at least one patch that must be installed | |
215 if(num_of_patch_id_to_dwnld!=0) | |
216 { | |
217 return_flag = TRUE; | |
218 // Check if already installed patches are compatible or not and retrieve number of patches to uninstall and their ids | |
219 if(l1_manage_patch_incompatibilty(num_of_patch_id_to_dwnld,&(num_of_uninstall_elem),patch_id_uninstall_vect)) | |
220 { | |
221 // Set L1A-API HISR variable: no elements to uninstall | |
222 l1a_apihisr_com.dyn_dwnld.uninstall_parameters.num_of_elem=0; | |
223 | |
224 // Trace number of elements to uninstall | |
225 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) | |
226 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) | |
227 { | |
228 char string[18]; | |
229 sprintf(string,"No UNINSTALL: \r\n"); | |
230 #if(CODE_VERSION == SIMULATION) | |
231 trace_fct_simu_dyn_dwnld(string); | |
232 #else | |
233 rvt_send_trace_cpy((T_RVT_BUFFER)string,trace_info.l1_trace_user_id,strlen(string),RVT_ASCII_FORMAT); | |
234 #endif // CODE_VERSION == SIMULATION | |
235 } | |
236 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) | |
237 } | |
238 else | |
239 { | |
240 UWORD16 element,j,index_counter; | |
241 | |
242 // Set uninstall elements number and their address | |
243 l1a_apihisr_com.dyn_dwnld.uninstall_parameters.num_of_elem=num_of_uninstall_elem; | |
244 | |
245 // Trace number of elements to uninstall | |
246 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) | |
247 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) | |
248 { | |
249 char str[20]; | |
250 sprintf(str,"UNINST_NUM: %d |\r\n", l1a_apihisr_com.dyn_dwnld.uninstall_parameters.num_of_elem); | |
251 #if(CODE_VERSION == SIMULATION) | |
252 trace_fct_simu_dyn_dwnld(str); | |
253 #else | |
254 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); | |
255 #endif // CODE_VERSION == SIMULATION | |
256 } | |
257 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) | |
258 | |
259 // For all patches to uninstall... | |
260 for(i=0;i<num_of_uninstall_elem;i++) | |
261 { | |
262 element=patch_id_uninstall_vect[i]; | |
263 | |
264 // Trace IDs of elements to uninstall | |
265 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) | |
266 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) | |
267 { | |
268 char str[18]; | |
269 sprintf(str,"UNINST_ID: %d \r\n", element); | |
270 #if(CODE_VERSION == SIMULATION) | |
271 trace_fct_simu_dyn_dwnld(str); | |
272 #else | |
273 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); | |
274 #endif // CODE_VERSION == SIMULATION | |
275 } | |
276 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) | |
277 | |
278 // Set uninstall function address | |
279 l1a_apihisr_com.dyn_dwnld.uninstall_parameters.address[i]=dyn_dwnld_address_vect[element]; | |
280 } | |
281 | |
282 index_counter = 0; | |
283 for(i=0; i<l1a.dyn_dwnld.num_patches_installed;i++) | |
284 { | |
285 for(j=0;j<num_of_uninstall_elem;j++) | |
286 { | |
287 if(l1a.dyn_dwnld.patch_id[i] == patch_id_uninstall_vect[j]) | |
288 { | |
289 l1a.dyn_dwnld.patch_id[i] = 0xFFFF; //omaps00090550 ; | |
290 break; | |
291 } | |
292 } | |
293 if(j == num_of_uninstall_elem) | |
294 { | |
295 temp_patch_id[index_counter++]=l1a.dyn_dwnld.patch_id[i]; | |
296 } | |
297 } | |
298 // Reset global variables used by dynamic download | |
299 l1a.dyn_dwnld.num_patches_installed-=num_of_uninstall_elem; | |
300 for(i=0;i<l1a.dyn_dwnld.num_patches_installed;i++) | |
301 l1a.dyn_dwnld.patch_id[i] = temp_patch_id[i]; | |
302 } | |
303 | |
304 //----------------------------------------- | |
305 // Update L1A-L1APIHISR communication structure | |
306 //----------------------------------------- | |
307 | |
308 l1a_apihisr_com.dyn_dwnld.copy_parameters.num_of_elem=num_of_patch_id_to_dwnld; | |
309 l1a.dyn_dwnld.num_of_elem_to_copy = num_of_patch_id_to_dwnld; | |
310 | |
311 // Trace number of elements to download | |
312 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) | |
313 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) | |
314 { | |
315 char str[18]; | |
316 sprintf(str,"DWNLD_NUM: %d \r\n", num_of_patch_id_to_dwnld); | |
317 #if(CODE_VERSION == SIMULATION) | |
318 trace_fct_simu_dyn_dwnld(str); | |
319 #else | |
320 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); | |
321 #endif // CODE_VERSION == SIMULATION | |
322 } | |
323 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) | |
324 | |
325 // For all patches that must be downloaded... | |
326 for (i=0;i<num_of_patch_id_to_dwnld;i++) | |
327 { | |
328 patch_id=l1a.dyn_dwnld.next_patch_id[i]; | |
329 | |
330 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) | |
331 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) | |
332 { | |
333 char str[18]; | |
334 sprintf(str,"DWNLD_ID: %d \r\n", patch_id); | |
335 | |
336 #if(CODE_VERSION == SIMULATION) | |
337 trace_fct_simu_dyn_dwnld(str); | |
338 #else | |
339 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); | |
340 #endif // CODE_VERSION == SIMULATION | |
341 } | |
342 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) | |
343 | |
344 // Set patch IDs addresses: copy source address and install address | |
345 l1a_apihisr_com.dyn_dwnld.copy_parameters.start_MCU_copy_address[i] = | |
346 (UWORD32) dyn_dwnld_copy_MCU_vect[patch_id]; | |
347 l1a_apihisr_com.dyn_dwnld.copy_parameters.address_to_install[i] = | |
348 dyn_dwnld_address_vect[patch_id]; | |
349 l1a_apihisr_com.dyn_dwnld.copy_parameters.crc[i] = | |
350 dyn_dwnld_crc_vect[patch_id]; | |
351 l1a_apihisr_com.dyn_dwnld.copy_parameters.size_array[i] = | |
352 size_vect[patch_id]; | |
353 } | |
354 | |
355 //----------------------------------------- | |
356 // Set semaphores to lock involved state machines | |
357 //----------------------------------------- | |
358 | |
359 if(delay_flag == FALSE) | |
360 // Tell other state machines that they have to stay in steady state waiting for dynamic download activity to be completed | |
361 | |
362 l1_set_semaphores_for_all_state_machines_involved(num_of_patch_id_to_dwnld,l1a.dyn_dwnld.next_patch_id); | |
363 else | |
364 | |
365 // Update the already set semaphores if it is the case | |
366 | |
367 l1_update_semaphores_for_all_state_machines(num_of_patch_id_to_dwnld); | |
368 } | |
369 } | |
370 return return_flag; | |
371 } | |
372 | |
373 /*----------------------------------------------------------------------------------------*/ | |
374 /* l1a_dyn_dwnld_set_process */ | |
375 /*----------------------------------------------------------------------------------------*/ | |
376 /* */ | |
377 /* Parameters : Signal Code of the message, delay flag */ | |
378 /* */ | |
379 /* Return : True if the primitives triggers a dynamic download and sets all the */ | |
380 /* parameters to perform a dynamic download, false otherwise */ | |
381 /* */ | |
382 /* Description : Implements the dynamic download manager algorithm */ | |
383 /* */ | |
384 /* */ | |
385 /*----------------------------------------------------------------------------------------*/ | |
386 void l1a_dyn_dwnld_set_process(void) | |
387 { | |
388 | |
389 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4)) | |
390 // Disable trace DSP upon Dynamic Download activation | |
391 l1_disable_DSP_trace(); | |
392 #endif | |
393 | |
394 // Reset API variables | |
395 l1_dyn_dwnld_reset_api(); | |
396 | |
397 // In case E2 is running, dynamic download must use a different area as E2 samples use trace DSP buffer | |
398 // area which is used as well for dynamic download | |
399 | |
400 if ((l1a.dyn_dwnld.melody0_E2_flag_activated == TRUE) || (l1a.dyn_dwnld.melody1_E2_flag_activated == TRUE)) | |
401 | |
402 // Set download parameters: size and start download address of API area and number of patches to download | |
403 { | |
404 l1a_apihisr_com.dyn_dwnld.copy_parameters.start_of_dwnld_area= START_API_DWNLD_AREA_DURING_E2; | |
405 l1a_apihisr_com.dyn_dwnld.copy_parameters.size_of_dwnld_area= SIZE_API_DWNLD_AREA_DURING_E2; | |
406 } | |
407 else | |
408 { | |
409 l1a_apihisr_com.dyn_dwnld.copy_parameters.start_of_dwnld_area=START_API_DWNLD_AREA; | |
410 l1a_apihisr_com.dyn_dwnld.copy_parameters.size_of_dwnld_area=SIZE_API_DWNLD_AREA; | |
411 } | |
412 | |
413 // Dynamic download HISR can be activated | |
414 l1_apihisr.dyn_dwnld.running=TRUE; | |
415 | |
416 // Tell the L1S to start the DSP background task | |
417 l1a_l1s_com.dyn_dwnld_task.start=TRUE; | |
418 } | |
419 | |
420 | |
421 /*-------------------------------------------------------*/ | |
422 /* l1a_dyn_dsp_dwnld_process() */ | |
423 /*-------------------------------------------------------*/ | |
424 /* */ | |
425 /* Description: */ | |
426 /* ------------ */ | |
427 /* This function is a state machine which handles the */ | |
428 /* dynamic download feature. */ | |
429 /* */ | |
430 /* Starting messages: */ | |
431 /* */ | |
432 /* Result messages (input): */ | |
433 /* */ | |
434 /* */ | |
435 /* Result messages (output): */ | |
436 /* */ | |
437 /* Reset messages (input): none */ | |
438 /* */ | |
439 /* Stop message (input): */ | |
440 /* */ | |
441 /* Stop message (output): */ | |
442 /* */ | |
443 /* Rem: */ | |
444 /* ---- */ | |
445 /* */ | |
446 /*-------------------------------------------------------*/ | |
447 | |
448 void l1a_dyn_dsp_dwnld_process(xSignalHeaderRec *msg) | |
449 { | |
450 enum states | |
451 { | |
452 RESET=0, | |
453 WAIT_INIT, | |
454 WAIT_RESULT, | |
455 WAIT_STOP | |
456 }; | |
457 | |
458 UWORD8 *state =&l1a.dyn_dwnld.state; | |
459 UWORD32 SignalCode=msg->SignalCode; | |
460 UWORD16 i; | |
461 UWORD16 delay_patch_array[MAX_NUM_OF_PATCH_IDS]; | |
462 UWORD16 delay_num_patch; | |
463 UWORD32 delay_primitive; | |
464 | |
465 while(1) | |
466 { | |
467 switch(*state) | |
468 { | |
469 // ********* | |
470 // * RESET * | |
471 // ********* | |
472 case RESET: | |
473 { | |
474 // Reset intra L1 variables: L1A-L1S interface, L1A-API interface, global API HISR variables | |
475 l1_dyn_dwnld_reset(); | |
476 | |
477 // Change state | |
478 *state = WAIT_INIT; | |
479 } | |
480 break; | |
481 | |
482 // ****************** | |
483 // * WAIT START REQ * | |
484 // ****************** | |
485 case WAIT_INIT: | |
486 { | |
487 | |
488 // *----------------------------* | |
489 // * Dynamic download manager * | |
490 // *----------------------------* | |
491 | |
492 | |
493 /* Run the dynamic download manager */ | |
494 if (l1_dynamic_download_manager(SignalCode, FALSE) == TRUE) | |
495 { | |
496 | |
497 /* Initialisation of dynamic download process */ | |
498 l1a_dyn_dwnld_set_process(); | |
499 | |
500 // Change state | |
501 *state=WAIT_RESULT; | |
502 | |
503 } | |
504 return; | |
505 } | |
506 //omaps00090550 break; | |
507 | |
508 // *************** | |
509 // * WAIT_RESULT * | |
510 // *************** | |
511 | |
512 case WAIT_RESULT: | |
513 { | |
514 if (l1_does_the_incoming_primitive_trigger_dynamic_dwnld(SignalCode,TRUE) == TRUE) | |
515 { | |
516 if (l1_push_Primitive(SignalCode) == TRUE) | |
517 { | |
518 delay_num_patch = l1_lookup_primitive_patch_matrix(SignalCode,delay_patch_array); | |
519 | |
520 // Tell other state machines that they have to stay in steady state waiting for dynamic download activity to be completed | |
521 l1_set_semaphores_for_all_state_machines_involved(delay_num_patch, delay_patch_array); | |
522 } | |
523 else | |
524 { | |
525 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) | |
526 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) | |
527 { | |
528 char str[16]; | |
529 sprintf(str,"Fifo ovflw:\r\n"); | |
530 #if(CODE_VERSION == SIMULATION) | |
531 trace_fct_simu_dyn_dwnld(str); | |
532 #else | |
533 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); | |
534 #endif // CODE_VERSION == SIMULATION | |
535 } | |
536 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) | |
537 } | |
538 } | |
539 switch(SignalCode) | |
540 { | |
541 | |
542 // *----------------------------------------------------------------------------------* | |
543 // * CRC reported is not OK or an error has been reported; Restart patch from scratch * | |
544 // *----------------------------------------------------------------------------------* | |
545 case API_L1_CRC_NOT_OK: | |
546 { | |
547 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) | |
548 // Trace | |
549 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) | |
550 { | |
551 char str[18]; | |
552 sprintf(str,"CRC NOK: %4x \r\n",((T_API_L1_CRC_NOT_OK *)(msg->SigP))->patch_id); | |
553 #if(CODE_VERSION == SIMULATION) | |
554 trace_fct_simu_dyn_dwnld(str); | |
555 #else | |
556 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); | |
557 #endif // CODE_VERSION == SIMULATION | |
558 } | |
559 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) | |
560 | |
561 // Set recovery flag to TRUE; | |
562 l1a_l1s_com.recovery_flag = TRUE; | |
563 *state = RESET; | |
564 } | |
565 break; | |
566 case API_L1_DYN_DWNLD_STOP: | |
567 { | |
568 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) | |
569 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) | |
570 { | |
571 char str[15]; | |
572 sprintf(str,"DSP Error \r\n"); | |
573 #if(CODE_VERSION == SIMULATION) | |
574 trace_fct_simu_dyn_dwnld(str); | |
575 #else | |
576 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); | |
577 #endif // CODE_VERSION == SIMULATION | |
578 } | |
579 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) | |
580 | |
581 // Set recovery flag to TRUE; | |
582 l1a_l1s_com.recovery_flag = TRUE; | |
583 *state = RESET; | |
584 } | |
585 break; | |
586 | |
587 // *-------------------------------------------------------------* | |
588 // * Dynamic download finished: all patches have been downloaded * | |
589 // *-------------------------------------------------------------* | |
590 case API_L1_CRC_OK: | |
591 { | |
592 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) | |
593 // Trace | |
594 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) | |
595 { | |
596 char str[18]; | |
597 sprintf(str,"CRC OK: %4x \r\n",((T_API_L1_CRC_NOT_OK *)(msg->SigP))->patch_id); | |
598 #if(CODE_VERSION == SIMULATION) | |
599 trace_fct_simu_dyn_dwnld(str); | |
600 #else | |
601 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); | |
602 #endif // CODE_VERSION == SIMULATION | |
603 } | |
604 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) | |
605 } | |
606 break; | |
607 case API_L1_DYN_DWNLD_FINISHED: | |
608 { | |
609 | |
610 // Store currently installed patch | |
611 for (i=0;i<l1a.dyn_dwnld.num_of_elem_to_copy;i++) | |
612 { | |
613 l1a.dyn_dwnld.patch_id[l1a.dyn_dwnld.num_patches_installed+i]=l1a.dyn_dwnld.next_patch_id[i]; | |
614 } | |
615 | |
616 // Update the counter of the patch currently installed and reset sempahores | |
617 l1a.dyn_dwnld.num_patches_installed+=l1a.dyn_dwnld.num_of_elem_to_copy; | |
618 l1_reset_semaphores(); | |
619 | |
620 // Reset number of element to copy in the next phase | |
621 l1a.dyn_dwnld.num_of_elem_to_copy = 0; | |
622 | |
623 // Reset next patch ID global variables | |
624 for(i=0;i<MAX_NUM_OF_PATCH_IDS;i++) | |
625 l1a.dyn_dwnld.next_patch_id[i] = 0xFFFF; //omaps00090550 ; | |
626 | |
627 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) | |
628 // Trace | |
629 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) | |
630 { | |
631 char str[26]; | |
632 sprintf(str,"Patch dwnld finished \r\n"); | |
633 #if(CODE_VERSION == SIMULATION) | |
634 trace_fct_simu_dyn_dwnld(str); | |
635 #else | |
636 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); | |
637 #endif // CODE_VERSION == SIMULATION | |
638 } | |
639 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) | |
640 | |
641 // Check if there is any pending primitive waiting to be de-queued | |
642 { | |
643 #if 0 /* LoCosto code */ | |
644 UWORD32 remaining_primitive_flag=0; | |
645 UWORD32 process_continue_flag=1; | |
646 UWORD32 delay_primitive_processed_flag=0; | |
647 | |
648 remaining_primitive_flag = (l1_check_Fifo_Primitive()>0); | |
649 | |
650 while(remaining_primitive_flag && process_continue_flag) | |
651 { | |
652 l1_pop_Primitive(&(delay_primitive)); | |
653 if (l1_dynamic_download_manager(delay_primitive, TRUE) == TRUE) | |
654 { | |
655 process_continue_flag=0; | |
656 delay_primitive_processed_flag=1; | |
657 // If yes set the restart command at apihisr level | |
658 l1a_apihisr_com.dyn_dwnld.command.restart = TRUE; | |
659 | |
660 /********** WORKAROUND *************/ | |
661 #if (OP_RIV_AUDIO == 1) | |
662 { | |
663 // WARNING: temporary until os_activate_hisr() is declared in L3 functions | |
664 extern NU_HISR apiHISR; | |
665 NU_Activate_HISR(&apiHISR); | |
666 } | |
667 #else | |
668 os_activate_hisr(API_HISR); | |
669 #endif // OP_RIV_AUDIO == 1 | |
670 /********** WORKAROUND *************/ | |
671 *state = WAIT_RESULT; | |
672 } | |
673 remaining_primitive_flag = (l1_check_Fifo_Primitive()>0); | |
674 } | |
675 | |
676 // else stop the DSP background task as no other patch must be downloaded | |
677 if(delay_primitive_processed_flag == 0) | |
678 { | |
679 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4)) | |
680 // Enable trace DSP upon Dynamic Download deactivation | |
681 l1_enable_DSP_trace(); | |
682 //Trace_dsp_dump(); | |
683 #endif // omaps00090550 #14-D removal | |
684 l1a_l1s_com.dyn_dwnld_task.stop=TRUE; | |
685 *state = WAIT_STOP; | |
686 } | |
687 | |
688 #else /* TCS211 reconstruction from disassembly */ | |
689 | |
690 if (l1_check_Fifo_Primitive() != 0) | |
691 { | |
692 l1_pop_Primitive(&(delay_primitive)); | |
693 if (l1_dynamic_download_manager(delay_primitive, TRUE) == TRUE) | |
694 { | |
695 // If yes set the restart command at apihisr level | |
696 l1a_apihisr_com.dyn_dwnld.command.restart = TRUE; | |
697 | |
698 /********** WORKAROUND *************/ | |
699 #if (OP_RIV_AUDIO == 1) | |
700 { | |
701 // WARNING: temporary until os_activate_hisr() is declared in L3 functions | |
702 extern NU_HISR apiHISR; | |
703 NU_Activate_HISR(&apiHISR); | |
704 } | |
705 #else | |
706 os_activate_hisr(API_HISR); | |
707 #endif // OP_RIV_AUDIO == 1 | |
708 /********** WORKAROUND *************/ | |
709 *state = WAIT_RESULT; | |
710 } | |
711 } | |
712 else | |
713 { | |
714 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4)) | |
715 // Enable trace DSP upon Dynamic Download deactivation | |
716 l1_enable_DSP_trace(); | |
717 //Trace_dsp_dump(); | |
718 #endif // omaps00090550 #14-D removal | |
719 l1a_l1s_com.dyn_dwnld_task.stop=TRUE; | |
720 *state = WAIT_STOP; | |
721 } | |
722 #endif | |
723 } | |
724 } | |
725 break; | |
726 } // switch(SignalCode) | |
727 return; | |
728 } | |
729 //omaps00090550 break; // case WAIT_RESULT | |
730 case WAIT_STOP: | |
731 { | |
732 /* In case of a primitive which triggers a dynamic download arrives we must start over */ | |
733 if (l1_does_the_incoming_primitive_trigger_dynamic_dwnld(SignalCode,TRUE) == TRUE) | |
734 { | |
735 /* Run the dynamic download manager */ | |
736 if (l1_dynamic_download_manager(SignalCode, FALSE) == TRUE) | |
737 { | |
738 /* Initialisation of dynamic download process */ | |
739 l1a_dyn_dwnld_set_process(); | |
740 | |
741 // Change state | |
742 *state=WAIT_RESULT; | |
743 } | |
744 } | |
745 else if (SignalCode == L1_DYN_DWNLD_STOP_CON) | |
746 { | |
747 // DYN DWNLD HISR must be deactivated | |
748 l1_apihisr.dyn_dwnld.running=FALSE; | |
749 // Change state | |
750 *state=RESET; | |
751 } | |
752 return; | |
753 } | |
754 //omaps00090550 break; | |
755 } | |
756 } | |
757 } | |
758 #endif // L1_DYN_DSP_DWNLD |