# HG changeset patch # User Mychaela Falconia # Date 1445463665 0 # Node ID 06d94fdaadf62143a15df8b8ea8d0a89e0ec5d51 # Parent 3f44bb6108b907fa1b6c68f01371e333712b4257 l1_dyn_dwl_*.c imported from LoCosto source diff -r 3f44bb6108b9 -r 06d94fdaadf6 chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_afunc.c --- a/chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_afunc.c Wed Oct 21 03:48:05 2015 +0000 +++ b/chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_afunc.c Wed Oct 21 21:41:05 2015 +0000 @@ -1,1 +1,513 @@ -/* dummy C source file */ +/************* Revision Controle System Header ************* + * GSM Layer 1 software + * L1_DYN_DWL_AFUNC.C + * + * Filename l1_dyn_dwl_afunc.c + * Copyright 2004 (C) Texas Instruments + * + ************* Revision Controle System Header *************/ + +#include "l1_confg.h" +#include "l1_types.h" +#include "sys_types.h" +#include "cust_os.h" +#include "l1_macro.h" +#include "l1_const.h" +#if TESTMODE + #include "l1tm_defty.h" +#endif +#if (AUDIO_TASK == 1) + #include "l1audio_const.h" + #include "l1audio_cust.h" + #include "l1audio_defty.h" + #include "l1audio_signa.h" +#endif +#if (L1_GTT == 1) + #include "l1gtt_const.h" + #include "l1gtt_defty.h" + #include "l1gtt_signa.h" +#endif +#if (L1_DYN_DSP_DWNLD == 1) + #include "l1_dyn_dwl_msgty.h" + #include "l1_dyn_dwl_defty.h" + #include "l1_dyn_dwl_proto.h" + #include "l1_dyn_dwl_const.h" +#endif //L1_DYN_DSP_DWNLD +#if (L1_MP3 == 1) + #include "l1mp3_signa.h" + #include "l1mp3_defty.h" +#endif //L1_MP3 +#if (L1_MIDI == 1) + #include "l1midi_defty.h" +#endif +#if (L1_AAC == 1) + #include "l1aac_signa.h" + #include "l1aac_defty.h" +#endif //L1_AAC +#include "l1_defty.h" +#include "l1_varex.h" +#include "l1_msgty.h" +#include "l1_proto.h" +#include "l1_signa.h" +#include +#include + + +#if (TRACE_TYPE == 1) ||(TRACE_TYPE == 4) || (TRACE_TYPE == 7) || (TESTMODE) + #include "l1_trace.h" +#endif + +#if (L1_DYN_DSP_DWNLD == 1) + +extern const BOOL primitives_to_patch_matrix[][MAX_NUM_OF_PATCH_IDS]; +extern const BOOL incompatibility_matrix[][MAX_NUM_OF_PATCH_IDS]; +extern const BOOL semaphore_matrix[][MAX_NUM_OF_SEMAPHORES]; + +#if (CODE_VERSION == SIMULATION || ((CHIPSET == 12) || (CHIPSET == 15))) +const T_SIGNAL_PATCH signal_patch_array[NUM_OF_DYN_DWNLD_PRIMITIVES] = +{ +#if (L1_GTT == 1) + {MMI_GTT_START_REQ, 0}, +#endif // L1_GTT +#if (L1_VOCODER_IF_CHANGE == 1) + {MMI_TCH_VOCODER_CFG_REQ, 1}, +#endif // L1_VOCODER_IF_CHANGE +#if (AUDIO_TASK == 1) +#if (MELODY_E2 == 1) + {MMI_MELODY0_E2_START_REQ, 2}, + {MMI_MELODY1_E2_START_REQ, 3}, +#endif // AUDIO_TASK +#endif // MELODY_E2 +#if (L1_MP3 == 1) + {MMI_MP3_START_REQ, 4}, +#endif // L1_MP3 +#if (AUDIO_TASK == 1) +#if (L1_VOICE_MEMO_AMR == 1) + {MMI_VM_AMR_PLAY_START_REQ, 5}, + {MMI_VM_AMR_RECORD_START_REQ, 6}, +#endif // L1_VOICE_MEMO_AMR +#endif // AUDIO_TASK +#if (L1_AAC == 1) + {MMI_AAC_START_REQ, 7}, +#endif // L1_AAC +#if (L1_PCM_EXTRACTION == 1) + {MMI_PCM_DOWNLOAD_START_REQ, 8}, + {MMI_PCM_UPLOAD_START_REQ, 9} +#endif +}; +#elif (CHIPSET == 10 && BOARD == 35) +const T_SIGNAL_PATCH signal_patch_array[NUM_OF_DYN_DWNLD_PRIMITIVES] = +{ +#if (L1_GTT == 1) + {MMI_GTT_START_REQ, 0}, +#endif // L1_GTT +#if (L1_VOCODER_IF_CHANGE == 1) + {MMI_TCH_VOCODER_CFG_REQ, 1}, +#endif // L1_VOCODER_IF_CHANGE +#if (AUDIO_TASK == 1) +#if (L1_VOICE_MEMO_AMR == 1) + {MMI_VM_AMR_PLAY_START_REQ, 2}, + {MMI_VM_AMR_RECORD_START_REQ, 3} +#endif // L1_VOICE_MEMO_AMR +#endif // AUDIO_TASK +}; +#endif // CHIPSET + + +/* l1_check_flag_for_download_area */ +/* Parameters : Signal Code of the message +// Return : none +// Description : Modify flag if needed to handle different download area when melody E2 is playing */ + + +void l1_check_flag_for_download_area(UWORD32 msg_code) +{ + switch(msg_code) + { +#if (AUDIO_TASK == 1) +#if (MELODY_E2 == 1) + /* MELODY E2 case must be handled carefully: two melodies can be activated for E2: both trigger a dynamic download*/ + /* When one of the two is requested, the corresponding flag used afterwards when it is stopped is set */ + case MMI_MELODY0_E2_START_REQ: + { + + l1a.dyn_dwnld.melody0_E2_flag_activated = TRUE; + } + break; + case MMI_MELODY1_E2_START_REQ: + { + + l1a.dyn_dwnld.melody1_E2_flag_activated = TRUE; + } + break; + + /* When E2 is stopped the activated flag must be reset */ + + case L1_MELODY0_E2_STOP_CON: + { + + l1a.dyn_dwnld.melody0_E2_flag_activated = FALSE; + + } + break; + case L1_MELODY1_E2_STOP_CON: + { + + l1a.dyn_dwnld.melody1_E2_flag_activated = FALSE; + + } + break; +#endif // MELODY_E2 == 1 +#endif // AUDIO_TASK == 1 + } + +} +/*------------------------------------------------------------------------------------------------------------------- */ +/* l1_does_the_incoming_primitive_trigger_dynamic_dwnld */ +/*------------------------------------------------------------------------------------------------------------------- */ +/* */ +/* Parameters : Signal Code of the message, delay flag */ +/* */ +/* Return : TRUE if the primitive triggers a dynamic download, FALSE in the other case */ +/* */ +/* Description : Check if the primitive triggers a dynamic download; if yes it return TRUE, otherwise FALSE */ +/* */ +/* */ +/*------------------------------------------------------------------------------------------------------------------- */ + +BOOL l1_does_the_incoming_primitive_trigger_dynamic_dwnld(UWORD32 msg_code, BOOL delay_flag) +{ + BOOL return_flag = FALSE; + UWORD16 i; + for (i=0;i= MAX_NUM_OF_PATCH_IDS) + { + return_flag = FALSE; + } + else + { + l1a.dyn_dwnld.waiting_patch_fifo.signal_code_vect[num_elem++] = primitive_id; + l1a.dyn_dwnld.waiting_patch_fifo.num_of_elem = num_elem; + } + return return_flag; +} + +/*---------------------------------------------------------- */ +/* l1_pop_Primitive */ +/*---------------------------------------------------------- */ +/* */ +/* Parameters : primitive ID (pointer) */ +/* Return : TRUE if pop is successful, FALSE otherwise */ +/* */ +/* Description : Pop primitive from DELAY FIFO */ +/* */ +/* */ +/*---------------------------------------------------------- */ + +BOOL l1_pop_Primitive(UWORD32 *p_primitive) +{ + UWORD32 primitive_id; + UWORD8 ind; + UWORD32 num_elem = l1a.dyn_dwnld.waiting_patch_fifo.num_of_elem; + BOOL return_flag = TRUE; + + if(num_elem <= 0) + { + return_flag = FALSE; + } + else + { + primitive_id = l1a.dyn_dwnld.waiting_patch_fifo.signal_code_vect[0]; + for (ind = 0;ind +#include +#include "nucleus.h" +#include "l1_confg.h" +#include "sys_types.h" +#include "l1_types.h" +#include "l1audio_cust.h" +#include "l1audio_defty.h" +#include "l1audio_const.h" +#include "l1_const.h" +#include "l1tm_defty.h" + +#if (L1_GTT == 1) + #include "l1gtt_const.h" + #include "l1gtt_defty.h" +#endif + +#if (L1_DYN_DSP_DWNLD == 1) + #include "l1_dyn_dwl_const.h" + #include "l1_dyn_dwl_signa.h" + #include "l1_dyn_dwl_defty.h" + #include "l1_dyn_dwl_msgty.h" + #include "l1_dyn_dwl_error.h" + #include "l1_dyn_dwl_proto.h" + #include "l1_api_hisr.h" +#endif +#if (L1_MP3 == 1) + #include "l1mp3_defty.h" +#endif //L1_MP3 +#if (L1_MIDI == 1) + #include "l1midi_defty.h" +#endif + +#include "l1_defty.h" +#include "cust_os.h" +#include "nu_main.h" +#include "l1audio_signa.h" +#include "l1audio_cust.h" +#include "l1_varex.h" +#include "l1_macro.h" +#include "l1_api_hisr.h" +#include "l1_trace.h" + +#if (L1_DYN_DSP_DWNLD == 1) + +/* Dynamic Download NDB API */ +T_DYN_DWNLD_MCU_DSP *dyn_dwl_ndb; + +#if (CODE_VERSION == SIMULATION) + T_DYN_DWNLD_MCU_DSP dyn_dwl_ndb_sim; + UWORD16 dwnld_area_array[SIZE_DWNLD_AREA_SIMU]; +#endif + +enum states + { + RESET = 0, + WAIT_UNINSTALL = 1, + WAIT_DSP_END_BUFFER = 2, + WAIT_CRC = 3, + WAIT_INSTALL = 4 + }; +/*------------------------------------------------------------------------------------------------------------- */ +/* l1_dyn_dwnld_copy_patch_process() */ +/*------------------------------------------------------------------------------------------------------------- */ +/* */ +/* Parameters : BOOL new_patch: TRUE if the patch is copied from scratch, FALSE if it has been started so far */ +/* */ +/* Return : state in which must be stepped into */ +/* */ +/* Description : Performs the copy of the patch and computes next state of corresponding APIHISR state machine */ +/* */ +/*------------------------------------------------------------------------------------------------------------- */ + +UWORD8 l1_dyn_dwnld_copy_patch_process (BOOL new_patch) +{ + BOOL still_words_to_be_copied; + UWORD16 tmp_dwnld_area_size; + UWORD8 return_state; + UWORD16 *p_src_mcu = NULL; + UWORD16 *p_dest_mcu = NULL; + UWORD16 *tmp_pointer = NULL; + + UWORD16 tmp_patch_size = l1_apihisr.dyn_dwnld.tmp_patch_size; + + /* Copy first N block of data */ + still_words_to_be_copied = l1_init_pointers_and_copy_first_block_of_data(&(tmp_dwnld_area_size), &(tmp_patch_size), &(p_dest_mcu), &(p_src_mcu),new_patch); + + /* Set download command */ + dyn_dwl_ndb->d_api_dwl_download_ctrl = (API) C_DWL_DOWNLOAD_CTRL_DOWNLOAD; + + #if (CODE_VERSION == SIMULATION) + l1_trigger_api_interrupt(); + #endif + + /* Check if there are still words to be copied after first API interrupt generation: if not */ + /* the patch has been completely downloaded and MCU waits for CRC*/ + if(still_words_to_be_copied == FALSE) + { + return_state = WAIT_CRC; + } + + /* If not copy the patch: if download area is bigger than patch size copy until the end of the patch */ + /* Else copy till the end of buffer download area and wait for DSP interrupt */ + else + { + if (tmp_dwnld_area_size >= tmp_patch_size) + { + l1_copy_till_the_end_of_the_patch_and_update_write_pointer(tmp_patch_size,p_dest_mcu,p_src_mcu); + return_state = WAIT_CRC; + } + else + { + l1_copy_till_end_of_dwnld_area_and_update_write_pointer(tmp_dwnld_area_size,p_dest_mcu,&tmp_patch_size,&p_src_mcu); + + /* Save source patch file pointerand temporary patch size*/ + l1_apihisr.dyn_dwnld.running_source_pointer = (UWORD32) p_src_mcu; + l1_apihisr.dyn_dwnld.tmp_patch_size = tmp_patch_size; + + /* Change state*/ + return_state = WAIT_DSP_END_BUFFER; + } + } + return return_state; +} +/*-------------------------------------------------------------*/ +/* l1_dyn_dwnld_apihisr() */ +/*-------------------------------------------------------------*/ +/* */ +/* Parameters : none */ +/* */ +/* Return : n/a */ +/* */ +/* Description : implements Dynamic Download API HISR */ +/* */ +/*-------------------------------------------------------------*/ + +void l1_dyn_dwnld_apihisr() +{ + + UWORD8 *state = &l1_apihisr.dyn_dwnld.state; + + + /* Variables for copy process */ + + xSignalHeaderRec *conf_msg; + BOOL flag_error; + + /* Dynamic Download error handler : check if critical error occured */ + if( l1_dyn_dwnld_apihisr_error_handler() == TRUE ) + { + /* Send notification to L1A */ + conf_msg = os_alloc_sig(sizeof(T_API_L1_DYN_DWNLD_STOP)); + DEBUGMSG(status,NU_ALLOC_ERR) + conf_msg->SignalCode = API_L1_DYN_DWNLD_STOP; + ((T_API_L1_DYN_DWNLD_STOP *) (conf_msg->SigP))->error = dyn_dwl_ndb->d_api_dwl_error_code; + dyn_dwl_ndb->d_api_dwl_error_code = C_DWL_ERR_RESET; + os_send_sig(conf_msg,L1C1_QUEUE); + DEBUGMSG(status,NU_SEND_QUEUE_ERR) + + /* Branch state */ + *state = RESET; + flag_error = TRUE; + return; + } + else + { + flag_error = FALSE; + } + + /****************/ + /*STATE MACHINE */ + /****************/ + + while (1){ + switch(*state) + { + /*********/ + /* RESET */ + /*********/ + case RESET: + { + /* Check reset init command (if reset by DSP) / Restart in case dynamic download delayed */ + if ( dyn_dwl_ndb->d_api_dwl_download_ctrl == (API) C_DWL_DOWNLOAD_CTRL_DSP_ACK || + l1a_apihisr_com.dyn_dwnld.command.restart == TRUE) + { + if (flag_error == FALSE) + { + + /* Send confirmation to L1A */ + conf_msg = os_alloc_sig(0); + DEBUGMSG(status,NU_ALLOC_ERR) + conf_msg->SignalCode = API_L1_DYN_DWNLD_START_CON; + os_send_sig(conf_msg,L1C1_QUEUE); + DEBUGMSG(status,NU_SEND_QUEUE_ERR) + + /* Store patch IDs to install counter in global API */ + l1_apihisr.dyn_dwnld.patch_ids_counter = l1a_apihisr_com.dyn_dwnld.copy_parameters.num_of_elem; + + /* Reset command */ + l1a_apihisr_com.dyn_dwnld.command.restart = FALSE; + + /* Test if number of uninstall elements is greater than zero */ + if ( l1a_apihisr_com.dyn_dwnld.uninstall_parameters.num_of_elem > 0 ) + { + /* Copy num of elem L1A-API variable counter into global uninstall counter */ + l1_apihisr.dyn_dwnld.uninstall_counter = l1a_apihisr_com.dyn_dwnld.uninstall_parameters.num_of_elem; + + l1_set_uninstall_parameters(); + + #if (CODE_VERSION == SIMULATION) + l1_trigger_api_interrupt(); + #endif + + /* Change state */ + *state = WAIT_UNINSTALL; + } + else /* No elements to uninstall*/ + { + /* Reset patch size */ + l1_apihisr.dyn_dwnld.tmp_patch_size = 0; + + /* Copy the patch and update current state*/ + *state = l1_dyn_dwnld_copy_patch_process(TRUE); + + } + } + } + return; + } /* end case RESET */ +//omaps00090550 break; + + /******************/ + /* WAIT_UNINSTALL */ + /******************/ + case WAIT_UNINSTALL: + { + /* Check uninstall command (if reset by DSP) */ + if ( dyn_dwl_ndb->d_api_dwl_download_ctrl == (API) C_DWL_DOWNLOAD_CTRL_DSP_ACK ) + { + /* Decrement uninstall counter */ + l1_apihisr.dyn_dwnld.uninstall_counter--; + + /* Check uninstall counter: if it is 0 no more uninstall to perform*/ + if ( l1_apihisr.dyn_dwnld.uninstall_counter == 0 ) + { + /* Send confirmation to L1A */ + conf_msg = os_alloc_sig(0); + DEBUGMSG(status,NU_ALLOC_ERR) + conf_msg->SignalCode = API_L1_DYN_DWNLD_UNINST_OK; + os_send_sig(conf_msg,L1C1_QUEUE); + DEBUGMSG(status,NU_SEND_QUEUE_ERR) + + /* Reset patch size */ + l1_apihisr.dyn_dwnld.tmp_patch_size = 0; + + /* Copy the patch and update current state*/ + *state = l1_dyn_dwnld_copy_patch_process(TRUE); + } + else /* there are some uninstall to perform */ + { + l1_set_uninstall_parameters(); + + #if (CODE_VERSION == SIMULATION) + l1_trigger_api_interrupt(); + #endif + } + } + return; + } /* end case WAIT_UNINSTALL */ +//omaps00090550 break; + + /***********************/ + /* WAIT_DSP_END_BUFFER */ + /***********************/ + case WAIT_DSP_END_BUFFER: + { + if ( dyn_dwl_ndb->d_api_dwl_download_ctrl == (API) C_DWL_DOWNLOAD_CTRL_DSP_ACK ) + { + /* Copy the patch and update current state*/ + *state = l1_dyn_dwnld_copy_patch_process(FALSE); + } + return; + } /* end case WAIT_DSP_END_BUFFER */ +//omaps00090550 break; + + /************/ + /* WAIT_CRC */ + /************/ + case WAIT_CRC: + { + /* Check if DSP install command is reset */ + if (dyn_dwl_ndb->d_api_dwl_download_ctrl == (API) C_DWL_DOWNLOAD_CTRL_DSP_ACK ) + { + /* Test if CRC is OK */ + if ( dyn_dwl_ndb->d_api_dwl_crc != l1a_apihisr_com.dyn_dwnld.copy_parameters.patch_data[l1a_apihisr_com.dyn_dwnld.copy_parameters.num_of_elem-l1_apihisr.dyn_dwnld.patch_ids_counter].crc) /* CRC not OK */ + { + /* Send notification to L1A */ + conf_msg = os_alloc_sig(sizeof(T_API_L1_CRC_NOT_OK)); + DEBUGMSG(status,NU_ALLOC_ERR) + conf_msg->SignalCode = API_L1_CRC_NOT_OK; + ((T_API_L1_CRC_NOT_OK *) (conf_msg->SigP))->patch_id = dyn_dwl_ndb->d_api_dwl_crc; + os_send_sig(conf_msg,L1C1_QUEUE); + DEBUGMSG(status,NU_SEND_QUEUE_ERR) + + /* Change state */ + *state = RESET; + } + else /* CRC OK */ + { + conf_msg = os_alloc_sig(sizeof(T_API_L1_CRC_NOT_OK)); + DEBUGMSG(status,NU_ALLOC_ERR) + conf_msg->SignalCode = API_L1_CRC_OK; + ((T_API_L1_CRC_NOT_OK *) (conf_msg->SigP))->patch_id = l1a_apihisr_com.dyn_dwnld.copy_parameters.patch_data[ l1a_apihisr_com.dyn_dwnld.copy_parameters.num_of_elem-l1_apihisr.dyn_dwnld.patch_ids_counter].crc; + os_send_sig(conf_msg,L1C1_QUEUE); + DEBUGMSG(status,NU_SEND_QUEUE_ERR) + *state = WAIT_INSTALL; + + /* Set install parameters */ + + dyn_dwl_ndb->d_api_dwl_function_address[0] = + (API) (l1a_apihisr_com.dyn_dwnld.copy_parameters.patch_data[l1a_apihisr_com.dyn_dwnld.copy_parameters.num_of_elem-l1_apihisr.dyn_dwnld.patch_ids_counter].address_to_install & 0x0000FFFF); + dyn_dwl_ndb->d_api_dwl_function_address[1] = + (API) ((l1a_apihisr_com.dyn_dwnld.copy_parameters.patch_data[l1a_apihisr_com.dyn_dwnld.copy_parameters.num_of_elem-l1_apihisr.dyn_dwnld.patch_ids_counter].address_to_install >> 16) & 0x0000FFFF); + + dyn_dwl_ndb->d_api_dwl_download_ctrl = (API) C_DWL_DOWNLOAD_CTRL_INSTALL; + + #if (CODE_VERSION == SIMULATION) + l1_trigger_api_interrupt(); + #endif + } + } + return; + } /* end case WAIT_CRC */ +//omaps00090550 break; + + /****************/ + /* WAIT_INSTALL */ + /****************/ + case WAIT_INSTALL: + { + /* Check if DSP install command is reset */ + if (dyn_dwl_ndb->d_api_dwl_download_ctrl == (API) C_DWL_DOWNLOAD_CTRL_DSP_ACK ) + { + /* Decrement patch counter */ + l1_apihisr.dyn_dwnld.patch_ids_counter--; + + /* Test if patch counter is null */ + if ( l1_apihisr.dyn_dwnld.patch_ids_counter == 0 ) + { + /* Send notification to L1A */ + conf_msg = os_alloc_sig(0); + DEBUGMSG(status,NU_ALLOC_ERR) + conf_msg->SignalCode = API_L1_DYN_DWNLD_FINISHED; + os_send_sig(conf_msg,L1C1_QUEUE); + DEBUGMSG(status,NU_SEND_QUEUE_ERR) + *state = RESET; + } + else + { + /* Reset patch size */ + l1_apihisr.dyn_dwnld.tmp_patch_size = 0; + + /* Copy the patch and update current state*/ + *state = l1_dyn_dwnld_copy_patch_process(TRUE); + } + } + return; + } /* end case WAIT_INSTALL */ +//omaps00090550 break; + } /* end switch */ +} /* end while */ +} + +/*-------------------------------------------------------------*/ +/* l1_dyn_dwnld_apihisr_error_handler() */ +/*-------------------------------------------------------------*/ +/* */ +/* Parameters : error_code (OUT) error_code received from DSP */ +/* */ +/* Return : TRUE if errors signaled by DSP */ +/* */ +/*-------------------------------------------------------------*/ + BOOL l1_dyn_dwnld_apihisr_error_handler() +{ + BOOL critical; + + /* Initialisation */ + critical = FALSE; + + if(dyn_dwl_ndb->d_api_dwl_error_code != 0) + { + critical = TRUE; + } + + return critical; +} + + +#endif /* L1_DYN_DSP_DWNLD */ + diff -r 3f44bb6108b9 -r 06d94fdaadf6 chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_async.c --- a/chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_async.c Wed Oct 21 03:48:05 2015 +0000 +++ b/chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_async.c Wed Oct 21 21:41:05 2015 +0000 @@ -1,1 +1,718 @@ -/* dummy C source file */ +/************* Revision Controle System Header ************* + * GSM Layer 1 software + * L1_DYN_DWL_ASYNC.C + * + * Filename l1_dyn_dwl_async.c + * Copyright 2004 (C) Texas Instruments + * + ************* Revision Controle System Header *************/ +#include +#include +#if (OP_RIV_AUDIO == 1) + #include "rv/rv_general.h" +#endif +#include "nucleus.h" +#include "l1_confg.h" +#include "l1_types.h" +#include "sys_types.h" +#include "cust_os.h" +#include "l1audio_signa.h" +#include "l1audio_const.h" +#include "l1audio_cust.h" +#include "l1audio_defty.h" +#include "l1_const.h" +#include "l1tm_defty.h" +#if (L1_GTT == 1) + #include "l1gtt_const.h" + #include "l1gtt_defty.h" +#endif +#if (L1_DYN_DSP_DWNLD==1) + #include "l1_dyn_dwl_defty.h" + #include "l1_dyn_dwl_msgty.h" + #include "l1_dyn_dwl_const.h" + #include "l1_dyn_dwl_signa.h" + #include "l1_dyn_dwl_error.h" + #include "l1_dyn_dwl_proto.h" +#endif +#if (L1_MP3 == 1) + #include "l1mp3_defty.h" +#endif //L1_MP3 +#if (L1_MIDI == 1) + #include "l1midi_defty.h" +#endif +#if (L1_AAC == 1) + #include "l1aac_defty.h" +#endif //L1_AAC + +#include "l1_defty.h" +#include "l1_varex.h" +#include "l1_trace.h" +#include "sys_dma.h" + + +#if (L1_DYN_DSP_DWNLD == 1) +#if(CODE_VERSION == SIMULATION) + extern VOID trace_fct_simu_dyn_dwnld(CHAR *fct_name); +#endif // CODE_VERSION == SIMULATION + + + +extern UWORD32 dyn_dwnld_address_vect[]; +extern const UWORD8 *dyn_dwnld_copy_MCU_vect[]; +extern UWORD16 dyn_dwnld_crc_vect[]; +extern UWORD16 size_vect[]; + +/*---------------------------------------------------------------------------------------------------------*/ +/* l1_patch_id2string */ +/*---------------------------------------------------------------------------------------------------------*/ +/* */ +/* Parameters : patch identificator "patch_id", string vector "vector" which identifies the patch */ +/* */ +/* Return : Fills the string vector containing the patch id by reference */ +/* */ +/* */ +/* Description : Links the patch ID number to its string value */ +/* */ +/* */ +/*---------------------------------------------------------------------------------------------------------*/ + +void l1_patch_id2string(UWORD16 patch_id, char* vect) +{ + + switch(patch_id) + { + +#if ((CODE_VERSION == SIMULATION) || (((CHIPSET == 12) || (CHIPSET == 15)))) + case MP3_PATCH: + { + vect[0] = 'M'; + vect[1] = 'P'; + vect[2] = '3'; + vect[3] = '\0'; + } + break; +#endif + case MMS_PATCH: + { + vect[0] = 'M'; + vect[1] = 'M'; + vect[2] = 'S'; + vect[3] = '\0'; + } + break; + +#if ((CODE_VERSION == SIMULATION) || (((CHIPSET == 12) || (CHIPSET == 15)))) + case E2_PATCH: + { + vect[0] = 'E'; + vect[1] = '2'; + vect[2] = ' '; + vect[3] = '\0'; + } + break; +#endif + case TTY_PATCH: + { + vect[0] = 'T'; + vect[1] = 'T'; + vect[2] = 'Y'; + vect[3] = '\0'; + } + break; + case SPEECH_ACOUSTIC_PATCH: + { + vect[0] = 'A'; + vect[1] = 'N'; + vect[2] = 'R'; + vect[3] = '\0'; + } + break; +#if ((CODE_VERSION == SIMULATION) || (CHIPSET == 12) || (CHIPSET == 15)) + case AAC_PATCH: + { + vect[0] = 'A'; + vect[1] = 'A'; + vect[2] = 'C'; + vect[3] = '\0'; + } + break; +#endif +#if ((CODE_VERSION == SIMULATION) || (CHIPSET == 12) || (CHIPSET == 15)) + case PCM_EXTRACTION_PATCH: + { + vect[0] = 'P'; + vect[1] = 'C'; + vect[2] = 'M'; + vect[3] = '\0'; + } + break; +#endif + + } +} + +/*----------------------------------------------------------------------------------------*/ +/* l1_dynamic_download_manager */ +/*----------------------------------------------------------------------------------------*/ +/* */ +/* Parameters : Signal Code of the message, delay flag */ +/* */ +/* Return : True if the primitives triggers a dynamic download and sets all the */ +/* parameters to perform a dynamic download, false otherwise */ +/* */ +/* Description : Implements the dynamic download manager algorithm */ +/* */ +/* */ +/*----------------------------------------------------------------------------------------*/ + + +BOOL l1_dynamic_download_manager(UWORD32 SignalCode, BOOL delay_flag) +{ + + UWORD16 temp_patch_array[MAX_NUM_OF_PATCH_IDS]; + UWORD16 temp_num_patch; + UWORD16 num_of_patch_id_to_dwnld; + UWORD16 num_of_uninstall_elem; + UWORD16 i; + UWORD16 patch_id_uninstall_vect[MAX_NUM_OF_PATCH_IDS]; + UWORD16 patch_id; + UWORD16 temp_patch_id[MAX_NUM_OF_PATCH_IDS]= {0}; //omaps00090550 + BOOL return_flag = FALSE; + + // Primitive is processed only if it triggers a dynamic download or there is a delay + if(delay_flag == TRUE || l1_does_the_incoming_primitive_trigger_dynamic_dwnld(SignalCode, FALSE) == TRUE) + { + + //---------------------------------------------------------------------- + // Compute which patch ids (passed by reference) and the number of patches to install + //---------------------------------------------------------------------- + + temp_num_patch= l1_lookup_primitive_patch_matrix(SignalCode,temp_patch_array); + i=0; + num_of_patch_id_to_dwnld = 0; + + //-------------------------------------------- + // Check if there is any patch that still must be installed + //-------------------------------------------- + + while(i < temp_num_patch) + { + if(l1_is_patch_already_installed(temp_patch_array[i]) == FALSE) + { + l1a.dyn_dwnld.next_patch_id[num_of_patch_id_to_dwnld++] = temp_patch_array[i]; + } + i++; + } + + //-------------------------- + // Manage patch incompatibilities + //-------------------------- + + // if there's at least one patch that must be installed + if(num_of_patch_id_to_dwnld!=0) + { + return_flag = TRUE; + // Check if already installed patches are compatible or not and retrieve number of patches to uninstall and their ids + if(l1_manage_patch_incompatibilty(num_of_patch_id_to_dwnld,&(num_of_uninstall_elem),patch_id_uninstall_vect)) + { + // Set L1A-API HISR variable: no elements to uninstall + l1a_apihisr_com.dyn_dwnld.uninstall_parameters.num_of_elem=0; + + // Trace number of elements to uninstall +#if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) + if((trace_info.current_config->l1_dyn_trace) & (1<l1_dyn_trace) & (1<l1_dyn_trace) & (1<l1_dyn_trace) & (1<l1_dyn_trace) & (1<SignalCode; + UWORD16 i; + UWORD16 delay_patch_array[MAX_NUM_OF_PATCH_IDS]; + UWORD16 delay_num_patch; + UWORD32 delay_primitive; + + while(1) + { + switch(*state) + { + // ********* + // * RESET * + // ********* + case RESET: + { + // Reset intra L1 variables: L1A-L1S interface, L1A-API interface, global API HISR variables + l1_dyn_dwnld_reset(); + + // Change state + *state = WAIT_INIT; + } + break; + + // ****************** + // * WAIT START REQ * + // ****************** + case WAIT_INIT: + { + + // *----------------------------* + // * Dynamic download manager * + // *----------------------------* + + + /* Run the dynamic download manager */ + if (l1_dynamic_download_manager(SignalCode, FALSE) == TRUE) + { + + /* Initialisation of dynamic download process */ + l1a_dyn_dwnld_set_process(); + + // Change state + *state=WAIT_RESULT; + + } + return; + } +//omaps00090550 break; + + // *************** + // * WAIT_RESULT * + // *************** + + case WAIT_RESULT: + { + if (l1_does_the_incoming_primitive_trigger_dynamic_dwnld(SignalCode,TRUE) == TRUE) + { + if (l1_push_Primitive(SignalCode) == TRUE) + { + delay_num_patch = l1_lookup_primitive_patch_matrix(SignalCode,delay_patch_array); + + // Tell other state machines that they have to stay in steady state waiting for dynamic download activity to be completed + l1_set_semaphores_for_all_state_machines_involved(delay_num_patch, delay_patch_array); + } + else + { +#if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) + if((trace_info.current_config->l1_dyn_trace) & (1<l1_dyn_trace) & (1<SigP))->patch_id); +#if(CODE_VERSION == SIMULATION) + trace_fct_simu_dyn_dwnld(str); +#else + rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); +#endif // CODE_VERSION == SIMULATION + } +#endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) + + // Set recovery flag to TRUE; + l1a_l1s_com.recovery_flag = TRUE; + *state = RESET; + } + break; + case API_L1_DYN_DWNLD_STOP: + { +#if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4) || (TRACE_TYPE == 5)) + if((trace_info.current_config->l1_dyn_trace) & (1<l1_dyn_trace) & (1<SigP))->patch_id); +#if(CODE_VERSION == SIMULATION) + trace_fct_simu_dyn_dwnld(str); +#else + rvt_send_trace_cpy((T_RVT_BUFFER)str,trace_info.l1_trace_user_id,strlen(str),RVT_ASCII_FORMAT); +#endif // CODE_VERSION == SIMULATION + } +#endif // (TRACE_TYPE == 1) || (TRACE_TYPE == 4) + } + break; + case API_L1_DYN_DWNLD_FINISHED: + { + + // Store currently installed patch + for (i=0;il1_dyn_trace) & (1<0); + + while(remaining_primitive_flag && process_continue_flag) + { + l1_pop_Primitive(&(delay_primitive)); + if (l1_dynamic_download_manager(delay_primitive, TRUE) == TRUE) + { + process_continue_flag=0; + delay_primitive_processed_flag=1; + // If yes set the restart command at apihisr level + l1a_apihisr_com.dyn_dwnld.command.restart = TRUE; + + /********** WORKAROUND *************/ +#if (OP_RIV_AUDIO == 1) + { + // WARNING: temporary until os_activate_hisr() is declared in L3 functions + extern NU_HISR apiHISR; + NU_Activate_HISR(&apiHISR); + } +#else + os_activate_hisr(API_HISR); +#endif // OP_RIV_AUDIO == 1 + /********** WORKAROUND *************/ + *state = WAIT_RESULT; + } + remaining_primitive_flag = (l1_check_Fifo_Primitive()>0); + } + + // else stop the DSP background task as no other patch must be downloaded + if(delay_primitive_processed_flag == 0) + { +#if ((TRACE_TYPE == 1) || (TRACE_TYPE == 4)) + // Enable trace DSP upon Dynamic Download deactivation + l1_enable_dsp_trace(); + //Trace_dsp_dump(); +#endif // omaps00090550 #14-D removal + l1a_l1s_com.dyn_dwnld_task.stop=TRUE; + *state = WAIT_STOP; + } + } + } + break; + } // switch(SignalCode) + return; + } +//omaps00090550 break; // case WAIT_RESULT + case WAIT_STOP: + { + /* In case of a primitive which triggers a dynamic download arrives we must start over */ + if (l1_does_the_incoming_primitive_trigger_dynamic_dwnld(SignalCode,TRUE) == TRUE) + { + /* Run the dynamic download manager */ + if (l1_dynamic_download_manager(SignalCode, FALSE) == TRUE) + { + /* Initialisation of dynamic download process */ + l1a_dyn_dwnld_set_process(); + + // Change state + *state=WAIT_RESULT; + } + } + else if (SignalCode == L1_DYN_DWNLD_STOP_CON) + { + // DYN DWNLD HISR must be deactivated + l1_apihisr.dyn_dwnld.running=FALSE; + // Change state + *state=RESET; + } + return; + } +//omaps00090550 break; + } + } +} +#endif // L1_DYN_DSP_DWNLD diff -r 3f44bb6108b9 -r 06d94fdaadf6 chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_func.c --- a/chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_func.c Wed Oct 21 03:48:05 2015 +0000 +++ b/chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_func.c Wed Oct 21 21:41:05 2015 +0000 @@ -1,1 +1,392 @@ -/* dummy C source file */ +/************* Revision Controle System Header ************* + * GSM Layer 1 software + * L1_DYN_DWL_FUNC.C + * + * Filename l1_dyn_dwl_func.c + * Copyright 2004 (C) Texas Instruments + * + ************* Revision Controle System Header *************/ + +#include +#include +#include "l1_confg.h" +#include "l1_types.h" +#include "l1_const.h" +#include "l1_signa.h" +#include "sys_types.h" + +#if(L1_DYN_DSP_DWNLD == 1) +#include "l1_dyn_dwl_const.h" +#include "l1_dyn_dwl_proto.h" +#include "l1_dyn_dwl_defty.h" +#endif +#if TESTMODE + #include "l1tm_defty.h" +#endif +#if (AUDIO_TASK == 1) + #include "l1audio_const.h" + #include "l1audio_cust.h" + #include "l1audio_defty.h" +#endif +#if (L1_GTT == 1) + #include "l1gtt_const.h" + #include "l1gtt_defty.h" +#endif +#if (L1_MP3 == 1) + #include "l1mp3_defty.h" +#endif //L1_MP3 +#if (L1_MIDI == 1) + #include "l1midi_defty.h" +#endif + + #include "l1_defty.h" + #include "l1_varex.h" + #include "l1_macro.h" + +#if (L1_DYN_DSP_DWNLD == 1) + #ifndef NULL +#define NULL 0 + #endif + + extern T_DYN_DWNLD_MCU_DSP *dyn_dwl_ndb; + #if (CODE_VERSION == SIMULATION) + extern T_DYN_DWNLD_MCU_DSP dyn_dwl_ndb_sim; + extern UWORD16 dwnld_area_array[SIZE_DWNLD_AREA_SIMU]; +#endif // CODE_VERSION == SIMULATION + + +/*---------------------------------------------------------------------------- */ +/* l1_initialize_patch_parameters */ +/*------------------------------------------------------------------------- */ +/* */ +/* Parameters : */ +/* */ +/* Return : size of the patch */ +/* */ +/* Description : Initialize patch parameters and returns the size of the patch*/ +/* */ +/* */ +/*---------------------------------------------------------------------------- */ + +UWORD16 l1_initialize_patch_parameters(void) +{ + UWORD16 patch_size = 0; + + /* Initialize download patch parameters*/ + l1_apihisr.dyn_dwnld.running_source_pointer = l1a_apihisr_com.dyn_dwnld.copy_parameters.patch_data[l1a_apihisr_com.dyn_dwnld.copy_parameters.num_of_elem-l1_apihisr.dyn_dwnld.patch_ids_counter].start_MCU_copy_address; + patch_size = l1a_apihisr_com.dyn_dwnld.copy_parameters.patch_data[l1a_apihisr_com.dyn_dwnld.copy_parameters.num_of_elem-l1_apihisr.dyn_dwnld.patch_ids_counter].size_array; + dyn_dwl_ndb->d_api_dwl_crc = 0x0; + return patch_size; +} + +/*---------------------------------------------------------------------------- */ +/* l1_set_uninstall_parameters */ +/*------------------------------------------------------------------------- */ +/* */ +/* Parameters : void */ +/* */ +/* Return : void */ +/* */ +/* Description : Set uninstall parameters */ +/* */ +/* */ +/*---------------------------------------------------------------------------- */ + +void l1_set_uninstall_parameters(void) +{ + /* Set next uninstall adress (pointer incremented) */ + dyn_dwl_ndb->d_api_dwl_function_address[0] = (API) (l1a_apihisr_com.dyn_dwnld.uninstall_parameters.address[l1a_apihisr_com.dyn_dwnld.uninstall_parameters.num_of_elem - l1_apihisr.dyn_dwnld.uninstall_counter] & 0x0000FFFF); + dyn_dwl_ndb->d_api_dwl_function_address[1] = (API) ((l1a_apihisr_com.dyn_dwnld.uninstall_parameters.address[l1a_apihisr_com.dyn_dwnld.uninstall_parameters.num_of_elem - l1_apihisr.dyn_dwnld.uninstall_counter] >> 16) & 0x0000FFFF); + + /* Set uninstall command */ + dyn_dwl_ndb->d_api_dwl_download_ctrl = (API) C_DWL_DOWNLOAD_CTRL_UNINSTALL; +} + +/*---------------------------------------------------------------------------- */ +/* l1_initialize_pointers_for_copy */ +/*------------------------------------------------------------------------- */ +/* */ +/* Parameters : address of source and destination pointer */ +/* */ +/* Return : source and destination address modified by reference */ +/* */ +/* Description : Initialize the pointers for the copy */ +/* */ +/* */ +/*---------------------------------------------------------------------------- */ + +void l1_initialize_pointers_for_copy(UWORD16 **pp_dest_mcu, UWORD16 **pp_src_mcu) +{ + /* BEGIN: Initialize download area parameters at start download area */ + dyn_dwl_ndb->d_api_dwl_write_pointer = l1a_apihisr_com.dyn_dwnld.copy_parameters.start_of_dwnld_area - 1; // correction + + /* Initialize pointers */ +#if (CODE_VERSION == SIMULATION) + *pp_dest_mcu = (UWORD16 *) dwnld_area_array; +#else + *pp_dest_mcu = (UWORD16 *) API_address_dsp2mcu(l1a_apihisr_com.dyn_dwnld.copy_parameters.start_of_dwnld_area); +#endif // CODE_VERSION == SIMULATION + + *pp_src_mcu = (UWORD16 *) l1_apihisr.dyn_dwnld.running_source_pointer; +} + +/*---------------------------------------------------------------------------- */ +/* l1_copy_till_the_end_of_the_patch_and_update_write_pointer */ +/*---------------------------------------------------------------------------- */ +/* */ +/* Parameters : size of the patch, source and destination pointer */ +/* */ +/* Return : none */ +/* */ +/* Description : Copy until the end of the patch is reached */ +/* */ +/* */ +/*---------------------------------------------------------------------------- */ + +void l1_copy_till_the_end_of_the_patch_and_update_write_pointer(UWORD16 tmp_patch_size, UWORD16* p_dest_mcu, UWORD16* p_src_mcu) +{ + while (tmp_patch_size > NUM_WORDS_COPY_API) + { + l1_memcpy_16bit(p_dest_mcu,p_src_mcu, NUM_WORDS_COPY_API*sizeof(UWORD16)); + p_dest_mcu += NUM_WORDS_COPY_API; + p_src_mcu += NUM_WORDS_COPY_API; + tmp_patch_size -= NUM_WORDS_COPY_API; + dyn_dwl_ndb->d_api_dwl_write_pointer += NUM_WORDS_COPY_API; + } + if (tmp_patch_size != 0) + { + l1_memcpy_16bit(p_dest_mcu,p_src_mcu, tmp_patch_size*sizeof(UWORD16)); + dyn_dwl_ndb->d_api_dwl_write_pointer += tmp_patch_size; + } +} + +/*---------------------------------------------------------------------------- */ +/* l1_copy_till_end_of_dwnld_area_and_update_write_pointer */ +/*---------------------------------------------------------------------------- */ +/* */ +/* Parameters : address of size of the patch, size of download area, */ +/* addresses of source pointer, destination pointer */ +/* */ +/* Return : source pointer and size modified by reference */ +/* */ +/* Description : Copy until the end of download area is reached */ +/* */ +/* */ +/*---------------------------------------------------------------------------- */ + +void l1_copy_till_end_of_dwnld_area_and_update_write_pointer(UWORD16 tmp_dwnld_area_size,UWORD16 *p_dest_mcu, UWORD16 *p_tmp_patch_size, UWORD16 **pp_src_mcu) +{ + UWORD16 tmp_patch_size = *p_tmp_patch_size; + UWORD16 *p_src_mcu = (UWORD16 *)*pp_src_mcu; + + while (tmp_dwnld_area_size > NUM_WORDS_COPY_API) + { + l1_memcpy_16bit(p_dest_mcu,p_src_mcu, NUM_WORDS_COPY_API*sizeof(UWORD16)); + p_dest_mcu += NUM_WORDS_COPY_API; + p_src_mcu += NUM_WORDS_COPY_API; + tmp_patch_size -= NUM_WORDS_COPY_API; + tmp_dwnld_area_size -= NUM_WORDS_COPY_API; + dyn_dwl_ndb->d_api_dwl_write_pointer += NUM_WORDS_COPY_API; + } + + if (tmp_dwnld_area_size > 0) + { + l1_memcpy_16bit(p_dest_mcu,p_src_mcu, tmp_dwnld_area_size*sizeof(UWORD16)); + p_src_mcu += tmp_dwnld_area_size; + tmp_patch_size -= tmp_dwnld_area_size; + dyn_dwl_ndb->d_api_dwl_write_pointer += tmp_dwnld_area_size; + } + *pp_src_mcu = (UWORD16 *) p_src_mcu; + *p_tmp_patch_size = tmp_patch_size; +} + +/*---------------------------------------------------------------------------- */ +/* l1_copy_first_N_words */ +/*---------------------------------------------------------------------------- */ +/* */ +/* Parameters : address of size of the patch, address of size of download area,*/ +/* addresses of source pointer, address of destination pointer */ +/* */ +/* Return : source and destination pointer modified by reference */ +/* size of download area and patch area modified by reference */ +/* */ +/* Description : Copy the min(N, remaining size of the patch) at the beginning */ +/* download area */ +/* */ +/* */ +/*---------------------------------------------------------------------------- */ + +BOOL l1_copy_first_N_words (UWORD16 *dwnld_area_size_p, UWORD16 *patch_area_size_p, UWORD16 **pp_dest_mcu, UWORD16 **pp_src_mcu) +{ + BOOL return_flag; + UWORD16 num_words_interrupt; + UWORD16 tmp_patch_size = *patch_area_size_p; + UWORD16 tmp_dwnld_area_size = *dwnld_area_size_p; + UWORD16 *p_dest_mcu =(UWORD16 *)*pp_dest_mcu; + UWORD16 *p_src_mcu = (UWORD16 *)*pp_src_mcu; + + /* Copy first N words and generate API interrupt*/ + if (tmp_patch_size > NUM_WORDS_COPY_API) + { + num_words_interrupt = NUM_WORDS_COPY_API; + return_flag = TRUE; + } + else + { + num_words_interrupt = tmp_patch_size; + return_flag = FALSE; + } + + l1_memcpy_16bit(p_dest_mcu,p_src_mcu, num_words_interrupt*sizeof(UWORD16)); + + p_dest_mcu += num_words_interrupt; + p_src_mcu += num_words_interrupt; + + tmp_patch_size -= num_words_interrupt; + tmp_dwnld_area_size -= num_words_interrupt; + + dyn_dwl_ndb->d_api_dwl_write_pointer+=num_words_interrupt; + + *patch_area_size_p = tmp_patch_size; + *dwnld_area_size_p = tmp_dwnld_area_size; + *pp_dest_mcu = (UWORD16 *)p_dest_mcu; + *pp_src_mcu = (UWORD16 *)p_src_mcu ; + + return return_flag; +} + +/*---------------------------------------------------------------------------- */ +/* l1_initialize_download_area_parameters */ +/*---------------------------------------------------------------------------- */ +/* */ +/* Parameters : none */ +/* */ +/* */ +/* Return : download area size */ +/* */ +/* Description : Initialize download area: all the parameters */ +/* */ +/* */ +/*---------------------------------------------------------------------------- */ + +UWORD16 l1_initialize_download_area_parameters(void) +{ + UWORD16 dwnld_area_size = 0; + + /* Set download address and size in API-DSP com */ + dyn_dwl_ndb->d_api_dwl_function_address[0] = l1a_apihisr_com.dyn_dwnld.copy_parameters.start_of_dwnld_area; + dyn_dwl_ndb->d_api_dwl_function_address[1] = 0x0; + +#if (CODE_VERSION == SIMULATION) + dyn_dwl_ndb->d_api_dwl_size = SIZE_DWNLD_AREA_SIMU; +#else + dyn_dwl_ndb->d_api_dwl_size = l1a_apihisr_com.dyn_dwnld.copy_parameters.size_of_dwnld_area; +#endif // CODE_VERSION == SIMULATION + + dwnld_area_size = l1a_apihisr_com.dyn_dwnld.copy_parameters.size_of_dwnld_area; + return dwnld_area_size; +} + +/*---------------------------------------------------------------------------- */ +/* l1_init_pointers_and_copy_first_block_of_data */ +/*---------------------------------------------------------------------------- */ +/* */ +/* Parameters : address of size of the patch, address of size of download area,*/ +/* addresses of source pointer, address of destination pointer */ +/* new patch flag */ +/* Return : TRUE if N< size of patch, FALSE otherwise */ +/* source and destination pointer modified by reference */ +/* size of download area and patch area modified by reference, */ +/* */ +/* Description : Initialize pointers and starts the copy. */ +/* */ +/* */ +/* */ +/*---------------------------------------------------------------------------- */ + +BOOL l1_init_pointers_and_copy_first_block_of_data(UWORD16 *dwnld_area_size_p, UWORD16 *patch_size_p, UWORD16 **pp_dest_mcu, UWORD16 **pp_src_mcu, BOOL new_patch) +{ + BOOL return_flag; + + /* Initialize download area*/ + *dwnld_area_size_p = l1_initialize_download_area_parameters(); + + /* In case this is a new patch, initialize patch parameters*/ + if (new_patch == TRUE) + *patch_size_p = l1_initialize_patch_parameters(); + + /* Initialize pointers for the copy*/ + l1_initialize_pointers_for_copy(pp_dest_mcu, pp_src_mcu); + + /* If this is a new patch, the header of the patch must be taken off from the copy*/ + if (new_patch == TRUE) + { + /* Take the initial header off */ + *pp_src_mcu= (*pp_src_mcu)+HEADER_PATCH_SIZE; + *patch_size_p= (*patch_size_p)-HEADER_PATCH_SIZE; + } + + /* Copy first N words; if remaining size of the patch is smaller than N copy until the end of the patch */ + /* In this case, return FALSE as there are no more words to be copied*/ + return_flag = l1_copy_first_N_words (dwnld_area_size_p, patch_size_p, pp_dest_mcu, pp_src_mcu); + + return return_flag; +} + + +/*---------------------------------------------------------------------------- */ +/* l1_set_dyn_dwnld_install_vect */ +/*---------------------------------------------------------------------------- */ +/* */ +/* Parameters : size vector, destination address vector, crc vector */ +/* patch code vector, identifier i of the patch */ +/* new patch flag */ +/* Return : TRUE operation is successful, FALSE otherwise */ +/* */ +/* Description : Compute address, size and crc of i-th patch */ +/* */ +/*---------------------------------------------------------------------------- */ + +BOOL l1_set_dyn_dwnld_install_vect(UWORD16* size_p, UWORD32* dest_addr, UWORD16* crc_vect, const UWORD8 *patch_array_code, UWORD16 i) +{ + UWORD16 full_size_32_bit, size, size_ext, dsp_addr, dsp_addr_ext, crc_value; + UWORD16 *codePtr; + UWORD16 size_total = 0; + BOOL status_flag = FALSE; + codePtr = (UWORD16 *) patch_array_code; + + if ( (0 == *codePtr++) && (0 == *codePtr++)) + { // NULL TAG detection + if ( (3 == *codePtr++) && (0 == *codePtr++)) + { // coff2c version number detection + size = *codePtr++; + size_ext = *codePtr++; + + // first header:4 + size_total+=HEADER_PATCH_SIZE; + while(size != 0 || size_ext != 0) + { + full_size_32_bit = (size_ext << 16) + size; + // reconstruction of the total 32-bit size of the section + size_total+=HEADER_PATCH_SIZE+full_size_32_bit+1; + // Header + size_block + cntrl_word(0xDEAD):1 + codePtr+=full_size_32_bit+2+1; + // Two words for address and one for the cntrl word 0xDEAD + size = *codePtr++; + size_ext = *codePtr++; + } + size_total+=HEADER_PATCH_SIZE; + // Last header to consider + + dsp_addr = *codePtr++; + dsp_addr_ext = *codePtr++; + crc_value = *codePtr++; + dest_addr[i] = (dsp_addr_ext << 16)+dsp_addr; + crc_vect[i] = crc_value; + size_p[i] = size_total; + status_flag = TRUE; + } + } + return status_flag; +} +#endif //L1_DYN_DSP_DWNLD == 1 diff -r 3f44bb6108b9 -r 06d94fdaadf6 chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_init.c --- a/chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_init.c Wed Oct 21 03:48:05 2015 +0000 +++ b/chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_init.c Wed Oct 21 21:41:05 2015 +0000 @@ -1,1 +1,650 @@ -/* dummy C source file */ +/************* Revision Controle System Header ************* + * GSM Layer 1 software + * L1_DYN_DWL_INIT.C + * + * Filename l1_dyn_dwl_init.c + * Copyright 2004 (C) Texas Instruments + * + ************* Revision Controle System Header *************/ +#include "nucleus.h" +#include "l1_confg.h" +#include "sys_types.h" +#include "l1_types.h" +#include "l1audio_defty.h" +#include "l1audio_cust.h" +#include "l1audio_const.h" +#include "l1_const.h" +#include "l1tm_defty.h" + +#if (L1_GTT == 1) + #include "l1gtt_const.h" + #include "l1gtt_defty.h" +#endif +#if (L1_DYN_DSP_DWNLD == 1) + #include "l1_dyn_dwl_const.h" + #include "l1_dyn_dwl_defty.h" + #include "l1_dyn_dwl_proto.h" +#endif + +#if (L1_MP3 == 1) + #include "l1mp3_defty.h" +#endif //L1_MP3 +#if (L1_MIDI == 1) + #include "l1midi_defty.h" +#endif +#if (L1_AAC == 1) + #include "l1aac_defty.h" +#endif //L1_AAC + +#include "l1_defty.h" +#include "cust_os.h" +#include "nu_main.h" +#include "l1audio_signa.h" +#include "l1_varex.h" +#include "l1_macro.h" +#include "l1_trace.h" + +#if (L1_DYN_DSP_DWNLD == 1) +extern T_DYN_DWNLD_MCU_DSP *dyn_dwl_ndb; +#if ((CODE_VERSION == SIMULATION) || (((CHIPSET == 12) || (CHIPSET == 15)))) +const BOOL primitives_to_patch_matrix[NUM_OF_DYN_DWNLD_PRIMITIVES][MAX_NUM_OF_PATCH_IDS] = { + +// MP3 MMS Melo E2 TTY Speech Acoustic AAC PCM +// MMI_GTT_START_REQ + {0, 0, 0, 1, 0, 0, 0}, +// MMI_TCH_VOCODER_CFG_REQ + {0, 0, 0, 0, 1, 0, 0}, +// MMI_MELODY0_E2_START_REQ + {0, 0, 1, 0, 0, 0, 0}, +// MMI_MELODY1_E2_START_REQ + {0, 0, 1, 0, 0, 0, 0}, +// MMI_MP3_START_REQ + {1, 0, 0, 0, 0, 0, 0}, +// MMI_VM_AMR_PLAY_START_REQ + {0, 1, 0, 0, 0, 0, 0}, +// MMI_VM_AMR_RECORD_START_REQ + {0, 1, 0, 0, 0, 0, 0}, +// MMI_AAC_START_REQ + {0, 0, 0, 0, 0, 1, 0}, +// MMI_PCM_DOWNLOAD_START_REQ + {0, 0, 0, 0, 0, 0, 1}, +// MMI_PCM_UPLOAD_START_REQ + {0, 0, 0, 0, 0, 0, 1} + }; + +const BOOL incompatibility_matrix[MAX_NUM_OF_PATCH_IDS][MAX_NUM_OF_PATCH_IDS] ={ + +// MP3 MMS Melo E2 TTY Speech Acoustic AAC PCM +// MP3 + {0, 1, 1, 1, 1, 1, 1}, +// MMS + {1, 0, 1, 1, 1, 1, 1}, +// Melo E2 + {1, 1, 0, 1, 1, 1, 1}, +// TTY + {1, 1, 1, 0, 1, 1, 1}, +// Speech Acoustic + {1, 1, 1, 1, 0, 1, 0}, +// AAC + {1, 1, 1, 1, 1, 0, 1}, +// PCM + {1, 1, 1, 1, 0, 1, 0} + }; + + +const BOOL semaphore_matrix[MAX_NUM_OF_PATCH_IDS][MAX_NUM_OF_SEMAPHORES] = { + +// MP3 SM VM AMR SM E2 SM ANR SM Speech Reco SM TTY SM WCM SM AAC SM PCM SM +// MP3 + {1, 0, 0, 0, 1, 0, 1, 1, 0}, +// MMS + {1, 1, 0, 0, 1, 0, 0, 1, 0}, +// Melo E2 + {1, 0, 1, 0, 1, 0, 0, 1, 0}, +// TTY + {1, 0, 0, 0, 1, 1, 0, 1, 0}, +// Speech Acoustic + {1, 0, 0, 1, 1, 0, 0, 1, 0}, +// AAC + {1, 0, 0, 0, 1, 0, 1, 1, 0}, +// PCM + {1, 0, 0, 0, 1, 0, 0, 1, 1} + }; +#elif (CHIPSET == 10 && BOARD == 35) +const BOOL primitives_to_patch_matrix[NUM_OF_DYN_DWNLD_PRIMITIVES][MAX_NUM_OF_PATCH_IDS] = { + +/* MMS TTY Speech Acoustic */ +/* MMI_GTT_START_REQ */ { 0, 1, 0}, +/* MMI_TCH_VOCODER_CFG_REQ */ { 0, 0, 1}, +/* MMI_VM_AMR_PLAY_START_REQ */ { 1, 0, 0}, +/* MMI_VM_AMR_RECORD_START_REQ */ { 1, 0, 0} + }; + +const BOOL incompatibility_matrix[MAX_NUM_OF_PATCH_IDS][MAX_NUM_OF_PATCH_IDS] ={ + +/* MMS TTY Speech Acoustic */ +/* MMS */ { 0, 1, 1}, +/* TTY */ { 1, 0, 0}, +/* Speech Acoustic */ { 1, 0, 0} + }; + + +const BOOL semaphore_matrix[MAX_NUM_OF_PATCH_IDS][MAX_NUM_OF_SEMAPHORES] = { + +// VM AMR SM ANR SM Speech Reco SM TTY SM +// MMS + { 1, 0, 1, 0 }, +// TTY + { 0, 0, 1, 1, }, +// Speech Acoustic + { 0, 1, 1, 0 } + }; +#endif // CODE_VERSION == SIMULATION || ((CHIPSET == 12) || (CHIPSET == 15)) + +UWORD32 dyn_dwnld_address_vect[MAX_NUM_OF_PATCH_IDS]; +UWORD16 dyn_dwnld_crc_vect[MAX_NUM_OF_PATCH_IDS]; +UWORD16 size_vect[MAX_NUM_OF_PATCH_IDS]; + +UWORD8 const *dyn_dwnld_copy_MCU_vect[MAX_NUM_OF_PATCH_IDS]; + +#if (CODE_VERSION != SIMULATION && ((CHIPSET == 12) || (CHIPSET == 15))) + #if (L1_MP3 == 1) + extern const UWORD8 mp3_patch_array[]; + #endif + extern const UWORD8 amr_mms_patch_array[]; + #if (CHIPSET == 15) + // TODO: Just to avoid Compilation errors. + // Ideally E2 should be completely removed for Locosto + const UWORD8 e2_patch_array[] = { + /* Tag */ 0x00, 0x00, 0x00, 0x00, + /* Vers */ 0x03, 0x00, 0x00, 0x00, + + /* size */ 0x0f, 0x00, 0x00, 0x00, + /* addr */ 0x05, 0x16, 0x00, 0x00, + 0xF8,0x10,0xF6,0x17,0x10,0xF0,0x03,0x00,0x45,0xF8,0x0F,0x16,0x74,0xF0,0x12,0x16, + 0x73,0xF0,0x11,0x16,0x74,0xF0,0x13,0x16,0x00,0xFC,0x00,0xFC,0x00,0xFC,0xAD,0xDE, + + /* Final record */ + /* size */ 0x00, 0x00, 0x00, 0x00, + /* Installation addr */ 0x05, 0x16, 0x00, 0x00, + /* Checksum */ 0x34, 0x03, + }; + #else + extern const UWORD8 e2_patch_array[]; + #endif + //extern const UWORD8 tty_patch_array[]; + extern const UWORD8 speech_acoustic_patch_array[]; +#if (L1_AAC == 1) + extern const UWORD8 aac_patch_array[]; +#endif +#if (L1_PCM_EXTRACTION == 1) + extern const UWORD8 pcm_patch_array[]; +#endif +#elif (CODE_VERSION != SIMULATION && CHIPSET == 10 && BOARD == 35) + extern const UWORD8 amr_mms_patch_array[]; +// extern const UWORD8 tty_patch_array[]; + extern const UWORD8 speech_acoustic_patch_array[]; +#elif (CODE_VERSION == SIMULATION) + const UWORD8 mp3_patch_array[] = { + /* Tag */ 0x00, 0x00, 0x00, 0x00, + /* Vers */ 0x03, 0x00, 0x00, 0x00, + /* size */ 0x01, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x0E,0x60, + /* Final record */ 0xAD, 0xDE, + /* size */ 0x00, 0x00, 0x00, 0x00, + /* addr */ 0xAA, 0xAA, 0x00, 0x00, + /* CRC */ 0xAA, 0xAA, 0x00, 0x00, + }; + const UWORD8 amr_mms_patch_array[] = { + /* Tag */ 0x00, 0x00, 0x00, 0x00, + /* Vers */ 0x03, 0x00, 0x00, 0x00, + /* size */ 0x01, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x0E,0x60, + /* Final record */ 0xAD, 0xDE, + /* size */ 0x00, 0x00, 0x00, 0x00, + /* addr */ 0xBB, 0xBB, 0x00, 0x00, + /* CRC */ 0xBB, 0xBB, 0x00, 0x00, + }; + const UWORD8 pcm_patch_array[] = { + /* Tag */ 0x00, 0x00, 0x00, 0x00, + /* Vers */ 0x03, 0x00, 0x00, 0x00, + /* size */ 0x01, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x0E,0x60, + /* Final record */ 0xAD, 0xDE, + /* size */ 0x00, 0x00, 0x00, 0x00, + /* addr */ 0xBB, 0xBB, 0x00, 0x00, + /* CRC */ 0xBB, 0xBB, 0x00, 0x00, + }; + const UWORD8 aac_patch_array[] = { + /* Tag */ 0x00, 0x00, 0x00, 0x00, + /* Vers */ 0x03, 0x00, 0x00, 0x00, + /* size */ 0x01, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x0E,0x60, + /* Final record */ 0xAD, 0xDE, + /* size */ 0x00, 0x00, 0x00, 0x00, + /* addr */ 0xCC, 0xCC, 0x00, 0x00, + /* CRC */ 0xCC, 0xCC, 0x00, 0x00, + }; + const UWORD8 tty_patch_array[] = { + /* Tag */ 0x00, 0x00, 0x00, 0x00, + /* Vers */ 0x03, 0x00, 0x00, 0x00, + /* size */ 0x01, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x0E,0x60, + /* Final record */ 0xAD, 0xDE, + /* size */ 0x00, 0x00, 0x00, 0x00, + /* addr */ 0xDD, 0xDD, 0x00, 0x00, + /* CRC */ 0xDD, 0xDD, 0x00, 0x00, + }; + const UWORD8 e2_patch_array[] = { +/* Tag */ 0x00, 0x00, 0x00, 0x00, +/* Vers */ 0x03, 0x00, 0x00, 0x00, + +/* size */ 0xab, 0x03, 0x00, 0x00, +/* addr */ 0x10, 0x64, 0x00, 0x00, + +0xF8,0x76,0x66,0x58,0x00,0x00,0x00,0xFC,0xF8,0x60,0x66,0x58,0x00,0x00,0x20,0xF8, +0x23,0x64,0xF8,0x10,0x67,0x58,0xE3,0xF4,0xF8,0x76,0x66,0x58,0x01,0x00,0xF8,0x10, +0x6A,0x58,0xE3,0xF4,0x00,0xFC,0xF8,0x60,0x66,0x58,0x01,0x00,0x20,0xF8,0x37,0x64, +0xF8,0x10,0x69,0x58,0xE3,0xF4,0xF8,0x76,0x66,0x58,0x02,0x00,0x45,0xF8,0x37,0x64, +0xF8,0x76,0x66,0x58,0x01,0x00,0xF8,0x10,0x6A,0x58,0xE3,0xF4,0x00,0xFC,0xF8,0x60, +0x66,0x58,0x02,0x00,0x20,0xF8,0x48,0x64,0xF8,0x76,0x66,0x58,0x03,0x00,0xF8,0x10, +0x68,0x58,0xE3,0xF4,0xF8,0x60,0x66,0x58,0x01,0x00,0x30,0xF8,0x28,0x64,0x00,0xFC, +0xF8,0x60,0x66,0x58,0x05,0x00,0x30,0xF8,0x1C,0x64,0xF8,0x60,0x66,0x58,0x04,0x00, +0x30,0xF8,0x1C,0x64,0x00,0xFC,0xF8,0x76,0x66,0x58,0x01,0x00,0x00,0xFC,0xF8,0x76, +0x66,0x58,0x05,0x00,0x00,0xFC,0xF8,0x76,0x66,0x58,0x04,0x00,0x00,0xFC,0xBB,0xF7, +0xF8,0x10,0x4E,0x43,0xF8,0x08,0x4F,0x43,0xBB,0xF6,0x00,0xFC,0xBB,0xF7,0x20,0xF0, +0x14,0x64,0x74,0xF0,0xC3,0xAA,0xBB,0xF6,0x00,0xFC,0xF8,0x61,0x09,0x09,0x00,0x20, +0x20,0xF8,0x79,0x64,0x74,0xF0,0xF7,0xC4,0xF8,0x76,0x66,0x58,0x01,0x00,0x73,0xF0, +0x97,0x65,0xF8,0x60,0x66,0x58,0x05,0x00,0x20,0xF8,0xF7,0xC4,0xF8,0x76,0x66,0x58, +0x01,0x00,0xF8,0x10,0x6A,0x58,0xE2,0xF4,0x20,0xF0,0xEA,0x64,0x74,0xF0,0x8E,0x64, +0x00,0xFC,0x20,0xF0,0xCB,0x64,0x74,0xF0,0x8E,0x64,0x00,0xFC,0x06,0x4A,0x17,0x4A, +0x16,0x4A,0x11,0x4A,0x07,0x4A,0x1D,0x4A,0x06,0x77,0x00,0x00,0x07,0x77,0x00,0x69, +0xF8,0x68,0x1D,0x00,0xFC,0xFF,0xE3,0xF4,0x1D,0x8A,0x07,0x8A,0x11,0x8A,0x16,0x8A, +0x17,0x8A,0x06,0x8A,0x00,0xFC,0xF8,0x76,0x69,0x58,0x5F,0x64,0xF8,0x76,0x6A,0x58, +0x66,0x64,0xF8,0x76,0xCB,0x43,0x6D,0x64,0xE4,0xF4,0x10,0x77,0xA0,0x28,0x11,0x77, +0x00,0x28,0x12,0x72,0xBE,0x3F,0x00,0xE8,0x1A,0x77,0x9F,0x00,0x72,0xF2,0xBC,0x64, +0x19,0x77,0x5E,0x01,0x90,0x80,0x91,0x80,0xD2,0x80,0xE4,0xF4,0xF8,0x76,0x69,0x58, +0x84,0x64,0xF8,0x76,0x6A,0x58,0x89,0x64,0xF8,0x76,0x33,0x4C,0xFA,0x64,0xF8,0x76, +0x32,0x4C,0x6B,0x65,0x00,0xFC,0x11,0x4A,0xFC,0xEE,0x95,0xF4,0xBB,0xF7,0x03,0x76, +0x16,0x00,0x02,0x76,0x00,0x00,0x18,0x48,0x00,0xF0,0x02,0x00,0xF8,0x11,0x43,0x4C, +0x00,0x80,0x20,0xF0,0xD1,0x4B,0xE3,0xF5,0x11,0x88,0x95,0xF4,0x95,0xF4,0xE1,0x6C, +0xFF,0xFF,0xE5,0x64,0xF8,0x69,0xD5,0x08,0x00,0x04,0xBB,0xF6,0x95,0xF4,0x04,0xEE, +0x11,0x8A,0x00,0xFC,0xBB,0xF7,0xF8,0x10,0xD2,0x4B,0xF8,0x08,0xD1,0x4B,0x44,0xF8, +0xF6,0x64,0xBB,0xF6,0x95,0xF4,0x00,0xE8,0x73,0xF0,0xF9,0x64,0xBB,0xF6,0x95,0xF4, +0x01,0xE8,0x00,0xFC,0xFF,0xEE,0xF8,0x11,0x5E,0x3F,0x20,0xF0,0x14,0x64,0xE3,0xF5, +0x01,0xEE,0x00,0xFC,0x11,0x4A,0xFE,0xEE,0xF8,0x61,0x09,0x09,0x01,0x00,0x20,0xF8, +0x48,0x65,0xF8,0x61,0x08,0x09,0x00,0x20,0x20,0xF8,0x41,0x65,0xF8,0x60,0x41,0x09, +0x03,0x00,0x20,0xF8,0x35,0x65,0xF8,0x61,0x09,0x09,0x00,0x20,0x30,0xF8,0x2D,0x65, +0xF8,0x69,0x09,0x09,0x00,0x20,0xF8,0x76,0x6B,0x58,0x00,0x00,0xF8,0x76,0x00,0x4C, +0x28,0x67,0xF8,0x76,0x6C,0x58,0x0D,0x66,0xF8,0x11,0x5E,0x3F,0x20,0xF0,0x9F,0x65, +0xE3,0xF5,0x74,0xF0,0x10,0x64,0x73,0xF0,0x3E,0x65,0xF8,0x68,0x09,0x09,0xFE,0xDF, +0xF8,0x76,0x6B,0x58,0x01,0x00,0x73,0xF0,0x3E,0x65,0xF8,0x76,0xC3,0x3F,0x00,0x28, +0xF8,0x76,0xC4,0x3F,0xA0,0x28,0xF8,0x76,0x6C,0x58,0xC8,0x5D,0xF8,0x68,0x08,0x09, +0xFF,0xDF,0xF8,0x10,0x41,0x09,0x44,0xF8,0x48,0x65,0xF8,0x76,0x6C,0x58,0x98,0x71, +0x11,0x72,0xB9,0x4B,0x95,0xF4,0x81,0x10,0xF8,0x61,0x08,0x00,0x00,0x40,0x30,0xF8, +0x63,0x65,0xF8,0x61,0x08,0x00,0xFF,0x00,0x20,0xF8,0x63,0x65,0x11,0x72,0xB9,0x4B, +0x95,0xF4,0xE1,0x60,0x03,0x00,0x03,0x00,0x20,0xF8,0x63,0x65,0xF8,0x61,0xB0,0x3F, +0x02,0x00,0x30,0xF8,0x68,0x65,0x00,0x70,0xE5,0x4B,0x15,0xE8,0x74,0xF0,0x23,0xDC, +0x02,0xEE,0x11,0x8A,0x00,0xFC,0xFF,0xEE,0xF8,0x11,0x63,0x3F,0x15,0xE8,0xE3,0xF5, +0xF8,0x61,0x09,0x09,0x00,0x20,0x30,0xF8,0x88,0x65,0xF8,0x60,0x66,0x58,0x05,0x00, +0x30,0xF8,0x81,0x65,0xF8,0x11,0x5E,0x3F,0x20,0xF0,0x35,0xE1,0xE3,0xF5,0x73,0xF0, +0x95,0x65,0xF8,0x76,0x66,0x58,0x01,0x00,0x74,0xF0,0xCB,0x64,0x73,0xF0,0x95,0x65, +0xF8,0x11,0x5E,0x3F,0x20,0xF0,0x35,0xE1,0xE3,0xF5,0xF8,0x76,0x66,0x58,0x01,0x00, +0xF8,0x11,0x5E,0x3F,0x20,0xF0,0x97,0x65,0xE3,0xF5,0x01,0xEE,0x00,0xFC,0xF8,0x76, +0x67,0x58,0x9F,0x65,0xF8,0x76,0x68,0x58,0xB8,0x65,0x73,0xF0,0x14,0x64,0xF8,0x68, +0xBF,0x3F,0xFF,0xF7,0xF8,0x69,0xBF,0x3F,0x00,0x10,0xF8,0x76,0xD2,0x56,0x01,0x00, +0xF8,0x76,0xCD,0x4F,0x01,0x00,0xF8,0x76,0x05,0x09,0x01,0x04,0xF8,0x76,0xD5,0x56, +0xFE,0xFF,0x81,0xF9,0x16,0xA3,0x80,0xF9,0x15,0x66,0x80,0xF9,0xAD,0x64,0x00,0xFC, +0xF8,0x60,0xD1,0x56,0x02,0x00,0x30,0xF8,0xFE,0x65,0xF8,0x60,0x00,0x15,0x00,0x00, +0x30,0xF8,0xDB,0x65,0xF8,0x10,0x00,0x15,0x93,0xF4,0xF8,0x18,0x01,0x15,0xF8,0x80, +0x01,0x15,0x01,0xE8,0x12,0x77,0xE5,0x55,0x10,0x77,0x0E,0x00,0x1A,0x77,0x0F,0x00, +0x72,0xF0,0xDA,0x65,0x40,0xF5,0xF8,0x19,0x00,0x15,0x4D,0xF8,0xD9,0x65,0x82,0x76, +0x00,0x00,0x61,0xF4,0xB2,0x6D,0xF8,0x76,0x00,0x15,0x00,0x00,0xF8,0x10,0x3C,0x15, +0x45,0xF8,0xFE,0x65,0xF8,0x6B,0xD5,0x56,0x01,0x00,0x81,0xF9,0x19,0xA3,0x74,0xF0, +0x53,0x64,0xF8,0x60,0xD5,0x56,0x0A,0x00,0x30,0xF8,0xFE,0x65,0xF8,0x60,0xD5,0x56, +0x16,0x00,0x30,0xF8,0xFE,0x65,0xF8,0x60,0xD5,0x56,0x20,0x00,0x20,0xF8,0x00,0x66, +0xF8,0x6B,0x3C,0x15,0xFF,0xFF,0xF8,0x76,0xD5,0x56,0xFE,0xFF,0x74,0xF0,0x57,0x64, +0xF8,0x10,0x6B,0x58,0x44,0xF9,0x05,0x66,0x00,0xFC,0xF8,0x68,0xBF,0x3F,0xFF,0xEF, +0x81,0xF9,0x1C,0xA3,0x74,0xF0,0x5B,0x64,0x00,0xFC,0xF8,0x60,0xD1,0x56,0x00,0x00, +0x30,0xF8,0x14,0x66,0x81,0xF9,0x1F,0xA3,0x00,0xFC,0x06,0x4A,0x07,0x4A,0x07,0x77, +0x00,0x23,0xAD,0xEA,0x95,0xF4,0x95,0xF4,0x7A,0x76,0x46,0x66,0x7B,0x76,0xC3,0x66, +0x7C,0x76,0xD8,0x66,0x79,0x76,0x3C,0x66,0xF8,0x76,0x00,0x15,0x00,0x00,0x13,0x77, +0xD8,0x55,0x93,0x76,0x14,0x00,0x93,0x76,0x11,0x00,0x93,0x76,0x0F,0x00,0x93,0x76, +0x0C,0x00,0x93,0x76,0x0A,0x00,0x93,0x76,0x07,0x00,0x93,0x76,0x05,0x00,0x83,0x76, +0x02,0x00,0x07,0x8A,0x06,0x8A,0xE4,0xF4,0xF8,0x4B,0xBE,0x3F,0xF8,0x76,0xBE,0x3F, +0x00,0x50,0x74,0xF0,0x94,0x67,0xF8,0x8B,0xBE,0x3F,0x00,0xFC,0x00,0xE8,0x08,0x8A, +0x10,0xF0,0x0D,0x00,0x44,0xF8,0x4E,0x66,0x56,0x44,0x40,0x4E,0x57,0x30,0x40,0x20, +0x76,0xF4,0x0E,0x88,0x59,0x20,0x00,0xF0,0x00,0x20,0x47,0x6F,0x62,0x0C,0x40,0x30, +0x5B,0x20,0x68,0x6F,0x6A,0x0C,0x5A,0x30,0x58,0x20,0x61,0xF4,0x0E,0x88,0x56,0x20, +0x79,0xF4,0x5F,0x80,0x45,0x62,0xA0,0x00,0x5F,0x08,0x42,0xF8,0x6B,0x66,0x47,0x10, +0x48,0x80,0x73,0xF0,0xA9,0x66,0x20,0xF1,0x00,0x04,0x86,0xF4,0x40,0x11,0x69,0xF7, +0x87,0xF4,0x09,0xF0,0x01,0x00,0x76,0xF5,0x68,0x6F,0x41,0x0C,0x87,0xF5,0x69,0x81, +0x1F,0xF6,0x0F,0xEC,0x69,0x1E,0x30,0xF0,0xFF,0xFF,0x95,0xF4,0x95,0xF4,0x45,0xFF, +0x00,0xF0,0x01,0x00,0x48,0x80,0x48,0x6F,0x5C,0x0D,0x47,0x09,0x4F,0xF8,0x8A,0x66, +0x47,0x10,0x48,0x80,0x5A,0x10,0x00,0xF0,0x01,0x00,0x60,0x80,0x60,0x30,0x40,0x20, +0x60,0x6F,0x9E,0x0C,0x60,0x30,0x66,0xF0,0x9A,0x01,0x77,0xF4,0x0F,0xEC,0x47,0x1E, +0x40,0xF5,0x5B,0x30,0x40,0x20,0x60,0x6F,0x9E,0x0C,0x60,0x30,0x66,0xF0,0x9A,0x01, +0x77,0xF4,0x0F,0xEC,0x48,0x1E,0x00,0xF5,0x30,0xF3,0xFF,0xFF,0x45,0x10,0x87,0xF5, +0x45,0x81,0x00,0xE8,0x4A,0x80,0x4B,0x80,0x49,0x80,0x42,0x4E,0x6E,0x76,0x01,0x00, +0x45,0x10,0x47,0xF8,0xC1,0x66,0x6E,0x76,0x00,0x00,0x5E,0x10,0xF8,0x1A,0x01,0x15, +0xF8,0x80,0x01,0x15,0x6D,0x71,0x16,0x00,0x62,0xE7,0x13,0x77,0xC0,0x56,0x0D,0xEC, +0x98,0xE5,0x17,0x8A,0x00,0xFC,0x56,0x6F,0x4A,0x0C,0x6C,0x6F,0x29,0x0C,0x61,0xF0, +0x01,0x00,0x46,0xF8,0xD2,0x66,0x68,0x76,0x00,0x00,0x56,0x6F,0x4A,0x0C,0x69,0x82, +0x73,0xF0,0x0E,0xA5,0x68,0x82,0x56,0x6F,0x0A,0x0C,0x69,0x82,0x73,0xF0,0x0E,0xA5, +0x42,0x56,0x67,0x45,0x80,0xF2,0x6C,0x6F,0x2F,0x0C,0x7A,0xF4,0x60,0xF0,0x01,0x00, +0xF8,0x82,0x10,0x00,0x95,0xF4,0x73,0xF0,0x6E,0xA5,0xF8,0x61,0x09,0x09,0x01,0x00, +0x20,0xF8,0x27,0x67,0xF8,0x61,0x08,0x09,0x00,0x20,0x20,0xF8,0x1F,0x67,0xF8,0x60, +0x41,0x09,0x03,0x00,0x20,0xF8,0x13,0x67,0xF8,0x61,0x09,0x09,0x00,0x20,0x20,0xF8, +0x04,0x67,0xF8,0x68,0x09,0x09,0xFF,0xDF,0xF8,0x68,0x09,0x09,0xFE,0xFF,0xF8,0x76, +0x6B,0x58,0x01,0x00,0x73,0xF0,0x1C,0x67,0xF8,0x69,0x09,0x09,0x00,0x20,0xF8,0x76, +0x6B,0x58,0x00,0x00,0xF8,0x76,0x6C,0x58,0x0D,0x66,0x74,0xF0,0x9F,0x65,0x74,0xF0, +0x10,0x64,0x73,0xF0,0x1C,0x67,0xF8,0x76,0xC4,0x3F,0xA0,0x28,0xF8,0x76,0xC3,0x3F, +0x00,0x28,0xF8,0x76,0x6C,0x58,0xC8,0x5D,0xF8,0x68,0x08,0x09,0xFF,0xDF,0xF8,0x60, +0x41,0x09,0x00,0x00,0x20,0xF8,0x27,0x67,0xF8,0x76,0x6C,0x58,0x98,0x71,0x00,0xFC, +0xF8,0x10,0x6C,0x58,0xE2,0xF4,0xF8,0x61,0x08,0x09,0x14,0x00,0x20,0xF8,0x32,0x67, +0x74,0xF0,0x10,0x64,0x00,0xFC,0xF8,0x76,0x6C,0x58,0x4F,0x67,0xF8,0x76,0x6D,0x58, +0x2B,0x67,0xF8,0x76,0x56,0x4C,0x02,0x65,0xF8,0x11,0x6B,0x58,0x10,0xF3,0x01,0x00, +0x4D,0xF8,0x46,0x67,0x74,0xF0,0x4F,0x67,0x73,0xF0,0x48,0x67,0x74,0xF0,0x49,0x67, +0x00,0xFC,0x74,0xF0,0x10,0x64,0xF8,0x76,0x00,0x4C,0x28,0x67,0x00,0xFC,0xF8,0x76, +0x6A,0x58,0xE5,0x66,0xF8,0x76,0xB3,0x43,0x28,0x67,0x80,0xF9,0xA3,0x64,0x20,0xF0, +0xBE,0x64,0x74,0xF0,0xBC,0x71,0x00,0xFC,0xF8,0x76,0x56,0x4C,0x8E,0x61,0xF8,0x11, +0x6B,0x58,0x10,0xF3,0x01,0x00,0x4D,0xF8,0x69,0x67,0x74,0xF0,0x6C,0x67,0x73,0xF0, +0x6B,0x67,0x74,0xF0,0x75,0x67,0x00,0xFC,0xF8,0x76,0x6A,0x58,0xEB,0x5A,0xF8,0x76, +0x6D,0x58,0xEB,0x5A,0xF8,0x76,0xB3,0x43,0xF7,0x5A,0xF8,0x76,0x6A,0x58,0xEB,0x5A, +0xF8,0x76,0x6D,0x58,0xEB,0x5A,0xF8,0x76,0x00,0x4C,0x98,0x71,0x00,0xFC,0x11,0x4A, +0x11,0x88,0x95,0xF4,0x95,0xF4,0x81,0x6C,0x8C,0x67,0xF8,0x11,0x5E,0x3F,0x20,0xF0, +0x33,0x67,0xE3,0xF5,0x73,0xF0,0x91,0x67,0xF8,0x11,0x5E,0x3F,0x20,0xF0,0x5C,0x67, +0xE3,0xF5,0x01,0xE8,0x11,0x8A,0x00,0xFC,0x06,0x4A,0x07,0x4A,0x9F,0xEA,0x07,0x77, +0x00,0x23,0xF8,0x10,0xCD,0x4F,0x45,0xF8,0xA2,0xFD,0x13,0x77,0xD8,0x4F,0x71,0xF0, +0x20,0x00,0x93,0x80,0x4D,0x80,0x20,0xF0,0x00,0x40,0x4E,0x80,0x4F,0x80,0xF8,0x10, +0x05,0x09,0x50,0x6F,0x68,0x0C,0x51,0x76,0x8F,0x02,0x52,0x76,0x66,0x66,0x55,0x76, +0x00,0x04,0x56,0x76,0x00,0x08,0x50,0x62,0x01,0x00,0x53,0x80,0x50,0x62,0x02,0x00, +0x54,0x80,0x73,0xF0,0xA2,0xFD, + +/* Final record */ 0xAD, 0xDE, +/* size */ 0x00, 0x00, 0x00, 0x00, +/* Installation addr */ 0x83, 0x5a, 0x00, 0x00, +/* Checksum */ 0x83, 0x5a, + }; + const UWORD8 speech_acoustic_patch_array[] = { + /* Tag */ 0x00, 0x00, 0x00, 0x00, + /* Vers */ 0x03, 0x00, 0x00, 0x00, + /* size */ 0x0A, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + /* CNTRL WORD*/ 0xAD, 0xDE, + /* size */ 0x0B, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + /* CNTRL WORD*/ 0xAD, 0xDE, + /* size */ 0x28, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + /* CNTRL WORD*/ 0xAD, 0xDE, + /* size */ 0x28, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + /* CNTRL WORD*/ 0xAD, 0xDE, + /* size */ 0x01, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x55, 0x55, + /* CNTRL WORD*/ 0xAD, 0xDE, + /* Final record */ + /* size */ 0x00, 0x00, 0x00, 0x00, + /* addr */ 0xEE, 0xEE, 0x00, 0x00, + /* CRC */ 0xEE, 0xEE, 0x00, 0x00, + }; +#endif // CODE_VERSION == SIMULATION + const UWORD8 tty_patch_array[] = { + /* Tag */ 0x00, 0x00, 0x00, 0x00, + /* Vers */ 0x03, 0x00, 0x00, 0x00, + /* size */ 0x01, 0x00, 0x00, 0x00, + /* addr */ 0xde, 0x07, 0x03, 0x00, + 0x0E,0x60, + /* Final record */ 0xAD, 0xDE, + /* size */ 0x00, 0x00, 0x00, 0x00, + /* addr */ 0xDD, 0xDD, 0x00, 0x00, + /* CRC */ 0xDD, 0xDD, 0x00, 0x00, + }; +/*-------------------------------------------------------*/ +/* l1_dyn_dwnld_initialize_var() */ +/*-------------------------------------------------------*/ +/* Parameters : none */ +/* Return : nothing */ +/* Functionality : Initialize Dynamic Download variables */ +/* */ +/*-------------------------------------------------------*/ + +void l1_dyn_dwnld_initialize_var() +{ + UWORD16 i; + + + /* Init Dynamic Download NDB */ + dyn_dwl_ndb=(T_DYN_DWNLD_MCU_DSP *)API_address_dsp2mcu(C_DYN_DWNLD_API_BASE_ADDRESS); +#if (CODE_VERSION == SIMULATION) + { + extern T_DYN_DWNLD_MCU_DSP dyn_dwl_ndb_sim; + dyn_dwl_ndb=&dyn_dwl_ndb_sim; + } +#endif // CODE_VERSION == SIMULATION + + /* Init Dynamic Download DSP background */ + l1s_dsp_com.dsp_ndb_ptr->a_background_tasks[C_BGD_DSP_DYN_DWNLD] = (API)((C_BGD_DSP_DYN_DWNLD<<11) | 0); + l1s_dsp_com.dsp_ndb_ptr->d_background_enable&=(API)(~(1<d_max_background<(C_BGD_DSP_DYN_DWNLD+1)) + l1s_dsp_com.dsp_ndb_ptr->d_max_background=(API)(C_BGD_DSP_DYN_DWNLD+1); +#if (CODE_VERSION == SIMULATION || ((CHIPSET == 12) || (CHIPSET == 15))) + #if (L1_MP3 == 1) + dyn_dwnld_copy_MCU_vect[0] = mp3_patch_array; + #endif + dyn_dwnld_copy_MCU_vect[1] = amr_mms_patch_array; + dyn_dwnld_copy_MCU_vect[2] = e2_patch_array; + dyn_dwnld_copy_MCU_vect[3] = tty_patch_array; + dyn_dwnld_copy_MCU_vect[4] = speech_acoustic_patch_array; +#if (L1_AAC == 1) + dyn_dwnld_copy_MCU_vect[5] = aac_patch_array; +#endif +#if (L1_PCM_EXTRACTION == 1) + dyn_dwnld_copy_MCU_vect[6] = pcm_patch_array; +#endif +#elif (CHIPSET == 10 && BOARD == 35) + dyn_dwnld_copy_MCU_vect[0] = amr_mms_patch_array; + dyn_dwnld_copy_MCU_vect[1] = tty_patch_array; + dyn_dwnld_copy_MCU_vect[2] = speech_acoustic_patch_array; +#endif + + for(i=0;i 32 bits mode */ + /* 1 -> 16 bits mode */ + +#if (CODE_VERSION != SIMULATION) + (*(volatile UWORD16 *) 0xFFFFFB0E) |= 0x0020; +#endif // CODE_VERSION != SIMULATION +} + +/*-------------------------------------------------------*/ +/* l1_dyn_dwl_reset() */ +/* */ +/*-------------------------------------------------------*/ +/* Parameters : none */ +/* Return : nothing */ +/* Functionality : Reset Dynamic Download variables */ +/* */ +/*-------------------------------------------------------*/ + +void l1_dyn_dwnld_reset() +{ + UWORD8 indx_loop; + + /* Reset L1A-L1S commands */ + l1a_l1s_com.dyn_dwnld_task.start = FALSE; + l1a_l1s_com.dyn_dwnld_task.stop = FALSE; + + /* Reset L1A-API HISR commands */ + + l1a_apihisr_com.dyn_dwnld.command.restart = FALSE; + l1a_apihisr_com.dyn_dwnld.uninstall_parameters.num_of_elem = 0; + + for (indx_loop = 0 ; indx_loop < MAX_NUM_OF_PATCH_IDS ; indx_loop++ ) + { + l1a_apihisr_com.dyn_dwnld.uninstall_parameters.address[indx_loop] = 0; + l1a_apihisr_com.dyn_dwnld.copy_parameters.patch_data[indx_loop].start_MCU_copy_address = 0; + l1a_apihisr_com.dyn_dwnld.copy_parameters.patch_data[indx_loop].address_to_install = 0; + l1a_apihisr_com.dyn_dwnld.copy_parameters.patch_data[indx_loop].size_array = 0; + } + + l1a_apihisr_com.dyn_dwnld.copy_parameters.size_of_dwnld_area = 0; + l1a_apihisr_com.dyn_dwnld.copy_parameters.start_of_dwnld_area = 0; + l1a_apihisr_com.dyn_dwnld.copy_parameters.num_of_elem = 0; + + /* Reset global API HISR variable */ + l1_apihisr.dyn_dwnld.state = 0; + l1_apihisr.dyn_dwnld.running = FALSE; + l1_apihisr.dyn_dwnld.uninstall_counter = 0; + l1_apihisr.dyn_dwnld.patch_ids_counter = 0; + l1_apihisr.dyn_dwnld.running_source_pointer = 0; + l1_apihisr.dyn_dwnld.tmp_patch_size = 0; + + /* Reset L1A global FIFO for handling the DELAY (when two or more primitives fall within a dynamic download time frame)*/ + l1a.dyn_dwnld.waiting_patch_fifo.num_of_elem = 0; + for (indx_loop=0;indx_loopd_api_dwl_download_ctrl = (API) 0; + dyn_dwl_ndb->d_api_dwl_error_code = (API) 0; + dyn_dwl_ndb->d_api_dwl_function_address[0] = (API) 0; + dyn_dwl_ndb->d_api_dwl_function_address[1] = (API) 0; + dyn_dwl_ndb->d_api_dwl_crc = (API) 0; + dyn_dwl_ndb->d_api_dwl_size = (API) 0; + dyn_dwl_ndb->d_api_dwl_write_pointer = (API) 0; +} + +#endif // L1_DYN_DSP_DWNLD diff -r 3f44bb6108b9 -r 06d94fdaadf6 chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_sync.c --- a/chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_sync.c Wed Oct 21 03:48:05 2015 +0000 +++ b/chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_sync.c Wed Oct 21 21:41:05 2015 +0000 @@ -1,1 +1,137 @@ -/* dummy C source file */ +/************* Revision Controle System Header ************* + * GSM Layer 1 software + * L1_DYN_DWL_SYNC.C + * + * Filename l1_dyn_dwl_sync.c + * Copyright 2004 (C) Texas Instruments + * + ************* Revision Controle System Header *************/ + +#include +#include + +#include "nucleus.h" +#include "l1_confg.h" +#include "l1_types.h" +#include "sys_types.h" +#include "cust_os.h" +#include "l1audio_signa.h" +#include "l1audio_const.h" +#include "l1audio_cust.h" +#include "l1audio_defty.h" +#include "l1_const.h" +#include "l1tm_defty.h" +#if (L1_GTT == 1) + #include "l1gtt_const.h" + #include "l1gtt_defty.h" +#endif +#if (L1_DYN_DSP_DWNLD==1) + #include "l1_dyn_dwl_defty.h" + #include "l1_dyn_dwl_msgty.h" + #include "l1_dyn_dwl_const.h" + #include "l1_dyn_dwl_signa.h" + #include "l1_dyn_dwl_error.h" + #include "l1_dyn_dwl_proto.h" + #include "l1_api_hisr.h" +#endif + +#if (L1_MP3 == 1) + #include "l1mp3_defty.h" +#endif //L1_MP3 +#if (L1_MIDI == 1) + #include "l1midi_defty.h" +#endif + +#include "l1_macro.h" +#include "l1_defty.h" +#include "l1_varex.h" +#include "l1_trace.h" +#include "sys_dma.h" + +#if (L1_DYN_DSP_DWNLD == 1) + +extern T_DYN_DWNLD_MCU_DSP *dyn_dwl_ndb; + + +/*-------------------------------------------------------*/ +/* l1s_dyn_dsp_dwnld_manager() */ +/*-------------------------------------------------------*/ +/* */ +/* Parameters : n/a */ +/* */ +/* Return : n/a */ +/* */ +/* Description : dsp dynamic download L1S manager task. */ +/* */ +/*-------------------------------------------------------*/ + +void l1s_dyn_dwnld_manager(void) +{ + enum states + { + WAIT_INIT = 0, + WAIT_RESULT, + WAIT_STOP + }; + + UWORD8 *state = &l1s.dyn_dwnld_state; + xSignalHeaderRec *conf_msg; + + switch(*state) + { + case WAIT_INIT: + { + if(l1a_l1s_com.dyn_dwnld_task.start==TRUE) + { + // make sure the DSP is able to receive API interrupt + // for this, we wait 1 TDMA frame + // change state + *state=WAIT_RESULT; + } + } + break; + + case WAIT_RESULT: + { + // reset the command + l1a_l1s_com.dyn_dwnld_task.start=FALSE; + // send start background to the DSP + dyn_dwl_ndb->d_api_dwl_download_ctrl = (API) C_DWL_DOWNLOAD_CTRL_INIT; + l1s_dsp_com.dsp_ndb_ptr->a_background_tasks[C_BGD_DSP_DYN_DWNLD] = (API)((C_BGD_DSP_DYN_DWNLD<<11) | 1); + l1s_dsp_com.dsp_ndb_ptr->d_background_enable|=(API)(1<a_background_tasks[C_BGD_DSP_DYN_DWNLD] = (API)((C_BGD_DSP_DYN_DWNLD<<11) | 0); + l1s_dsp_com.dsp_ndb_ptr->d_background_enable&=(API)(~(1<SignalCode=L1_DYN_DWNLD_STOP_CON; + os_send_sig(conf_msg,L1C1_QUEUE); + DEBUGMSG(status,NU_SEND_QUEUE_ERR) + + // change state + *state=WAIT_INIT; + } + } + break; + } +} + +#endif // L1_DYN_DSP_DWNLD==1 +