📄 am_hw_primitive_builder_va_vr.cc
字号:
{ // Send out start request primitive to FDI to delete a single PB/FAvoicetag // and wait for the confirm if( (SEEM_Data_Stream_Start_Req(get_group_info_stream_type(voice_tag.group_id), ACCESS_TYPE_DELETE_ONE, DATA_TYPE_VR_MSG, voice_tag.model_id, 0, NULL)) != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR) { return ; } } // Since DSP is no longer used to store the models, a reply that AM Event Handler // expects to receive will be generated here. Send2AudioMgr_AUDSCM_SDSR_Delete_Complete_Ind(TD_VR_SUCCESS);}/* DESCRIPTION: This function builds and sends VR play voice tag start primitive to the HW. INPUTS: 1. pointer to the voice tag playback data record 2. phone mode (either handset or handsfree) OUTPUTS: None IMPORTANT NOTES: 1. This function is valid only when conditional compilation flag of Speaker Dependent Voice Recognition is set to TRUE.*/voidAM_HW_Primitive_Builder::build_acsc_play_voice_tag_cmd(void *va_vr_data){ // disable layer1 speech coder primitives during VR out-of-call play voice tag to prevent // "overloading" DSP in the event of an incoming call#if (AUDIO_GSM == TRUE && AUDIO_PATRIOT == TRUE) if (TD_MNPH_VA_VR_in_idle_mode()) { TD_MNPH_VA_VR_va_active_enter(); }#endif AM_VR_Playback_Record *playback_record = (AM_VR_Playback_Record*)va_vr_data; TD_VR_VOICE_TAG* pTag = (TD_VR_VOICE_TAG*)playback_record->get_voice_tag_array(); // Initialize the interrupt routine AM_HW_Primitive_Builder_interrupt_init(); // Set the data transfer mode from RAM ->API am_va_vr_int_info.data_mode = SEEM_FDI_VA_VR_TRANSFER_RAM_API; am_va_vr_int_info.data_type = AM_MCU_DSP_VA_PLAYBACK_DATA; am_va_vr_int_info.eom = FALSE; am_va_vr_int_info.message_length = MCU_DSP_VA_PLAYBACK_DATA_WORD_LEN + AM_HW_MSG_HEADER_WORD_LEN; am_va_vr_int_info.max_transfer_size = MAX_AM_VA * am_va_vr_int_info.message_length; // Send out start request primitive to FDI to play a specified message // and wait for the confirm. if( (SEEM_Data_Stream_Start_Req(get_group_info_stream_type(pTag->group_id), ACCESS_TYPE_STREAM_FLASH_TO_RAM, DATA_TYPE_VR_MSG, pTag->model_id, 0, NULL)) != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR) { return; } // Disable interrupts, Call Gint, Enable Interrupts am_hw_run_GINT(); // Build the MCU_DSP_VA_PLAYBACK_ON only if a stop was sent to DSP before this. if ( am_va_vr_int_info.is_va_playback_active == FALSE ) { // Purge the speech coder primitive buffer if needed. am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN + MCU_DSP_VA_PLAYBACK_ON_WORD_LEN); // build primitive am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_VA_PLAYBACK_ON + (UINT8)am_hw_string_primitive.stamp_time() + (UINT8)MCU_DSP_VA_PLAYBACK_ON_WORD_LEN + (UINT8)AM_MCOUNT_VA + (UINT8)(AM_NO_CALL_PLAY_AUDIO_PATH & AM_VA_PATH_FIELD_MASK); am_va_vr_int_info.is_va_playback_active = TRUE; }}/* DESCRIPTION: This function builds and sends VR model retrieval request to the HW. INPUTS: 1. pointer to the VR model retrieval data record 2. phone mode (either handset or handsfree) OUTPUTS: None IMPORTANT NOTES: 1. This function is valid only when conditional compilation flag of Speaker Dependent Voice Recognition is set to TRUE.*/voidAM_HW_Primitive_Builder::build_acsc_sdvr_retrieve_cmd(void *va_vr_data){ volatile UINT16 vr_lookup_bit_table[] = {0x0000, 0x0000}; volatile TD_VR_GROUP_TYPE group_id = *(TD_VR_GROUP_TYPE*)va_vr_data; volatile UINT8 index = 0; while (index < vr_lookup_table[group_id].max_size) { if (*(vr_lookup_table[group_id].table_ptr + index) == TRUE) { MMI_UTIL_set_bit_16(vr_lookup_bit_table, index); } index++; } // Since the DSP is no longer used to store the models, a reply that AM Event Handler // expects to receive will be generated here. Send2AudioMgr_AUDSCM_SDSR_Model_ID_Ind(TD_VR_SUCCESS, (UINT16 *)vr_lookup_bit_table, TD_VR_MAX_ACTIVE_ARRAY_SIZE);}/* DESCRIPTION: This function builds and sends stop VR primitive to the HW. INPUTS: None OUTPUTS: None IMPORTANT NOTES: 1. This function is valid only when conditional compilation flag of Speaker Dependent Voice Recognition is set to TRUE.*/voidAM_HW_Primitive_Builder::build_acsc_vr_stop_cmd(void){ SU_RET_STATUS suStatus; // Check that we are currently performing a VR command if ((am_hw_current_info_ptr->va_vr_command == AM_SDVR_START_RECOG_CMD) || (am_hw_current_info_ptr->va_vr_command == AM_SDVR_START_CAPTURE_CMD) || (am_hw_current_info_ptr->va_vr_command == AM_SDVR_START_TRAIN_CMD)) { // Prevent Data transfers by the ISR am_va_vr_int_info.data_mode = SEEM_FDI_NO_TRANSFER; // Prevent the CP from writing data to the Audio Data Buffer // Send stop semaphore and free both RAM bank A, B seem_stop_data_transfer = TRUE; suReleaseSem(sem_seem_data_stream_bank_a_free, &suStatus); suReleaseSem(sem_seem_data_stream_bank_b_free, &suStatus); // reserve memory in string primitive buffer am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN + MCU_DSP_VR_STOP_WORD_LEN); // Send VR Stop command to DSP am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_VR_STOP + (UINT8)am_hw_string_primitive.stamp_time() + (UINT8)MCU_DSP_VR_STOP_WORD_LEN; } // flush va stop request to SC before exiting IDLE VA ACTIVE state am_hw_string_primitive.send(); // exit idle VA active state when VR command is aborted#if (AUDIO_GSM == TRUE && AUDIO_PATRIOT == TRUE) if (TD_MNPH_VA_VR_va_active_state()) { // transit out of IDLE VA ACTIVE state TD_MNPH_VA_VR_va_active_exit(); }#endif // If we were doing capture with VA Record, set command to va rec so we stop it too if ((am_hw_current_info_ptr->va_vr_command == AM_SDVR_START_CAPTURE_CMD) && (repetition == VR_CAPTURE_REP_WITH_VA)) { am_hw_current_info_ptr->va_vr_command = AM_VA_START_RECORD_CMD; }}#endif#if (AUDIO_DIGITAL_VOICE_ANNOTATOR == TRUE)/* DESCRIPTION: This function conditions replies from the HW. INPUTS: Record Complete Prim from DSP OUTPUTS: None IMPORTANT NOTES: 1. This function is valid only when conditional compilation flag of Digital or Analog Voice Annoation is set to TRUE.*/voidAM_HW_Primitive_Builder::condition_audscm_complete(void){// Ensure the transfer mode is correct in VST capture if(audVstParams.activity == AUD_VST_STOP_CAPTURE) { am_va_vr_int_info.data_mode = SEEM_FDI_VA_VR_TRANSFER_MDI_RAM; } else { // Initialize data transfer direction and data mode for GINT. am_va_vr_int_info.data_mode = SEEM_FDI_VA_VR_TRANSFER_API_RAM; am_va_vr_int_info.data_type = AM_DSP_MCU_VA_RECORD_DATA; am_va_vr_int_info.message_length = (DSP_MCU_VA_RECORD_DATA_WORD_LEN + AM_HW_MSG_HEADER_WORD_LEN); } // Tell the GINT routine to free the buffer even if it is not full am_va_vr_int_info.eom = TRUE; // Disable interrupts, Call Gint, Enable Interrupts // In case DSP does not send GINT because the number of data blocks are less than MCOUNT. // GINT routine will be called to ensure that there is no leftover message in API. am_hw_run_GINT();}/* DESCRIPTION: This function builds VA start recording primitive and sends it to DSP. INPUTS: pointer to the VA data OUTPUTS: None IMPORTANT NOTES: 1. This function is valid only when conditional compilation flag for digital voice annotator is set to TRUE.*/voidAM_HW_Primitive_Builder::build_va_start_record_cmd(void *va_vr_data){ set_va_active(TRUE);#if (AUDIO_GSM == TRUE && AUDIO_PATRIOT == TRUE) // disable coder primitives during VA out-of-call recording to prevent VA speech // from getting garbled up in the event of an incoming call if (TD_MNPH_VA_VR_in_idle_mode()) { TD_MNPH_VA_VR_va_active_enter(); }#endif AM_VA_Info *va_info = (AM_VA_Info*)va_vr_data; current_voice_note_id = va_info->get_voice_note_id(); if (audVstParams.activity == AUD_VST_CAPTURE_AUDIO) { // For VST PCM and vocoded data capture set the data transfer mode to MDI_RAM am_va_vr_int_info.data_mode = SEEM_FDI_VA_VR_TRANSFER_MDI_RAM; am_va_vr_int_info.eom = FALSE; } else { // Initialize the interrupt routine AM_HW_Primitive_Builder_interrupt_init(); am_va_vr_int_info.data_type = AM_DSP_MCU_VA_RECORD_DATA; am_va_vr_int_info.eom = FALSE; am_va_vr_int_info.message_length = (DSP_MCU_VA_RECORD_DATA_WORD_LEN + AM_HW_MSG_HEADER_WORD_LEN); am_va_vr_int_info.data_mode = SEEM_FDI_VA_VR_TRANSFER_API_RAM; if( (SEEM_Data_Stream_Start_Req(ELEMENT_ID_NULL, ACCESS_TYPE_STREAM_RAM_TO_FLASH, DATA_TYPE_VA_MSG, current_voice_note_id, 0, NULL)) != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR) { return; } } // Purge the speech coder primitive buffer if needed. am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN + MCU_DSP_VA_RECORD_ON_WORD_LEN); // build primitive if (audVstParams.activity == AUD_VST_CAPTURE_AUDIO) { am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_VA_RECORD_ON + (UINT8)am_hw_string_primitive.stamp_time() + (UINT8)MCU_DSP_VA_RECORD_ON_WORD_LEN + (UINT8)AM_MCOUNT_VA + (UINT8)(((va_info->get_va_command_audio_path()) & AM_VA_PATH_FIELD_MASK) | RECORD_ON_ENABLE_PCM_CAPTURE); } else { am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_VA_RECORD_ON + (UINT8)am_hw_string_primitive.stamp_time() + (UINT8)MCU_DSP_VA_RECORD_ON_WORD_LEN + (UINT8)AM_MCOUNT_VA + (UINT8)((va_info->get_va_command_audio_path()) & AM_VA_PATH_FIELD_MASK); // Start VA beep timer // Reset the timer so it goes off right away. // The timer checks to see if we are in a call so we can start it regardless of in-call. am_timer_handler.Start(&va_beep_timer); va_beep_timer.ResetTimer( VA_BEEP_INITIAL_DELAY ); } // send va command confirmation so that the system is not blocked on record completion Send2AudioMgr_AUD_HW_Stub_Command_Cnf(AM_HW_STUB_VA_START_RECORD_CNF);}/* DESCRIPTION: This function builds VA erase primitive and sends it to FDI. INPUTS: pointer to the VA data OUTPUTS: None IMPORTANT NOTES: 1. This function is valid only when conditional compilation flag for digital voice annotator is set to TRUE.*/voidAM_HW_Primitive_Builder::build_va_erase_cmd(void *va_vr_data){ set_va_active(TRUE); UINT8 voice_note_id = ((AM_VA_Info*)va_vr_data)->get_voice_note_id(); if (voice_note_id == AUD_VA_ALL_VOICE_NOTES) { // Send out start request primitive to FDI to delete all the stored message // and wait for the confirm. if( (SEEM_Data_Stream_Start_Req(ELEMENT_ID_NULL, ACCESS_TYPE_DELETE_ALL, DATA_TYPE_VA_MSG, voice_note_id, 0, NULL)) != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -