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

📄 am_hw_primitive_builder_va_vr.cc

📁 Motorola synergy audio component
💻 CC
📖 第 1 页 / 共 5 页
字号:
		  {			return;		  }    }    else    {        // Send out start request primitive to FDI to delete a specified message        // and wait for the confirm.        if( (SEEM_Data_Stream_Start_Req(ELEMENT_ID_NULL,                                   ACCESS_TYPE_DELETE_ONE,                                   DATA_TYPE_VA_MSG,                                   voice_note_id,										0, NULL))			!= SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR)		  {			return;		  }    }    // send va command confirmation because the system is waiting for the completion    Send2AudioMgr_AUD_HW_Stub_Command_Cnf(AM_HW_STUB_VA_ERASE_CNF);}/* DESCRIPTION:       This function builds VA voicenote playback 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_play_voice_note_cmd(void *va_vr_data){    set_va_active(TRUE);    // disable coder primitives during VA out-of-call playback to prevent    // VA speech from getting garbled up 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_VA_Info *va_info = (AM_VA_Info*)va_vr_data;    UINT8 voice_note_id = va_info->get_voice_note_id();    SEEM_DATA_STREAM_RECORD_SIZE uint16_offset;    AM_VA_OFFSET va_offset = va_info->get_va_offset() + am_va_vr_int_info.msg_offset;    // Reset the interrupt routine.    AM_HW_Primitive_Builder_interrupt_init();    // Set the data transfer mode to RAM_MDI if VST playback...    if ( (audVstParams.activity == AUD_VST_PLAYBACK_FROM_BUFFER) ||         (audVstParams.activity == AUD_VST_PLAYBACK_FROM_FILE) )    {        am_va_vr_int_info.data_mode = SEEM_FDI_VA_VR_TRANSFER_RAM_MDI;    }    else    {        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;    if (va_info->get_va_offset() == AM_VA_OFFSET_END)    {   // Set the offset to the end of the message        am_va_vr_int_info.msg_offset = 0xFFFFFFFF;        uint16_offset = 0xFFFFFFFF;    }    else if ((va_info->get_va_offset() == AM_VA_OFFSET_BEGIN) || (va_offset < 0))    {    // Reset the offset counter to the beginning of the message         am_va_vr_int_info.msg_offset = 0;         uint16_offset = 0;    }    else    {   // increment the offset by the passed value        am_va_vr_int_info.msg_offset += va_info->get_va_offset();        uint16_offset = BYTE_TO_UINT16(am_va_vr_int_info.msg_offset);    }    // if not VST playback...    if ( audVstParams.activity == AUD_VST_IDLE )    {        SEEM_DATA_STREAM_STATUS_CNF_TYPE return_value =                 SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR;               // Send the start request primitive to FDI to play a specified message        // and wait for the confirm.  If the reply is offset_out_of_bounds then        // we are past the end of the message so set msg_offset to the record_size		return_value = SEEM_Data_Stream_Start_Req(ELEMENT_ID_NULL,                                   ACCESS_TYPE_STREAM_FLASH_TO_RAM,                                   DATA_TYPE_VA_MSG,                                   voice_note_id,                                   uint16_offset,								   &uint16_offset);		if(return_value ==  SEEM_DATA_STREAM_STATUS_CNF_TYPE_OFFSET_OUTOF_BOUND)        {            // Set the offset to the record_size so rewind functions correctly            am_va_vr_int_info.msg_offset = UINT16_TO_BYTE(uint16_offset);        }		else if( return_value != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR)		  {			return;		  }    }    if (va_info->get_va_offset() != AM_VA_OFFSET_END)    {        // 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)((va_info->get_va_command_audio_path()) & AM_VA_PATH_FIELD_MASK);            am_va_vr_int_info.is_va_playback_active = TRUE;        }    }    else /*We just fast-forwarded to the end, just kill all VA/VR*/    {        /* LIBbb24274: This needs to be set to false before calling disable           VA in a call because set later, then we get into update_audio()           with va set to true and the s/w thinks that va is in the queue           and tries to stream data to the DSP causing a powerdown. */         set_va_active(FALSE);        am_event_handler->am_event_logic_processor.disable_all_VA_VR();        aud_tone_req(AUD_TONE_UPDATE,                      DL_AUDIO_TONE_TYPE_INVALID_TONE,                      INVALID_SEQ_NUMBER,                      DL_AUDIO_VOLUME_SETTING_CURRENT);    }    // send va command confirmation so that the system is not blocked on playback completion    Send2AudioMgr_AUD_HW_Stub_Command_Cnf(AM_HW_STUB_VA_START_PLAY_CNF);}/* DESCRIPTION:       This function builds VA stop 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.       2. Both stop record and stop playback commands will be processed here in this function.          For stop playback, it is because user wants to abort which resulted in the           command issued to the DSP will have the Abort_VA_Immediately bit set.          In the case of End of Message, the interrupt routine will send the command with          the bit not set.*/voidAM_HW_Primitive_Builder::build_va_stop_cmd(void){    SU_RET_STATUS suStatus;    // Check if it is a stop record or stop playback    if ((am_hw_current_info_ptr->va_vr_command == AM_VA_PLAY_VOICE_NOTE_CMD) ||        (am_hw_current_info_ptr->va_vr_command == AM_VR_PLAY_VOICE_TAG_CMD))    {        // 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        // This will prevent the GINT from writing data to the Audio Data Buffer        // since it checks the end pointers of the RAM Buffer.        seem_stop_data_transfer = TRUE;        suReleaseSem(sem_seem_data_stream_bank_a_free, &suStatus);        suReleaseSem(sem_seem_data_stream_bank_b_free, &suStatus);        // If we are doing VA playback, build MCU_DSP_VA_PLAYBACK_OFF only if a         // MCU_DSP_VA_PLAYBACK_ON message was sent out before this.        if (am_va_vr_int_info.is_va_playback_active == TRUE )        {            // Purge the speech coder primitive buffer if needed.            am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN + MCU_DSP_VA_PLAYBACK_OFF_WORD_LEN);            // build primitive            am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_VA_PLAYBACK_OFF +                                     (UINT8)am_hw_string_primitive.stamp_time() +                                     (UINT8)MCU_DSP_VA_PLAYBACK_OFF_WORD_LEN +                                     (UINT16)AM_ABORT_VA_IMMEDIATELY;            am_va_vr_int_info.is_va_playback_active = FALSE;            am_va_vr_int_info.data_mode = SEEM_FDI_NO_TRANSFER;        }        if (am_hw_current_info_ptr->va_vr_command == AM_VA_PLAY_VOICE_NOTE_CMD)        {   // send va command confirmation for stopping VA playback            Send2AudioMgr_AUD_HW_Stub_Command_Cnf(AM_HW_STUB_VA_STOP_PLAY_CNF);        }    }    else if (am_hw_current_info_ptr->va_vr_command == AM_VA_START_RECORD_CMD)    {        // Purge the speech coder primitive buffer if needed.        am_hw_string_primitive << (AM_HW_MSG_HEADER_WORD_LEN + MCU_DSP_VA_RECORD_OFF_WORD_LEN);        // build primitive        am_hw_string_primitive = am_hw_string_primitive + (UINT16)MCU_DSP_VA_RECORD_OFF +                                 (UINT8)am_hw_string_primitive.stamp_time() +                                 (UINT8)MCU_DSP_VA_RECORD_OFF_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 VA 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    set_va_active(FALSE);}BOOL Audio_Utterance_with_VA(){    return AM_HW_Primitive_Builder::repetition == VR_CAPTURE_REP_WITH_VA;}/* DESCRIPTION:       This function builds a VA record in call beep and sends it to the DSP    INPUTS:       None   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_beep( void ){#define VA_BEEP_DSP_SEQ 0x00#if ((AUDIO_GSM == TRUE)  || (AUDIO_TDMA == TRUE))/*This means that uplink and downlink speech is replaced by the tone*/#define VA_BEEP_TONE_INSERTION 0x0005#else/*This means that uplink and downlink speech will have the tone added to them*/#define VA_BEEP_TONE_INSERTION 0x004A#endif    TD_AUD_TONE_UNION_T tone;    tone.type  = 0;    tone.fields.id = DL_AUDIO_TONE_TYPE_INCALL_SMS_ALERT;    tone.fields.one_shot = TRUE;    tone.fields.pwrup = FALSE;    update_tone_control(VA_BEEP_TONE_INSERTION);    ctg_start_tone( tone, 0x0800, VA_BEEP_DSP_SEQ,                   TRUE, VA_BEEP_TONE_INSERTION );    build_tone(tone_to_build, VA_BEEP_DSP_SEQ, TRUE);    am_hw_current_info_ptr->tone_insertion_method = VA_BEEP_TONE_INSERTION;}#endif#if ((AUDIO_SPEAKER_DEPENDENT_VR == TRUE) ||\     (AUDIO_DIGITAL_VOICE_ANNOTATOR == TRUE))        /* DESCRIPTION:       Deletes all the VA and VR data in SEEM.   INPUTS:       None               OUTPUTS:       None   IMPORTANT NOTES:       1. This function is valid only when conditional compilation flag of          Speaker Dependent Voice Recognition or digital VA.*/voidAM_HW_Primitive_Builder::build_reformat_flash_cmd(void){    // 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,                               0, //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,                               0, 									0, NULL))		!= SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR)	  {		return ;	  }    // Send out start request primitive to FDI to delete all the stored voicenotes    // and wait for the confirm.    if( (SEEM_Data_Stream_Start_Req(ELEMENT_ID_NULL,                               ACCESS_TYPE_DELETE_ALL,                               DATA_TYPE_VA_MSG,                               0, //voice_note id									0, NULL))		!= SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR)	  {		return;	  }    Send2AudioMgr_AUD_HW_Stub_Command_Cnf(AM_HW_STUB_REFORMAT_FLASH_CNF );}#endif

⌨️ 快捷键说明

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