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

📄 am_hw_primitive_builder_va_vr.cc

📁 Motorola synergy audio component
💻 CC
📖 第 1 页 / 共 5 页
字号:
   IMPORTANT NOTES:*/voidAM_HW_Primitive_Builder::build_acsc_sdvr_disable_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_DISABLE +	(UINT8)am_hw_string_primitive.stamp_time();#endif     // 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;        DSP_AUDIO_VR_Disable_Complete();}/* DESCRIPTION:       This function builds and sends Speaker Dependent Voice Recognition       start primitive to the HW.   INPUTS:       1. pointer to the recognition 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_recog_cmd(void *va_vr_data, AM_AUDIO_MODE_MASK mode){    // disable layer1 speech coder primitives during VR out-of-call recognition 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    // Check if it is Phonebook or Fast Access    AM_SDVR_Recog_Record *recog_record = (AM_SDVR_Recog_Record*)va_vr_data;    current_group_id = recog_record->get_group_id();    UINT8 dsp_num_tags = total_vr_tags(current_group_id);    if ((repeat_indication = recog_record->get_repeat_indication()) == FALSE)    {        // 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_VR_MODEL_DATA;        am_va_vr_int_info.eom = FALSE;        am_va_vr_int_info.message_length = MCU_DSP_VR_MODEL_DATA_WORD_LEN +                                           AM_HW_MSG_HEADER_WORD_LEN;        am_va_vr_int_info.max_transfer_size = AM_MCOUNT_VR_RECOGNIZE *                                              am_va_vr_int_info.message_length;        if( (SEEM_Data_Stream_Start_Req(get_group_info_seem_type(current_group_id),                                   ACCESS_TYPE_STREAM_FLASH_TO_RAM,                                   DATA_TYPE_SEEM_ELEMENT,                                   current_model_id,										0, NULL))            != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR )		  {			return ;		  }        audio_gint_interrupt_first = 1; // Let the interrupt know this is the beginning        audio_gint_interrupt_transfer = AUDIO_TRANSFER_RECOGNIZE; // Tell the interrupt we are doing recognize#if (AUDIO_CDMA == FALSE )        am_hw_run_GINT();#endif        // reserve memory in string primitive buffer        am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN + MCU_DSP_VR_SD_RECOGNIZE_WORD_LEN);        am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_VR_SD_RECOGNIZE +                                 (UINT8)am_hw_string_primitive.stamp_time() +                                 (UINT8)MCU_DSP_VR_SD_RECOGNIZE_WORD_LEN +                                 (UINT8)AM_MCOUNT_VR_RECOGNIZE +                                 (UINT8)(N_BEST_DSP_MODELS | dsp_hf_bit(mode)) +#if (AUDIO_RAINBOW == TRUE)                                 (UINT16) (dsp_num_tags & AM_VR_PRIM_NUM_FIELD_MASK) +#else                                 //Add 1 to the dsp_num_tags for the GLOBAL DATA                                 (UINT16)((dsp_num_tags + 1) & AM_VR_PRIM_NUM_FIELD_MASK) +#endif                                                                (UINT16)recog_record->get_time();    }    else // This is an n-best request from MMI    {        // This DSP always returns two model ids on every recognize        // currently the MMI only uses the first model id so swap them        last_recog[0] = last_recog[1];        TD_VR_ERROR_CODES error_code = (last_recog[0] < dsp_num_tags) ?                                       (TD_VR_SUCCESS) : (TD_VR_NO_END_STATE_ERROR);        Send2AudioMgr_AUDSCM_SDSR_Complete_Ind(error_code, last_recog, TD_VR_MAX_NBEST_MODELS);    }}/* DESCRIPTION:       This function builds and sends VR capture utterance       start primitive to the HW.   INPUTS:       1. pointer to the capture 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_capture_cmd(void *va_vr_data){    // disable layer1 speech coder primitives during VR out-of-call capture 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_SDVR_Capture_Record *capture_record = (AM_SDVR_Capture_Record*)va_vr_data;    current_group_id = capture_record->get_group_id();    #if (AUDIO_RAINBOW == TRUE)    // for wait-for-speech, SD_CAPTURE needs to be sent before VA_RECORD_ON    // reserve memory in string primitive buffer    am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN + MCU_DSP_VR_SD_CAPTURE_WORD_LEN);        /* build primitive */    am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_VR_SD_CAPTURE +                             (UINT8)am_hw_string_primitive.stamp_time() +                             (UINT8)MCU_DSP_VR_SD_CAPTURE_WORD_LEN +                             (UINT8)AM_MCOUNT_VR_CAPTURE +                             (UINT8)(repetition & AM_VR_REP_FIELD_MASK) +                             (UINT16)capture_record->get_time();#endif    // Check if it's first or second capture    if ((repetition = capture_record->get_repetition()) == VR_CAPTURE_REP_WITH_VA)    {        // The message id index from the BOOL table updated by FDI        UINT8 msg_id_index = 0;                // Assign the message id to be stored in flash. It will be passed to FDI via         // stream_start_req primitive.        while (msg_id_index < vr_lookup_table[current_group_id].max_size)        {            if(*(vr_lookup_table[current_group_id].table_ptr + msg_id_index) == FALSE)            {                current_model_id = msg_id_index + 1;                break;            }            msg_id_index++;        }        // Initialize the interrupt routine        AM_HW_Primitive_Builder_interrupt_init();                // 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.eom = FALSE;        am_va_vr_int_info.message_length = (DSP_MCU_VA_RECORD_DATA_WORD_LEN +                                            AM_HW_MSG_HEADER_WORD_LEN);               if( ( SEEM_Data_Stream_Start_Req(get_group_info_stream_type(current_group_id),                                   ACCESS_TYPE_STREAM_RAM_TO_FLASH,                                   DATA_TYPE_VR_MSG,                                   current_model_id,										0, NULL))		   != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR )		 {		   return ;		 }                am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN + MCU_DSP_VA_RECORD_ON_WORD_LEN);                // build primitive        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)(AM_NO_CALL_RECORD_AUDIO_PATH);    }    else    {        // Set GINT to no transfer.        am_va_vr_int_info.data_mode = SEEM_FDI_NO_TRANSFER;        am_va_vr_int_info.data_type = AM_DSP_MCU_VA_RECORD_DATA;        am_va_vr_int_info.eom = FALSE;    }  #if (AUDIO_RAINBOW == FALSE)    // reserve memory in string primitive buffer    am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN + MCU_DSP_VR_SD_CAPTURE_WORD_LEN);        /* build primitive */    am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_VR_SD_CAPTURE +                             (UINT8)am_hw_string_primitive.stamp_time() +                             (UINT8)MCU_DSP_VR_SD_CAPTURE_WORD_LEN +                             (UINT8)AM_MCOUNT_VR_CAPTURE +                             (UINT8)(repetition & AM_VR_REP_FIELD_MASK) +                             (UINT16)capture_record->get_time();#endif  }/* DESCRIPTION:       This function builds and sends VR model training       start primitive to the HW.   INPUTS:       1. pointer to the training 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_train_cmd(void *va_vr_data, AM_AUDIO_MODE_MASK mode){    // disable layer1 speech coder primitives during VR out-of-call training 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    UINT8 dsp_num_tags = total_vr_tags(current_group_id);    // 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_VR_MODEL_DATA;    am_va_vr_int_info.eom = FALSE;    am_va_vr_int_info.message_length = MCU_DSP_VR_MODEL_DATA_WORD_LEN + AM_HW_MSG_HEADER_WORD_LEN;    am_va_vr_int_info.max_transfer_size = AM_MCOUNT_VR_TRAIN * am_va_vr_int_info.message_length;    // Check if this is the first time in VR after all VR tags are deleted.    // The VR Global data needs to be initialized to all zero (4 words)    if (dsp_num_tags == 0)    {        reset_global_data();    }   if( (SEEM_Data_Stream_Start_Req(get_group_info_seem_type(current_group_id),                                ACCESS_TYPE_STREAM_FLASH_TO_RAM,                               DATA_TYPE_SEEM_ELEMENT,                               current_model_id,								   0, NULL))	   != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR )	 {	   return ;	 }    audio_gint_interrupt_first = 1; // Let the interrupt know this is the beginning    audio_gint_interrupt_transfer = AUDIO_TRANSFER_TRAIN; // Tell the interrupt we are doing training;#if (AUDIO_CDMA == FALSE )    am_hw_run_GINT();#endif    // reserve memory in string primitive buffer    am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN + MCU_DSP_VR_SD_TRAIN_WORD_LEN);    // build primitive Add 1 to the dsp_num_tags for the GLOBAL DATA    am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_VR_SD_TRAIN +                             (UINT8)am_hw_string_primitive.stamp_time() +                             (UINT8)MCU_DSP_VR_SD_TRAIN_WORD_LEN +                             (UINT8)AM_MCOUNT_VR_TRAIN +                             (UINT8)dsp_hf_bit(mode) +#if (AUDIO_RAINBOW == TRUE)                             (UINT16)((dsp_num_tags) & AM_VR_PRIM_NUM_FIELD_MASK);#else                             //Add 1 to the dsp_num_tags for the GLOBAL DATA                             (UINT16)((dsp_num_tags + 1) & AM_VR_PRIM_NUM_FIELD_MASK);#endif    }/* DESCRIPTION:       This function builds and sends VR delete model primitive to the HW.   INPUTS:       1. pointer to the VR model deletion 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_delete_cmd(void *va_vr_data){    TD_VR_VOICE_TAG **vt = (TD_VR_VOICE_TAG**)va_vr_data;    TD_VR_VOICE_TAG voice_tag = **vt;    // For deleting all of Fast Access and all of Phone Book.  Need to send 2 separate primitives.    if( voice_tag.group_id == VR_ALL_GROUPS )     {        // Send out start request primitive to FDI to delete all Phonebook voicetags stream data        // FDI and wait for the confirm       if( (SEEM_Data_Stream_Start_Req(STREAM_VR_PB_VOICE_TAG,                                    ACCESS_TYPE_DELETE_ALL,                                   DATA_TYPE_VR_MSG,                                   voice_tag.model_id,									   0, NULL))		   != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR)		 {		   return;		 }        // Send out start request primitive to FDI to delete all Fast Access voicetags stream data        // and wait for the confirm         if( (SEEM_Data_Stream_Start_Req(STREAM_VR_FA_VOICE_TAG,                                    ACCESS_TYPE_DELETE_ALL,                                   DATA_TYPE_VR_MSG,                                   voice_tag.model_id,										0, NULL))			!= SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR)		  {			return ;		  }    }    else // For deleting one entry in either Phonebook or Fast Access

⌨️ 快捷键说明

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