comparison L1/dyn_dwl_cfile/l1_dyn_dwl_async.c @ 21:dfc7b0bc468a

L1/dyn_dwl_cfile/*.c: initial import from tcs211-l1-reconst
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 10 Jun 2016 08:59:53 +0000
parents 75a11d740a02
children fc33e796507a
comparison
equal deleted inserted replaced
20:5fd4e7669c93 21:dfc7b0bc468a
6 * Copyright 2004 (C) Texas Instruments 6 * Copyright 2004 (C) Texas Instruments
7 * 7 *
8 ************* Revision Controle System Header *************/ 8 ************* Revision Controle System Header *************/
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <string.h> 10 #include <string.h>
11 #include "config.h" 11 #include "nucleus.h"
12 #include "l1_confg.h" 12 #include "l1_confg.h"
13 #include "l1_types.h"
13 #include "sys_types.h" 14 #include "sys_types.h"
14 #include "../../riviera/rv/rv_general.h" 15 #include "cust_os.h"
15 #include "../../nucleus/nucleus.h"
16 #include "l1_types.h"
17 #include "../../gpf/inc/cust_os.h"
18 #include "l1audio_signa.h" 16 #include "l1audio_signa.h"
19 #include "l1audio_const.h" 17 #include "l1audio_const.h"
20 #include "l1audio_cust.h" 18 #include "l1audio_cust.h"
21 #include "l1audio_defty.h" 19 #include "l1audio_defty.h"
22 #include "l1_const.h" 20 #include "l1_const.h"
44 #endif //L1_AAC 42 #endif //L1_AAC
45 43
46 #include "l1_defty.h" 44 #include "l1_defty.h"
47 #include "l1_varex.h" 45 #include "l1_varex.h"
48 #include "l1_trace.h" 46 #include "l1_trace.h"
49 /* #include "sys_dma.h" */ 47 #include "sys_dma.h"
48
49 #if (OP_RIV_AUDIO == 1)
50 #include "rv/rv_general.h"
51 #endif
50 52
51 53
52 #if (L1_DYN_DSP_DWNLD == 1) 54 #if (L1_DYN_DSP_DWNLD == 1)
53 #if(CODE_VERSION == SIMULATION) 55 #if(CODE_VERSION == SIMULATION)
54 extern VOID trace_fct_simu_dyn_dwnld(CHAR *fct_name); 56 extern VOID trace_fct_simu_dyn_dwnld(CHAR *fct_name);
175 UWORD16 num_of_patch_id_to_dwnld; 177 UWORD16 num_of_patch_id_to_dwnld;
176 UWORD16 num_of_uninstall_elem; 178 UWORD16 num_of_uninstall_elem;
177 UWORD16 i; 179 UWORD16 i;
178 UWORD16 patch_id_uninstall_vect[MAX_NUM_OF_PATCH_IDS]; 180 UWORD16 patch_id_uninstall_vect[MAX_NUM_OF_PATCH_IDS];
179 UWORD16 patch_id; 181 UWORD16 patch_id;
180 UWORD16 temp_patch_id[MAX_NUM_OF_PATCH_IDS]= {0}; //omaps00090550 182 UWORD16 temp_patch_id[MAX_NUM_OF_PATCH_IDS];
181 BOOL return_flag = FALSE; 183 BOOL return_flag = FALSE;
182 184
183 // Primitive is processed only if it triggers a dynamic download or there is a delay 185 // Primitive is processed only if it triggers a dynamic download or there is a delay
184 if(delay_flag == TRUE || l1_does_the_incoming_primitive_trigger_dynamic_dwnld(SignalCode, FALSE) == TRUE) 186 if(delay_flag == TRUE || l1_does_the_incoming_primitive_trigger_dynamic_dwnld(SignalCode, FALSE) == TRUE)
185 { 187 {
261 263
262 // Trace IDs of elements to uninstall 264 // Trace IDs of elements to uninstall
263 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) 265 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5))
264 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) 266 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD))
265 { 267 {
266 char str[16]; 268 char str[18];
267 sprintf(str,"UNINST_ID: %d \r\n", element); 269 sprintf(str,"UNINST_ID: %d \r\n", element);
268 #if(CODE_VERSION == SIMULATION) 270 #if(CODE_VERSION == SIMULATION)
269 trace_fct_simu_dyn_dwnld(str); 271 trace_fct_simu_dyn_dwnld(str);
270 #else 272 #else
271 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); 273 rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT);
326 patch_id=l1a.dyn_dwnld.next_patch_id[i]; 328 patch_id=l1a.dyn_dwnld.next_patch_id[i];
327 329
328 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) 330 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5))
329 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD)) 331 if((trace_info.current_config->l1_dyn_trace) & (1<<L1_DYN_TRACE_DYN_DWNLD))
330 { 332 {
331 char str[22]; 333 char str[18];
332 sprintf(str,"DWNLD_ID: %d \r\n", patch_id); 334 sprintf(str,"DWNLD_ID: %d \r\n", patch_id);
333 335
334 #if(CODE_VERSION == SIMULATION) 336 #if(CODE_VERSION == SIMULATION)
335 trace_fct_simu_dyn_dwnld(str); 337 trace_fct_simu_dyn_dwnld(str);
336 #else 338 #else
384 void l1a_dyn_dwnld_set_process(void) 386 void l1a_dyn_dwnld_set_process(void)
385 { 387 {
386 388
387 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4)) 389 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4))
388 // Disable trace DSP upon Dynamic Download activation 390 // Disable trace DSP upon Dynamic Download activation
389 l1_disable_dsp_trace(); 391 l1_disable_DSP_trace();
390 #endif 392 #endif
391 393
392 // Reset API variables 394 // Reset API variables
393 l1_dyn_dwnld_reset_api(); 395 l1_dyn_dwnld_reset_api();
394 396
636 } 638 }
637 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) 639 #endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4)
638 640
639 // Check if there is any pending primitive waiting to be de-queued 641 // Check if there is any pending primitive waiting to be de-queued
640 { 642 {
643 #if 0 /* LoCosto code */
641 UWORD32 remaining_primitive_flag=0; 644 UWORD32 remaining_primitive_flag=0;
642 UWORD32 process_continue_flag=1; 645 UWORD32 process_continue_flag=1;
643 UWORD32 delay_primitive_processed_flag=0; 646 UWORD32 delay_primitive_processed_flag=0;
644 647
645 remaining_primitive_flag = (l1_check_Fifo_Primitive()>0); 648 remaining_primitive_flag = (l1_check_Fifo_Primitive()>0);
653 delay_primitive_processed_flag=1; 656 delay_primitive_processed_flag=1;
654 // If yes set the restart command at apihisr level 657 // If yes set the restart command at apihisr level
655 l1a_apihisr_com.dyn_dwnld.command.restart = TRUE; 658 l1a_apihisr_com.dyn_dwnld.command.restart = TRUE;
656 659
657 /********** WORKAROUND *************/ 660 /********** WORKAROUND *************/
658 #if 1 //(OP_RIV_AUDIO == 1) 661 #if (OP_RIV_AUDIO == 1)
659 { 662 {
660 // WARNING: temporary until os_activate_hisr() is declared in L3 functions 663 // WARNING: temporary until os_activate_hisr() is declared in L3 functions
661 extern NU_HISR apiHISR; 664 extern NU_HISR apiHISR;
662 NU_Activate_HISR(&apiHISR); 665 NU_Activate_HISR(&apiHISR);
663 } 666 }
664 #else 667 #else
665 os_activate_hisr(API_HISR); 668 os_activate_hisr(API_HISR);
666 #endif // OP_RIV_AUDIO == 1 669 #endif // OP_RIV_AUDIO == 1
667 /********** WORKAROUND *************/ 670 /********** WORKAROUND *************/
668 *state = WAIT_RESULT; 671 *state = WAIT_RESULT;
669 } 672 }
670 remaining_primitive_flag = (l1_check_Fifo_Primitive()>0); 673 remaining_primitive_flag = (l1_check_Fifo_Primitive()>0);
671 } 674 }
672 675
673 // else stop the DSP background task as no other patch must be downloaded 676 // else stop the DSP background task as no other patch must be downloaded
674 if(delay_primitive_processed_flag == 0) 677 if(delay_primitive_processed_flag == 0)
675 { 678 {
676 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4)) 679 #if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4))
677 // Enable trace DSP upon Dynamic Download deactivation 680 // Enable trace DSP upon Dynamic Download deactivation
678 l1_enable_dsp_trace(); 681 l1_enable_DSP_trace();
679 //Trace_dsp_dump(); 682 //Trace_dsp_dump();
680 #endif // omaps00090550 #14-D removal 683 #endif // omaps00090550 #14-D removal
681 l1a_l1s_com.dyn_dwnld_task.stop=TRUE; 684 l1a_l1s_com.dyn_dwnld_task.stop=TRUE;
682 *state = WAIT_STOP; 685 *state = WAIT_STOP;
683 } 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
684 } 723 }
685 } 724 }
686 break; 725 break;
687 } // switch(SignalCode) 726 } // switch(SignalCode)
688 return; 727 return;