UInt32 audio_control_dsp(UInt32 param1, UInt32 param2, UInt32 param3, UInt32 param4, UInt32 param5, UInt32 param6) { UInt32 val = (UInt32) 0; Audio_Params_t audioParam; UInt32 tid; /* MsgType_t msgType; RPC_ACK_Result_t ackResult; */ unsigned long jiff_in = 0; aTrace(LOG_AUDIO_DRIVER, "\n\r * audio_control_dsp (AP) param1 %ld, param2 %ld" " param3 %ld param4 %ld *\n\r", param1, param2, param3, param4); if (inCpReset) return val; switch (param1) { case AUDDRV_DSPCMD_COMMAND_DIGITAL_SOUND: VPRIPCMDQ_DigitalSound((UInt16) param2); break; case AUDDRV_DSPCMD_COMMAND_SET_BT_NB: VPRIPCMDQ_SetBTNarrowBand((UInt16) param2); break; case AUDDRV_DSPCMD_COMMAND_USB_HEADSET: VPRIPCMDQ_USBHeadset((UInt16) param2); break; case AUDDRV_DSPCMD_MM_VPU_ENABLE: VPRIPCMDQ_MMVPUEnable((UInt16) param2); break; case AUDDRV_DSPCMD_MM_VPU_DISABLE: VPRIPCMDQ_MMVPUDisable(); break; /* AMCR PCM enable bit is controlled by ARM audio */ case AUDDRV_DSPCMD_AUDIO_SET_PCM: VPRIPCMDQ_DigitalSound((UInt16) param2); break; case AUDDRV_DSPCMD_COMMAND_VOIF_CONTROL: VPRIPCMDQ_VOIFControl((UInt16) param2); break; case AUDDRV_DSPCMD_COMMAND_SP: VPRIPCMDQ_SP((UInt16) param2, (UInt16) param3, (UInt16) param4); break; case AUDDRV_DSPCMD_COMMAND_CLEAR_VOIPMODE: VPRIPCMDQ_Clear_VoIPMode((UInt16) param2); break; default: audioParam.param1 = param1; audioParam.param2 = param2; audioParam.param3 = param3; audioParam.param4 = param4; audioParam.param5 = param5; audioParam.param6 = param6; tid = s_sid++; /* RPC_SyncCreateTID(&val, sizeof(UInt32)); */ aTrace(LOG_AUDIO_DRIVER, "audio_control_dsp tid=%ld,param1=%ld\n", tid, param1); /** init completion before send this DSP command */ if (param1 == AUDDRV_DSPCMD_AUDIO_ENABLE) { /*aError("i_c");*/ init_completion(&audioEnableDone); /*aError("i_d");*/ } CAPI2_audio_control_dsp(tid, audioClientId, &audioParam); /* RPC_SyncWaitForResponse(tid, audioClientId, &ackResult, &msgType, NULL); */ if (param1 == AUDDRV_DSPCMD_AUDIO_ENABLE) { /** wait for response from DSP for this command. Response usually comes back very fast, less than 10ms */ jiff_in = wait_for_completion_timeout( &audioEnableDone, timeout_jiff); if (!jiff_in) { aError("!!!Timeout on COMMAND_AUDIO_ENABLE %d" " resp!!!\n", (int)param2); /** IPCCP_SetCPCrashedStatus(IPC_AP_ASSERT); BUG_ON(1); panic("COMMAND_AUDIO_ENABLE timeout"); */ } #if defined(ENABLE_DMA_VOICE) { UInt16 dsp_path; dsp_path = csl_dsp_caph_control_aadmac_get_enable_path(); csl_caph_enable_adcpath_by_dsp(dsp_path); } #endif } break; } return val; }
//============================================================================ // // Function Name: AUDIO_DRIVER_ProcessVOIPCmd // // Description: This function is used to process VOIP control commands // //============================================================================ static Result_t AUDIO_DRIVER_ProcessVOIPCmd(AUDIO_DDRIVER_t* aud_drv, AUDIO_DRIVER_CTRL_t ctrl_cmd, void* pCtrlStruct) { Result_t result_code = RESULT_ERROR; //Log_DebugPrintf(LOGID_AUDIO,"AUDIO_DRIVER_ProcessVOIPCmd::%d \n",ctrl_cmd ); switch(ctrl_cmd) { case AUDIO_DRIVER_START: { if( (aud_drv->pVoipULCallback == NULL) || (aud_drv->pVoipDLCallback == NULL) ) { Log_DebugPrintf(LOGID_AUDIO,"AUDIO_DRIVER_ProcessVOIPCmd::All Configuration is not set yet \n" ); return result_code; } audio_control_dsp( DSPCMD_TYPE_COMMAND_VT_AMR_START_STOP, 1, 0, 0, 0, 0 ); audio_control_dsp( DSPCMD_TYPE_COMMAND_DSP_AUDIO_ALIGN, 1, 0, 0, 0, 0 ); if ( VoIP_StartTelephony(VOIP_DumpUL_CB, VOIP_FillDL_CB, 0x1000, 0, 0) == 0) result_code = RESULT_OK; } break; case AUDIO_DRIVER_STOP: { // Clear voip mode, which block audio processing for voice calls //audio_control_dsp( DSPCMD_TYPE_COMMAND_CLEAR_VOIPMODE, 0, 0, 0, 0, 0 ); // arg0 = 0 to clear VOIPmode VPRIPCMDQ_Clear_VoIPMode(0); VoIP_StopTelephony(); result_code = RESULT_OK; } break; case AUDIO_DRIVER_SET_VOIP_UL_CB: { if(pCtrlStruct == NULL) { Log_DebugPrintf(LOGID_AUDIO,"AUDIO_DRIVER_ProcessVOIPCmd::Invalid Ptr \n" ); return result_code; } //assign the call back aud_drv->pVoipULCallback = (AUDIO_DRIVER_VoipCB_t)pCtrlStruct; result_code = RESULT_OK; } break; case AUDIO_DRIVER_SET_VOIP_DL_CB: { if(pCtrlStruct == NULL) { Log_DebugPrintf(LOGID_AUDIO,"AUDIO_DRIVER_ProcessVOIPCmd::Invalid Ptr \n" ); return result_code; } //assign the call back aud_drv->pVoipDLCallback = (AUDIO_DRIVER_VoipCB_t)pCtrlStruct; result_code = RESULT_OK; } break; default: Log_DebugPrintf(LOGID_AUDIO,"AUDIO_DRIVER_ProcessVOIPCmd::Unsupported command \n" ); break; } return result_code; }