⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 am_hw_primitive_builder_va_vr.cc

📁 Motorola synergy audio component
💻 CC
📖 第 1 页 / 共 5 页
字号:
                            (SEEM_VR_PB_MODEL_INFO) : (SEEM_VR_FA_MODEL_INFO)#define get_group_info_stream_type(group_id) (group_id == VR_PHONEBOOK_GROUP)?\                            (STREAM_VR_PB_VOICE_TAG) : (STREAM_VR_FA_VOICE_TAG)#endif/************** STATIC VARIABLES **********************************************/TD_VR_MODEL_ID AM_HW_Primitive_Builder::current_model_id   = TD_VR_INVALID_MODEL_ID;TD_VR_GROUP_TYPE AM_HW_Primitive_Builder::current_group_id = VR_INVALID_GROUP;BOOL AM_HW_Primitive_Builder::repeat_indication            = FALSE;UINT16 AM_HW_Primitive_Builder::last_recog[]               = {TD_VR_INVALID_MODEL_ID, TD_VR_INVALID_MODEL_ID};UINT8 AM_HW_Primitive_Builder::current_voice_note_id       = AM_VA_INVALID_VOICE_NOTE_ID;TD_VR_CAPTURE_REP_TYPE AM_HW_Primitive_Builder::repetition = VR_CAPTURE_REP_ONE;/************** FUNCTION DEFINITIONS ******************************************//* DESCRIPTION:       Function to set if a va command is active    INPUTS:       TRUE if VA is active, FALSE otherwise   OUTPUTS:       NONE   IMPORTANT NOTES:       1. None     */voidAM_HW_Primitive_Builder::set_va_active( BOOL state){    primitive_va_vr_server->va_active = state;}/* DESCRIPTION:        Update VA/VR command in the HW layer.   INPUTS:       1. VA/VR command from the application layer       2. pointer to the VA/VR data       3. phone mode (either handset or handsfree)   OUTPUTS:       Updated VA/VR command   IMPORTANT NOTES:       None  */AM_VA_VR_COMMAND_TYPEAM_HW_Primitive_Builder::update_va_vr_command(AM_VA_VR_COMMAND_TYPE va_vr_command,                                              void *va_vr_data, AM_AUDIO_MODE_MASK mode){    switch(va_vr_command)	{#if (AUDIO_SPEAKER_DEPENDENT_VR == TRUE)	            case AM_SDVR_ENABLE_CMD:            build_acsc_sdvr_enable_cmd();            break;	            case AM_SDVR_DISABLE_CMD:            build_acsc_sdvr_disable_cmd();            break;        case AM_SDVR_START_RECOG_CMD:            build_acsc_sdvr_recog_cmd(va_vr_data, mode);            break;        case AM_SDVR_START_CAPTURE_CMD:            build_acsc_sdvr_capture_cmd(va_vr_data);            break;        case AM_SDVR_START_TRAIN_CMD:            build_acsc_sdvr_train_cmd(va_vr_data, mode);            break;        case AM_SDVR_DELETE_VOICE_TAG_CMD:            build_acsc_sdvr_delete_cmd(va_vr_data);            break;        case AM_VR_PLAY_VOICE_TAG_CMD:            build_acsc_play_voice_tag_cmd(va_vr_data);            break;        case AM_SDVR_GET_MODELS_CMD:            build_acsc_sdvr_retrieve_cmd(va_vr_data);            break;#endif#if (AUDIO_DIGITAL_VOICE_ANNOTATOR == TRUE)       case AM_VA_START_RECORD_CMD:            build_va_start_record_cmd(va_vr_data);            break;        case AM_VA_STOP_RECORD_CMD:            build_va_stop_cmd();            break;        case AM_VA_ERASE_VOICE_NOTE_CMD:            build_va_erase_cmd(va_vr_data);            break;        case AM_VA_PLAY_VOICE_NOTE_CMD:            build_va_play_voice_note_cmd(va_vr_data);            break;#endif        case AM_VA_VR_ABORT_CMD:#if (AUDIO_SPEAKER_DEPENDENT_VR == TRUE)            build_acsc_vr_stop_cmd();#endif#if (AUDIO_DIGITAL_VOICE_ANNOTATOR == TRUE)            build_va_stop_cmd();#endif            break;        case AM_VA_VR_DO_NOTHING_CMD:            // change it to AM_VA_VR_ABORT_CMD so that nothing will be sent            // out to the Speech Coder when reset() is called. The reason             // is that vr command will be the same as in reset(). This            // will prevent an extra abort to go out to the speech coder.            va_vr_command = AM_VA_VR_ABORT_CMD;#if ((AUDIO_DIGITAL_VOICE_ANNOTATOR == TRUE) ||\     (AUDIO_SPEAKER_DEPENDENT_VR == TRUE))            set_va_active(FALSE);#if (AUDIO_GSM == TRUE && AUDIO_PATRIOT == TRUE)            // exit idle VA active state when VA command is completed            if (TD_MNPH_VA_VR_va_active_state())            {                TD_MNPH_VA_VR_va_active_exit();            }#endif#endif            break;#if ((AUDIO_DIGITAL_VOICE_ANNOTATOR == TRUE) ||\     (AUDIO_SPEAKER_DEPENDENT_VR == TRUE))        case AM_VA_VR_REFORMAT_FLASH_CMD:            build_reformat_flash_cmd();            break;#endif              default:            break;    }    return(va_vr_command);}#if (AUDIO_SPEAKER_DEPENDENT_VR == TRUE)/* DESCRIPTION:       This function conditions replies from the HW.   INPUTS:       Train Complete Prim from DSP   OUTPUTS:       TD_VR_MODEL_ID model_id;   IMPORTANT NOTES:       1. This function is valid only when conditional compilation flag of          Speaker Dependent Voice Recognition is set to TRUE.*/TD_VR_MODEL_IDAM_HW_Primitive_Builder::condition_audscm_train_complete(void *msg){    SU_RET_STATUS suStatus;    AUDSCM_SDSR_TRAIN_COMPLETE_IND* train_complete = (AUDSCM_SDSR_TRAIN_COMPLETE_IND*)msg;    TD_VR_MODEL_ID model_id = TD_VR_INVALID_MODEL_ID;    if (train_complete->error_code == TD_VR_SUCCESS)    {        // Initialize the interrupt routine        AM_HW_Primitive_Builder_interrupt_init();        // Read the new Model and Global data off from API.        am_va_vr_int_info.data_mode = SEEM_FDI_VA_VR_TRANSFER_API_RAM;        am_va_vr_int_info.data_type = AM_DSP_MCU_VR_MODEL_DATA;        am_va_vr_int_info.eom = TRUE;        am_va_vr_int_info.message_length = (MCU_DSP_VR_MODEL_DATA_WORD_LEN +                                            AM_HW_MSG_HEADER_WORD_LEN);        // Send out start request primitive to FDI to write vr model data to Flash        // and wait for the confirm        if((SEEM_Data_Stream_Start_Req(get_group_info_seem_type(current_group_id),                                   ACCESS_TYPE_STREAM_RAM_TO_FLASH,                                   DATA_TYPE_SEEM_ELEMENT,                                   current_model_id,									   0, NULL))		   != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR )		  {			 current_model_id = TD_VR_INVALID_MODEL_ID;			return   TD_VR_INVALID_MODEL_ID;		  }        // Disable interrupts, Call Gint, Enable Interrupts        am_hw_run_GINT();        // Send MMI the model id sent to the FDI        model_id = current_model_id;    }    else    {        // Prevent data transfers by the ISR        am_va_vr_int_info.data_mode = SEEM_FDI_NO_TRANSFER;        // Send stop semaphore and free both RAM bank A, B to stop FDI from writing into RAM        seem_stop_data_transfer = TRUE;        suReleaseSem(sem_seem_data_stream_bank_a_free, &suStatus);        suReleaseSem(sem_seem_data_stream_bank_b_free, &suStatus);        SEEM_Data_Stream_Start_Req(get_group_info_stream_type(current_group_id),                                   ACCESS_TYPE_DELETE_ONE,                                   DATA_TYPE_VR_MSG,                                   current_model_id,                                   0, NULL);    }    current_model_id = TD_VR_INVALID_MODEL_ID;    return (model_id);}/* DESCRIPTION:       This function conditions replies from the HW.   INPUTS:       Recognize Complete Prim from DSP   OUTPUTS:       None   IMPORTANT NOTES:       1. This function is valid only when conditional compilation flag of          Speaker Dependent Voice Recognition is set to TRUE.*/void AM_HW_Primitive_Builder::condition_audscm_recognize_complete(void *msg){            AUDSCM_SDSR_COMPLETE_IND* recognize_complete = (AUDSCM_SDSR_COMPLETE_IND*)msg;    if ((recognize_complete->error_code == TD_VR_SUCCESS) &&        (repeat_indication == FALSE))    {        // The word tags returned by the DSP do not directly correspond to those        // stored by the MMI in the SEEM        UINT16* ptr = recognize_complete->word_array;        UINT16  mmi_msg_id_index = 0;        UINT16  validity_ctr = 0;        UINT8  index;        for (index = 0; index < 2; index++)        {            mmi_msg_id_index = 0;            validity_ctr     = 0;            // Convert the model id according to the group(PB/FA) for MMI by using the             // look up BOOL table ie. if DSP returns MODEL_IND[1] = 1 and MODEL_IND[2] = 3             // then number 1 and 3 will be used to match to the real valid id in the look up             // table at the 1st and the 3rd valid entry.  This table starts at the 0th entry.            while (mmi_msg_id_index < vr_lookup_table[current_group_id].max_size)            {                if ((*(vr_lookup_table[current_group_id].table_ptr + mmi_msg_id_index) == TRUE) &&                    (++validity_ctr == *ptr))                {                    last_recog[index] = mmi_msg_id_index + 1;                    *ptr++ = mmi_msg_id_index + 1;                    break;                }                mmi_msg_id_index++;            }        }    }    repeat_indication = FALSE;}/* DESCRIPTION:       This function conditions replies from the HW.   INPUTS:       Capture Complete Prim from DSP   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::condition_audscm_capture_complete(void *msg){    AUDSCM_SDSR_CAPTURE_COMPLETE_IND *capture_complete =        (AUDSCM_SDSR_CAPTURE_COMPLETE_IND*)msg;    if ((current_model_id != TD_VR_INVALID_MODEL_ID)&&(repetition == VR_CAPTURE_REP_WITH_VA))    {        // 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();        if (capture_complete->error_code != TD_VA_SUCCESS)        {            SEEM_Data_Stream_Start_Req(get_group_info_stream_type(current_group_id),                                       ACCESS_TYPE_DELETE_ONE,                                       DATA_TYPE_VR_MSG,                                       current_model_id,                                       0, NULL);        }    }    // Reset the class variable    repetition = VR_CAPTURE_REP_ONE;}/* DESCRIPTION:   This function enables VR in the dsp   INPUTS:   OUTPUTS:       None   IMPORTANT NOTES:*/voidAM_HW_Primitive_Builder::build_acsc_sdvr_enable_cmd(){#if (AUDIO_CDMA == TRUE)    am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN);        // Build Primitive:  Note that the prim_num field is incremented by 1 because    // this number includes 1 global_data primitive.    am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_AUDIO_VR_ENABLE +	(UINT8)am_hw_string_primitive.stamp_time();#endif    DSP_AUDIO_VR_Enable_Complete();}/* DESCRIPTION:   This function disables vr in the dsp   INPUTS:   OUTPUTS:       None

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -