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

📄 am_device_layer_interface.cc

📁 Motorola synergy audio component
💻 CC
📖 第 1 页 / 共 2 页
字号:
//----------------------------------------------------------------------------//// (c) Copyright Motorola 1998, All rights reserved.// Motorola Confidential Proprietary// Contains Confidential Proprietary information of Motorola, Inc.// Reverse engineering is prohibited.// The copyright notice does not imply publication.////----------------------------------------------------------------------------//---------------------------- REVISION HISTORY ------------------------------////    Date        Author      Reference Number//    ========    ========    ================//    2005-09-26  a19950      LIBgg45257//                Incorrect behavior when try to record Voice Name//    2004-11-05  w17860      LIBff24932//                P4.4 Feature # 12583 Memory Reduction //                - Remove Voice Dial and Voice Tag////    11/23/04    aja099      libff38547//                VST VR Port////    07-08-03    w6011c      LIBdd14922//                            Fix for shutdown of VST VR during phonecall/page////    03-07-01    w6011c      LIBdd14400//                Don't send "complete" message to VST VR SP or set to IDLE if//                the VR SP has sent a stop request and is currently waiting on//                for the stop confirmation.////    03-06-13    aaa063      LIBdd01040//                Implementation of VST VR functionality////    02-11-14    brb032      CR - LIBbb56504//                Add function to send message to DL.////    02-04-08    stlee       LIBbb27015//                Stop the previous midi before starting a new midi////    01-10-02    arc095      LIBbb06412//                modified aud_acc_cnf() ////     00-12-21   mtaraba     CSGce82934//                main_comp_hardware.h within engine_audio vob should be removed////    00-09-21    ktang       CSGcs73690//                Fix to remove correct sample alert from tone table in DL//                - Changed the function aud_tone_cnf upon DL's request////    00-09-01    blamers     CR - CSGce61298//                Complete functionality for VA FF/Rew//                - Reformat the Stream Start primitive sender//                - Remove unused primitive senders////    00-04-14    hchuang     CR - CSGce54805//                update current prim id to HAPI generic prim id//                - replace sc_prim_ids with hapi_mdi_message_ids////    99-12-23    wchoi        PR - CSGce39558//                - initial creation//                These functions are used by the audio manager//                to send messages to the device layer or to //                itself.////----------------------------------------------------------------------------#include <ENGINE_AUDIO/audio_conditional_compile_def.h>#include <audio/AM_Device_Layer_Interface.H>#include <string.h>#include <ENGINE_AUDIO/aud_prim_ids.h>#include <ENGINE_AUDIO/mmivr_sdvr_ind.h>#include <ENGINE_AUDIO/audscm_sdsr_ind.h>#include <ENGINE_AUDIO/aud_va_command_cnf.h>#include <ENGINE_AUDIO/aud_va_status_ind.h>#include <audio/aud_tone_req.h>#include <audio/aud_reformat_flash_ind.h>#include <SYNERGY_DEVICE_LAYER/dl_ports.h>#include <audio/AM_SendMessage.h>#include <audio/am_server_task.h>#include <ENGINE_SEEM/seem.h>#include <seem/seem_prim_sender.h>#include <ENGINE_SEEM/seem_data_stream.h>#include <ENGINE_HAPI/hapi_mdi_message_ids.h>#include <SYNERGY_DEVICE_LAYER/dl_media_auf.h>#include <audio/AM_Tone_Sequence_Handler.H>#include <ENGINE_AUDIO/aud_interface.h>extern SU_PORT_HANDLE  DeviceLayerVAPortHandle;extern SU_PORT_HANDLE  DeviceLayerVRPortHandle;#if (MAKE_FTR_VR == TRUE)void Send2DeviceLayer_Reformat_Ind(UINT16 error_code){    AUD_REFORMAT_FLASH_IND *  msgptr = NULL;            msgptr = (AUD_REFORMAT_FLASH_IND *) suCreateMessage( (UINT32)sizeof(AUD_REFORMAT_FLASH_IND),                                      AUD_REFORMAT_FLASH_IND_ID, SU_INVALID_HANDLE, NULL);    msgptr->error_code = error_code;    suSendMessage(msgptr, DeviceLayerVRPortHandle, NULL);}void Send2DeviceLayer_vr_message(UINT32 msg_id, UINT8 error_code){    if((msg_id == AM_VR_ENABLE_CNF) || (msg_id == AM_VR_DISABLE_CNF))    {        UINT8 *  msgptr = NULL;           msgptr = (UINT8 *) suCreateMessage( (UINT32)sizeof(UINT8),                                           msg_id, SU_INVALID_HANDLE, NULL);        *msgptr = error_code;        suSendMessage(msgptr, DeviceLayerVRPortHandle, NULL);    }    else /* Message has no body */    {        void * msgptr = NULL;        msgptr =  suCreateMessage((UINT32)0, msg_id, SU_INVALID_HANDLE, NULL);        suSendMessage(msgptr, DeviceLayerVRPortHandle, NULL);    }}void Send2DeviceLayer_SDVR_Complete_Ind(UINT16 error_code,                                        UINT8 word_count,                                        UINT16* word_array){    MMIVR_SDVR_COMPLETE_IND* msgptr = (MMIVR_SDVR_COMPLETE_IND*)        suCreateMessage((UINT32)sizeof(MMIVR_SDVR_COMPLETE_IND),                          (UINT32)MMIVR_SDVR_COMPLETE_IND_ID, SU_INVALID_HANDLE, NULL);   	msgptr->error_code = error_code;	msgptr->word_count = word_count;	memcpy(msgptr->word_array, word_array, sizeof(UINT16)*word_count);    suSendMessage(msgptr, DeviceLayerVRPortHandle, NULL);}void Send2DeviceLayer_AUD_Reformat_Flash_Ind(UINT16 error_code ){       AUD_REFORMAT_FLASH_IND * msgptr = NULL;    msgptr = (AUD_REFORMAT_FLASH_IND*)        suCreateMessage( (UINT32)sizeof(AUD_REFORMAT_FLASH_IND),                           (UINT32)AUD_REFORMAT_FLASH_IND_ID, SU_INVALID_HANDLE, NULL);    msgptr->error_code = error_code;    suSendMessage(msgptr, DeviceLayerVRPortHandle, NULL);}void Send2DeviceLayer_SDVR_Capture_Complete_Ind(UINT16 error_code){    MMIVR_SDVR_CAPTURE_COMPLETE_IND* msgptr = (MMIVR_SDVR_CAPTURE_COMPLETE_IND*)        suCreateMessage((UINT32)sizeof(MMIVR_SDVR_CAPTURE_COMPLETE_IND),                          (UINT32)MMIVR_SDVR_CAPTURE_COMPLETE_IND_ID, SU_INVALID_HANDLE, NULL);    msgptr->error_code = error_code;    suSendMessage(msgptr, DeviceLayerVRPortHandle, NULL);}void Send2DeviceLayer_SDVR_Delete_Complete_Ind(UINT16 error_code,                                               TD_VR_GROUP_TYPE group_id){      MMIVR_SDVR_DELETE_COMPLETE_IND* msgptr = (MMIVR_SDVR_DELETE_COMPLETE_IND*)        suCreateMessage((UINT32)sizeof(MMIVR_SDVR_DELETE_COMPLETE_IND),                          (UINT32)MMIVR_SDVR_DELETE_COMPLETE_IND_ID, SU_INVALID_HANDLE, NULL);    msgptr->error_code = error_code;	msgptr->group_id = group_id;    suSendMessage(msgptr, DeviceLayerVRPortHandle, NULL);}void Send2DeviceLayer_SDVR_Model_ID_Ind(UINT16 error_code,                                        TD_VR_GROUP_TYPE group_id,                                        UINT8 active_bit_array_size,                                        UINT16* active_bit_array){    MMIVR_SDVR_MODEL_ID_IND* msgptr = (MMIVR_SDVR_MODEL_ID_IND*)        suCreateMessage((UINT32)sizeof(MMIVR_SDVR_MODEL_ID_IND),                          (UINT32)MMIVR_SDVR_MODEL_ID_IND_ID, SU_INVALID_HANDLE, NULL);	msgptr->error_code = error_code;    msgptr->group_id = group_id;	msgptr->active_bit_array_size = active_bit_array_size;	memcpy(msgptr->active_bit_array, active_bit_array,           sizeof(UINT16) * active_bit_array_size);    suSendMessage(msgptr, DeviceLayerVRPortHandle, NULL);};void Send2DeviceLayer_SDVR_Voice_Tag_Complete_Ind(UINT16 error_code){   MMIVR_VOICE_TAG_COMPLETE_IND* msgptr = (MMIVR_VOICE_TAG_COMPLETE_IND*)       suCreateMessage((UINT32)sizeof(MMIVR_VOICE_TAG_COMPLETE_IND),                         (UINT32)MMIVR_VOICE_TAG_COMPLETE_IND_ID, SU_INVALID_HANDLE, NULL);   msgptr->error_code = error_code;   suSendMessage(msgptr, DeviceLayerVRPortHandle, NULL);}void Send2DeviceLayer_SDVR_Train_Complete_Ind(UINT8 warning_code,                                              UINT8 error_code,                                              TD_VR_MODEL_ID model_id){    MMIVR_SDVR_TRAIN_COMPLETE_IND* msgptr = (MMIVR_SDVR_TRAIN_COMPLETE_IND*)        suCreateMessage((UINT32)sizeof(MMIVR_SDVR_TRAIN_COMPLETE_IND),                          (UINT32)MMIVR_SDVR_TRAIN_COMPLETE_IND_ID, SU_INVALID_HANDLE, NULL);    msgptr->warning_code = warning_code;    msgptr->error_code = error_code;    msgptr->model_id = model_id;    suSendMessage(msgptr, DeviceLayerVRPortHandle, NULL);}void Send2AudioMgr_AUDSCM_SDSR_Delete_Complete_Ind(UINT16 error_code){    AUDSCM_SDSR_DELETE_COMPLETE_IND* msgptr = (AUDSCM_SDSR_DELETE_COMPLETE_IND*)        suCreateMessage((UINT32)sizeof(AUDSCM_SDSR_DELETE_COMPLETE_IND),                          (UINT32)AUDSCM_SDSR_DELETE_COMPLETE_IND_ID, SU_INVALID_HANDLE, NULL);    msgptr->error_code = error_code;    AM_SendMessage((char*)msgptr);}void Send2AudioMgr_AUDSCM_SDSR_Model_ID_Ind(TD_VR_ERROR_CODES error_code,                                            UINT16* active_bit_array,                                            UINT8 bit_array_size){    AUDSCM_SDSR_MODEL_ID_IND* msgptr = (AUDSCM_SDSR_MODEL_ID_IND*)        suCreateMessage((UINT32)sizeof(AUDSCM_SDSR_MODEL_ID_IND),                          (UINT32)AUDSCM_SDSR_MODEL_ID_IND_ID, SU_INVALID_HANDLE, NULL);    msgptr->error_code = error_code;    /* Note: length is 1 UINT16 of error code and the active bit array size in units of UINT16 */    msgptr->header.stamp_n_length &= ~AUD_DSP_REPLY_MSG_LENGTH_MASK;    msgptr->header.stamp_n_length |= (AUD_DSP_REPLY_MSG_LENGTH_MASK & (bit_array_size + 1));    memcpy(msgptr->active_bit_array, active_bit_array, sizeof(UINT16)*bit_array_size);    AM_SendMessage((char*)msgptr);}void Send2AudioMgr_AUDSCM_SDSR_Complete_Ind(TD_VR_ERROR_CODES error_code,                                            UINT16* word_array,                                            UINT8 word_array_size){    AUDSCM_SDSR_COMPLETE_IND* msgptr;    msgptr = (AUDSCM_SDSR_COMPLETE_IND*)        suCreateMessage((UINT32)sizeof(AUDSCM_SDSR_COMPLETE_IND),                          (UINT32)DSP_MCU_VR_SD_RECOGNIZE_COMPLETE, SU_INVALID_HANDLE, NULL);    msgptr->error_code = error_code;    /* Note: length is 1 UINT16 of error code and the active bit array size in units of UINT16 */    msgptr->header.stamp_n_length &= ~AUD_DSP_REPLY_MSG_LENGTH_MASK;    msgptr->header.stamp_n_length |= (AUD_DSP_REPLY_MSG_LENGTH_MASK & (word_array_size + 1));    memcpy(msgptr->word_array, word_array, sizeof(UINT16)*word_array_size);    AM_SendMessage((char *)msgptr);}#endif#if ( (MAKE_FTR_VR == TRUE) || (MAKE_FTR_VA == TRUE) )SEEM_DATA_STREAM_STATUS_CNF_TYPESEEM_Data_Stream_Start_Req(SEEM_DATA_STREAM_ELEMENT_ID element_id,                           SEEM_DATA_STREAM_ACCESS_TYPE access_type,                           SEEM_DATA_STREAM_DATA_TYPE fdi_data_type,                           SEEM_DATA_STREAM_RECORD_NUM record_num,                           SEEM_DATA_STREAM_RECORD_OFST record_ofst,                           SEEM_DATA_STREAM_RECORD_SIZE* record_size_ptr){    SEEM_DATA_STREAM_STATUS_CNF_TYPE return_value =        SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR;#if (AUDIO_DATA_STREAM_CAPABLE == TRUE)    SEEM_DATA_STREAM_START_REQ* req_ptr = (SEEM_DATA_STREAM_START_REQ*)        suCreateMessage((UINT32)sizeof(SEEM_DATA_STREAM_START_REQ),                          (UINT32)SEEM_DATA_STREAM_START_REQ_ID, am_reply_port, NULL);    req_ptr->element_id    = element_id;    req_ptr->access_type   = access_type;    req_ptr->fdi_data_type = fdi_data_type;    req_ptr->record_num    = record_num;    req_ptr->record_ofst   = record_ofst;    req_ptr->reserve_byte  = 0;    seem_prim_sender(req_ptr);    SEEM_DATA_STREAM_START_CNF* cnf_ptr = (SEEM_DATA_STREAM_START_CNF*)        suReceiveMessageFromQueue(am_reply_queue, SU_WAIT_FOREVER, NULL);    /* Retreive return status, record_size, and delete the primitive */    if (record_size_ptr != NULL)    {        *record_size_ptr = cnf_ptr->record_size;    }    return_value = cnf_ptr->status;    suDeleteMessage(cnf_ptr,NULL);	if( (return_value != SEEM_DATA_STREAM_STATUS_CNF_TYPE_NO_ERROR)		&& (return_value != SEEM_DATA_STREAM_STATUS_CNF_TYPE_OFFSET_OUTOF_BOUND) )	{	  aud_sdvr_abort_vr(TRUE);	}#endif    return return_value;}void Send2AudioMgr_AUD_HW_Stub_Command_Cnf(AM_HW_STUB_COMMAND command){    AUD_HW_STUB_COMMAND_CNF* msgptr = (AUD_HW_STUB_COMMAND_CNF*)        suCreateMessage((UINT32)sizeof(AUD_HW_STUB_COMMAND_CNF),                          (UINT32)AUD_HW_STUB_COMMAND_CNF_ID, SU_INVALID_HANDLE, NULL);    msgptr->command = command;    AM_SendMessage((char*)msgptr);}#endif // #if ( (MAKE_FTR_VR == TRUE) || (MAKE_FTR_VA == TRUE) )#if (MAKE_FTR_VA == TRUE)void Send2DeviceLayer_AUD_VA_Command_Cnf(TD_VA_STATUS va_status,                                         UINT16 va_time_remaining,                                         UINT32 va_time_elapsed){  if(audVstParams.activity == AUD_VST_IDLE)  {      AUD_VA_COMMAND_CNF* msgptr;      msgptr = (AUD_VA_COMMAND_CNF*)suCreateMessage((UINT32)sizeof(AUD_VA_COMMAND_CNF),                                                      (UINT32)AUD_VA_COMMAND_CNF_ID,                                                      SU_INVALID_HANDLE,                                                      NULL);       msgptr->status = va_status;      msgptr->time_remaining = va_time_remaining;      msgptr->time_elapsed = va_time_elapsed;      suSendMessage(msgptr, DeviceLayerVAPortHandle, NULL);  }  else  {      UINT8   dl_status_code;      dl_status_code = (va_status == TD_VA_STATUS_SUCCESS) ? DL_MEDIA_OK                                                             : DL_MEDIA_ERROR;      switch(audVstParams.activity)      {        case AUD_VST_PLAYBACK_FROM_BUFFER:            Send2DeviceLayer_vst_buffer_playback_cnf_msg(dl_status_code);            break;        case AUD_VST_PLAYBACK_FROM_FILE:            Send2DeviceLayer_vst_flash_playback_cnf_msg(dl_status_code);            break;        case AUD_VST_STOP_PLAYBACK:            Send2DeviceLayer_vst_stop_audio_playback_cnf_msg(dl_status_code);            break;        case AUD_VST_CAPTURE_AUDIO:            Send2DeviceLayer_vst_capture_cnf_msg(dl_status_code);            break;        case AUD_VST_STOP_CAPTURE:            Send2DeviceLayer_vst_stop_audio_capture_cnf_msg(dl_status_code);            break;        default:            break;      }      audVstParams.abort_activity = FALSE;    }}void Send2DeviceLayer_AUD_VA_Status_Ind(TD_VA_STATUS status){   if(audVstParams.activity == AUD_VST_IDLE)   {      AUD_VA_STATUS_IND* msgptr;      msgptr = (AUD_VA_STATUS_IND*)suCreateMessage((UINT32)sizeof(AUD_VA_STATUS_IND),                                                   (UINT32)AUD_VA_STATUS_IND_ID,                                                   SU_INVALID_HANDLE,                                                   NULL);      msgptr->status = status;      suSendMessage(msgptr, DeviceLayerVAPortHandle, NULL);   }   else   {       // playback of audio for VST...send CNF message to DL...       UINT8 dl_status_code;       dl_status_code = (status == TD_VA_STATUS_SUCCESS) ? DL_MEDIA_OK                                                          : DL_MEDIA_ERROR;       Send2DeviceLayer_vst_playback_complete_msg(dl_status_code);   }}#endifvoid aud_acc_cnf(UINT32 msg_id){    SU_RET_STATUS err;    char * port_name;    if (msg_id == (UINT32)AUD_IDLE_IND_ID)    {        port_name = DL_PORT_NAME_ACC_SP;    }    else if (msg_id == (UINT32)AUD_VIB_STOP_IND)    {        port_name = DL_PORT_NAME_AUDIO_SP;    }    void* msgptr = suCreateMessage(0, msg_id, SU_INVALID_HANDLE, NULL);    suSendMessage(msgptr,                  (SU_PORT_HANDLE)suFindName(port_name, 10000, &err),                  NULL);}void aud_tone_cnf(TD_AUD_TONE_REQ_TONE_TYPE_T tone_type, UINT32 sequence){    SU_RET_STATUS err;    AUD_TONE_STOP_IND_T * msgptr = NULL;    msgptr = (AUD_TONE_STOP_IND_T *)suCreateMessage((UINT32)sizeof(AUD_TONE_STOP_IND_T), (UINT32)AUD_TONE_STOP_IND, SU_INVALID_HANDLE, NULL);    TD_AUD_TONE_UNION_T tone = {tone_type};    tone_type = tone.fields.id;    if (tone.fields.one_shot)    {        tone_type |= ONE_SHOT_MASK;    }    if (tone.fields.pwrup)    {        tone_type |= PWRUP_MASK;    }    if (tone.fields.send_dl_msg)    {        tone_type |= DL_MEDIA_MASK;    }

⌨️ 快捷键说明

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