am_hw_primitive_builder_interrupt.cc
来自「Motorola synergy audio component」· CC 代码 · 共 881 行 · 第 1/3 页
CC
881 行
} else if( am_va_vr_int_info.data_mode == SEEM_FDI_VA_VR_TRANSFER_MDI_RAM ) { // Post event inside AM to copy data from the DSP shared buffer. aud_vst_vr_recorded_data_ready_req(); } else if( am_va_vr_int_info.data_mode == SEEM_FDI_VA_VR_TRANSFER_RAM_MDI ) { TransferVAFromRAMToMDI(); }#endif }//===================================================================================// Description:// Transfer Model Data will move data from the MDI buffer into the Seem Data// banks. The Model data is recieved as model data and global data. // the model data is 91 words long. the global data is 4 words long. // You will notice that we add a 2 word header in the buffer to SEEM. Seem // assumes that a header will exist for both the model data and global data. // Seem will store the data without the headers and then //// Inputs://// Outputs:////// Important Notes:////===================================================================================void TransferModelDataFromMDIToSeem() { SU_RET_STATUS GINT_SU_Status;#if (AUDIO_WALLY == TRUE) L1_MODEM_API_QUEUE_read_vr_buff(DSP_MCU_AUDIO_DATA,*(seem_bank_wr_ptr[current_SEEM_bank])+2, DSP_MCU_VR_MODEL_DATA_WORD_LEN , 2 );#else HAPI_MDI_QUEUE_read1( DSP_MCU_AUDIO_DATA, *(seem_bank_wr_ptr[current_SEEM_bank])); /* Log each time we read a message */ am_send_log_data(AUD_MDI_Q_READ1, (char *)*(seem_bank_wr_ptr[current_SEEM_bank]), (*(seem_bank_wr_ptr[current_SEEM_bank])[1]&0xFF) *2); if ( *(seem_bank_wr_ptr[current_SEEM_bank])[0] != DSP_MCU_VR_MODEL_DATA ) { am_va_vr_int_info.eom = TRUE; aud_sdvr_abort_vr(TRUE); }#endif *(seem_bank_wr_ptr[current_SEEM_bank]) += ( DSP_MCU_VR_MODEL_DATA_WORD_LEN + 2 ); #if (AUDIO_RAINBOW == FALSE) #if (AUDIO_WALLY == TRUE) *(seem_bank_wr_ptr[current_SEEM_bank]) += 2; // skip over the header for SEEM L1_MODEM_API_QUEUE_read_vr_buff(DSP_MCU_AUDIO_DATA,*(seem_bank_wr_ptr[current_SEEM_bank])+2,DSP_MCU_VR_GLOBAL_DATA_WORD_LEN , 93 ); #else HAPI_MDI_QUEUE_read1( DSP_MCU_AUDIO_DATA, *(seem_bank_wr_ptr[current_SEEM_bank])); /* Log each time we read a message */ am_send_log_data(AUD_MDI_Q_READ1, (char *)*(seem_bank_wr_ptr[current_SEEM_bank]), (*(seem_bank_wr_ptr[current_SEEM_bank])[1]&0xFF) *2); #endif if ( *(seem_bank_wr_ptr[current_SEEM_bank])[0] != DSP_MCU_VR_GLOBAL_DATA ) { am_va_vr_int_info.eom = TRUE; aud_sdvr_abort_vr(TRUE); } *(seem_bank_wr_ptr[current_SEEM_bank]) += DSP_MCU_VR_GLOBAL_DATA_WORD_LEN + 2;#endif // L1_MODEM_API_QUEUE_read_vr_buff(DSP_MCU_AUDIO_DATA, speechdata, 95, 2); //if eom message set, release banks, reset pointers //and abandon any attempts to transfer data if( am_va_vr_int_info.eom == TRUE ) { //switch to other buffer Switch_Banks(current_SEEM_bank); //reset the buffer which contains no data *(seem_bank_wr_ptr[current_SEEM_bank]) = start_seem_bank_ptr[current_SEEM_bank]; suReleaseSem( sem_seem_data_stream_bank_a_free ,&GINT_SU_Status); suReleaseSem( sem_seem_data_stream_bank_b_free ,&GINT_SU_Status); } }void TransferModelDataFromSeemToMDI(){ UINT16 words_transferred = 0; UINT16 num_words; UINT16 model_data_type; UINT8 global_data_found = 0; UINT16 cnt = 0; UINT16 total_words = 0; UINT16 tmpbuff[2 * (DSP_MCU_VR_MODEL_DATA_WORD_LEN + 2)]; UINT16 *tmpptr = tmpbuff; tmpbuff[1] = 0; //initialize so that we can use to Sum values#if (AUDIO_CDMA == TRUE) tmpptr += 2; // move past the header.#endif while(cnt < 2) { num_words = *(seem_bank_wr_ptr[current_SEEM_bank]) - *(seem_bank_rd_ptr[current_SEEM_bank]); //if no data in current buffer, switch to other buffer if( num_words <= 0 ) { // check to see if data exists in the other bank, // if it doesn't if we have frams to process then // make sure that you call L1_MODEM_write with the // frames sitting in the temporary buffer if((num_words = CheckOtherBank(cnt != 0)) == 0) { if(cnt == 0) { // main_powerdown } } cnt++; } else { UINT16 wordcount = *( *(seem_bank_rd_ptr[current_SEEM_bank]) + 1) &0xFF; *(seem_bank_rd_ptr[current_SEEM_bank]) += 2; if(wordcount == DSP_MCU_VR_MODEL_DATA_WORD_LEN ) { model_data_type = MCU_DSP_VR_MODEL_DATA; } else { model_data_type = MCU_DSP_VR_GLOBAL_DATA; global_data_found = 1; }#if (AUDIO_RAINBOW == TRUE) /* Rainbow has no global data, only model data */ if ((model_data_type == MCU_DSP_VR_MODEL_DATA) || ((!audio_gint_interrupt_first)&&(model_data_type == MCU_DSP_VR_GLOBAL_DATA)))#elif (AUDIO_NEPTUNE== TRUE) /* For neptune, always send global data before model data on recognize */ if ( (model_data_type == MCU_DSP_VR_MODEL_DATA) ||( (audio_gint_interrupt_transfer == AUDIO_TRANSFER_TRAIN) && (!audio_gint_interrupt_first) && (model_data_type == MCU_DSP_VR_GLOBAL_DATA)) ||( (audio_gint_interrupt_transfer == AUDIO_TRANSFER_RECOGNIZE) && (audio_gint_interrupt_first) && (model_data_type == MCU_DSP_VR_GLOBAL_DATA)) ) #else /* This comment only applies to Patriot and wally dsps. * The VR algorithm (during recognize) is based on the size of the MDI queue. If the * MDI queue size is 256 bytes (for TDMA and GSM with GROM6 and higher) * we must first send the global data alone and then the model data. If * the MDI queue size is 1024 bytes (for CDMA and GSM with GROM3) we must * first send 2 model data and at the end send either 1 model data + * global data or just the global data. * * For TDMA and GSM with GROM6: * (hapi_mcu_dsp_audio_data_word_size == MCU_DSP_REDUCED_AUDIO_DATA_WORD_SIZE * * For CDMA and GSM with GROM3: * hapi_mcu_dsp_audio_data_word_size == MCU_DSP_EXPANDED_AUDIO_DATA_WORD_SIZE */ if ( (model_data_type == MCU_DSP_VR_MODEL_DATA) ||( (hapi_mcu_dsp_audio_data_word_size == MCU_DSP_REDUCED_AUDIO_DATA_WORD_SIZE) && (audio_gint_interrupt_transfer == AUDIO_TRANSFER_TRAIN) && (!audio_gint_interrupt_first) && (model_data_type == MCU_DSP_VR_GLOBAL_DATA)) ||( (hapi_mcu_dsp_audio_data_word_size == MCU_DSP_REDUCED_AUDIO_DATA_WORD_SIZE) && (audio_gint_interrupt_transfer == AUDIO_TRANSFER_RECOGNIZE) && (audio_gint_interrupt_first) && (model_data_type == MCU_DSP_VR_GLOBAL_DATA)) ||( (hapi_mcu_dsp_audio_data_word_size == MCU_DSP_EXPANDED_AUDIO_DATA_WORD_SIZE) && (!audio_gint_interrupt_first) && (model_data_type == MCU_DSP_VR_GLOBAL_DATA)) )#endif {#if (AUDIO_CDMA == FALSE) *tmpptr = model_data_type; *(tmpptr+1) = wordcount; tmpptr += 2; total_words += wordcount + 2; // add two for the header #else tmpbuff[1] += wordcount;#endif memcpy(tmpptr, *(seem_bank_rd_ptr[current_SEEM_bank]), wordcount * 2); tmpptr+= wordcount; // dont forget to move the pointer cnt++; } *(seem_bank_rd_ptr[current_SEEM_bank])+= wordcount;#if (AUDIO_RAINBOW == FALSE) /* Rainbow has no global data */#if (AUDIO_NEPTUNE == TRUE) /* For neptune, we must first send only global data */ if ((audio_gint_interrupt_transfer == AUDIO_TRANSFER_RECOGNIZE) && (audio_gint_interrupt_first) && (model_data_type == MCU_DSP_VR_GLOBAL_DATA)) { cnt=2; // only send global data first on recognize }#else /* * For TDMA and GSM with GR0M6 or higher, we must first send only * global data. * The below condition is only true for TDMA and GSM with GROM6 or * higher. */ if ((hapi_mcu_dsp_audio_data_word_size == MCU_DSP_REDUCED_AUDIO_DATA_WORD_SIZE) && (audio_gint_interrupt_transfer == AUDIO_TRANSFER_RECOGNIZE) && (audio_gint_interrupt_first) && (model_data_type == MCU_DSP_VR_GLOBAL_DATA)) { cnt=2; // only send global data first on recognize }#endif#endif } if ((global_data_found)&&(audio_gint_interrupt_first)) { audio_gint_interrupt_first = 0; } }#if (AUDIO_CDMA == TRUE ) tmpbuff[0] = MCU_DSP_VR_MODEL_DATA; L1_MODEM_API_QUEUE_write(MCU_DSP_AUDIO_DATA,tmpbuff, (tmpbuff[1] + 2), FALSE);#else HAPI_MDI_QUEUE_write(MCU_DSP_AUDIO_DATA, tmpbuff, total_words, FALSE); // first model data /*Datalog the MDI data */ am_send_log_data(AUD_MDI_Q_WRITE_VA_VR, (char *)tmpbuff, total_words*2);#endif}/* DESCRIPTION: Transfers data from the MDI buffer to the SEEM buffer during VA/VR operations INPUTS: none OUTPUTS: none IMPORTANT NOTES:*/ UINT8 STOPHERE = 0;void TransferVAFromMDIToSeem() { SU_RET_STATUS GINT_SU_Status; //copy API messages to seem //if API message will NOT fit into current SEEM RAM buffer, //then switch to other bank if(( *(seem_bank_wr_ptr[current_SEEM_bank]) + ((DSP_MCU_VA_RECORD_DATA_WORD_LEN + 2) * AM_MCOUNT_VA) ) > ( start_seem_bank_ptr[current_SEEM_bank] + seem_bank_size[current_SEEM_bank] )) { //switch to other buffer Switch_Banks(current_SEEM_bank); //reset write pointer *(seem_bank_wr_ptr[current_SEEM_bank]) = start_seem_bank_ptr[current_SEEM_bank]; //release previous bank suReleaseSem(( current_SEEM_bank == BANK_A ) ? sem_seem_data_stream_bank_b_free : sem_seem_data_stream_bank_a_free , &GINT_SU_Status); } //read API message to the current seem bank for(int i = 0; i < AM_MCOUNT_VA ; i++) {#if (AUDIO_CDMA == TRUE) L1_MODEM_API_QUEUE_read1(DSP_MCU_AUDIO_DATA,*(seem_bank_wr_ptr[current_SEEM_bank])+ ( (DSP_MCU_VA_RECORD_DATA_WORD_LEN +2)*i), i);#else HAPI_MDI_QUEUE_read1( DSP_MCU_AUDIO_DATA,*(seem_bank_wr_ptr[current_SEEM_bank])+(( DSP_MCU_VA_RECORD_DATA_WORD_LEN+2)*i)); /* Log the read data */ am_send_log_data(AUD_MDI_Q_READ1, (char *)*(seem_bank_wr_ptr[current_SEEM_bank])+(( DSP_MCU_VA_RECORD_DATA_WORD_LEN+2)*i), ( DSP_MCU_VA_RECORD_DATA_WORD_LEN+2)*2);#endif }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?