void HandleCallStatusIndCb(InterTaskMsg_t *taskMsg) { CallStatusMsg_t *callStatusMsg = NULL; UInt32 tid = 0; RPC_Msg_t msg; UInt32 codecID = (UInt32) 0; if (taskMsg->msgType == MSG_CALL_STATUS_IND) { aTrace (LOG_AUDIO_DRIVER, "HandleCallStatusIndCb()" "Receive MSG_CALL_STATUS_IND"); callStatusMsg = (CallStatusMsg_t *) taskMsg->dataBuf; aTrace(LOG_AUDIO_DRIVER, "HandleCallStatusIndCb() codecid =", callStatusMsg->codecId); codecID = callStatusMsg->codecId; msg.msgId = MSG_AUDIO_CALL_STATUS_IND; msg.tid = tid; msg.clientID = audioClientId; msg.dataLen = 0; msg.dataBuf = (void *)(&codecID); msg.dataLen = sizeof(UInt32); RPC_SerializeRsp(&msg); } }
static void IRQ_EnableRIPInt(void) { unsigned int x; void __iomem *chipreg_base = (void __iomem *)(KONA_CHIPREG_VA); void __iomem *base = (void __iomem *)(KONA_BINTC_BASE_ADDR); if (vp_shared_mem->shared_dsp_support_chip_reg_ap_int) { vp_shared_mem->shared_ap_support_chip_reg_ap_int = 1; aTrace(LOG_AUDIO_DSP, "\n\r\t*IRQ_EnableRIPInt: New Int*\n\r"); writel((1<<CHIPREG_OUTPUT12), (base + BINTC_IMR0_15_SET_OFFSET)); //Programming Ap2DSP as wakeup event for power manager writel((1<<CHIPREG_OUTPUT12),(base + BINTC_IMR0_9_SET_OFFSET)); x=readl(chipreg_base + CHIPREG_MDM_SW_INTR_SEL_OFFSET); x|=(1<<CHIPREG_OUTPUT12); writel(x,(chipreg_base + CHIPREG_MDM_SW_INTR_SEL_OFFSET)); } else { aTrace(LOG_AUDIO_DSP, "\n\r\t*IRQ_EnableRIPInt: Old Int*\n\r"); vp_shared_mem->shared_ap_support_chip_reg_ap_int = 0; *(volatile UInt32*)(KONA_BINTC_BASE_ADDR + BINTC_IMR1_0_SET_OFFSET + BINTC_OUT_DEST_AP2DSP*BMREG_BLOCK_SIZE) = 1<<(IRQ_TO_BMIRQ(AP_RIP_IRQ)-32); } printk(KERN_INFO "\n\r\t*IRQ_EnableRIPInt " " shared_dsp_support_chip_reg_ap_int = %x*\n\r" "\n\r\t* shared_ap_support_chip_reg_ap_int = %x*\n\r", vp_shared_mem->shared_dsp_support_chip_reg_ap_int, vp_shared_mem->shared_ap_support_chip_reg_ap_int); return; }
/* Description: AT command handler, handle command AT commands at*maudvol=P1,P2,P3 Parameters: pChip -- Pointer to chip data structure ParamCount -- Count of parameter array Params --- P1,P2,...,P6 */ int AtMaudVol(brcm_alsa_chip_t *pChip, Int32 ParamCount, Int32 *Params) { int *pVolume; int mode, vol; aTrace(LOG_AUDIO_DRIVER, "%s P1-P6=%ld %ld %ld %ld %ld %ld cnt=%ld\n", __func__, Params[0], Params[1], Params[2], Params[3], Params[4], Params[5], ParamCount); csl_caph_ControlHWClock(TRUE); switch (Params[0]) { case 6: /*at*maudvol=6 */ mode = AUDCTRL_GetAudioMode(); /*Get volume. Range -36 ~ 0 dB in Driver and DSP: */ Params[0] = AUDCTRL_GetTelephonySpkrVolume(AUDIO_GAIN_FORMAT_mB); Params[0] = Params[0] / 100; /* dB */ Params[0] += AudParmP()[mode].voice_volume_max; /* Range 0~36 dB shown in PCG */ /* pVolume = pChip->streamCtl[ CTL_STREAM_PANEL_VOICECALL -1].ctlLine[mode].iVolume; Params[0] = pVolume[0]; */ aTrace(LOG_AUDIO_DRIVER, "%s pVolume[0] %ld\n", __func__, Params[0]); return 0; case 7: /* at*maudvol=7,x Range 0~36 dB in PCG */ mode = AUDCTRL_GetAudioMode(); /* mode = pChip->streamCtl[ CTL_STREAM_PANEL_VOICECALL-1].iLineSelect[1]; */ pVolume = pChip->streamCtl[CTL_STREAM_PANEL_VOICECALL - 1].ctlLine[mode].iVolume; pVolume[0] = Params[1]; pVolume[1] = Params[1]; vol = Params[1]; vol -= AudParmP()[mode].voice_volume_max; /* Range -36 ~ 0 dB in DSP */ AUDCTRL_SetTelephonySpkrVolume(AUDIO_SINK_UNDEFINED, (vol * 100), AUDIO_GAIN_FORMAT_mB); aTrace(LOG_AUDIO_DRIVER, "%s pVolume[0] %d mode=%d vol %d\n", __func__, pVolume[0], mode, vol); return 0; default: aWarn("%s Unsupported cmd %ld\n", __func__, Params[0]); break; } return -1; }
static void HWDEP_VOIP_FillDL_CB( void *pPrivate, u8 *pDst, u32 nSize, u32 *timestamp) { bcm_caph_hwdep_voip_t *pVoIP; pVoIP = (bcm_caph_hwdep_voip_t *) pPrivate; guDLCount++; if (0 == (guDLCount%500)) aTrace(LOG_ALSA_INTERFACE, "FillDL_CB ulstarted=%d" "dlstarted=%d, voipinstcnt=%d frames_available_to_read=%d, " "frames_available_to_write=%d", pVoIP->ulstarted, pVoIP->dlstarted, voipinstcnt, pVoIP->frames_available_to_read, pVoIP->frames_available_to_write); if (pVoIP->dlstarted == 0) { FillSilenceFrame(pVoIP->codec_type_dl, nSize, pDst); return; } if (pVoIP->buffer_handle->voip_data_dl_buf_ptr) { /*DEBUG("HWDEP_VOIP_FillDL_CB pVoIP->" *"frames_available_to_write %d\n", pVoIP-> * frames_available_to_write); */ if (pVoIP->frames_available_to_write == 0) { /* fill with silent data based on the frame type */ FillSilenceFrame(pVoIP->codec_type_dl, nSize, pDst); aTrace(LOG_ALSA_INTERFACE, "under run frame_size %d," "writecount %d\n", pVoIP->frame_size_dl, pVoIP->writecount); } else { if (isvolte) *timestamp = pVoIP->buffer_handle->dl_timestamp; else *timestamp = 0; memcpy(pDst, pVoIP->buffer_handle->voip_data_dl_buf_ptr + pVoIP->buffer_handle->voip_data_dl_rd_index, nSize); pVoIP->frames_available_to_write--; if (!isvolte) pVoIP->writecount++; #ifdef CONFIG_VOIP_BUFFER_INCREASE pVoIP->buffer_handle->voip_data_dl_rd_index += nSize; if (pVoIP->buffer_handle->voip_data_dl_rd_index >= pVoIP->buffer_size_dl) { pVoIP->buffer_handle->voip_data_dl_rd_index -= pVoIP->buffer_size_dl; } #endif } } wake_up(&pVoIP->sleep); }
static void HWDEP_VOIP_DumpUL_CB(void *pPrivate, u8 * pSrc, u32 nSize) { bcm_caph_hwdep_voip_t *pVoIP; pVoIP = (bcm_caph_hwdep_voip_t *) pPrivate; /* DEBUG("HWDEP_VOIP_DumpUL_CB nSize %d pVoIP 0x%x\n", * nSize,pVoIP); */ guULCount++; if (0 == (guULCount%500)) aTrace(LOG_ALSA_INTERFACE, "DumpUL_CB ulstarted=%d dlstarted=" "%d, voipinstcnt=%d frames_available_to_read=%d, " "frames_available_to_write=%d", pVoIP->ulstarted, pVoIP->dlstarted, voipinstcnt, pVoIP->frames_available_to_read, pVoIP->frames_available_to_write); if (pVoIP->ulstarted == 0) return; /* aTrace(LOG_ALSA_INTERFACE, "DumpUL_CB buffer_handle=0x%x" "voip_data_ul_buf_ptr=0x%x," "voip_data_ul_wr_index %d\n", pVoIP->buffer_handle, pVoIP->buffer_handle->voip_data_ul_buf_ptr, pVoIP->buffer_handle->voip_data_ul_wr_index);*/ if (pVoIP->buffer_handle) { if (pVoIP->buffer_handle->voip_data_ul_buf_ptr) { if (pVoIP->buffer_handle->voip_data_ul_buf_ptr + pVoIP->buffer_handle->voip_data_ul_wr_index == 0x10) CAPH_ASSERT(0); memcpy(pVoIP->buffer_handle->voip_data_ul_buf_ptr + pVoIP->buffer_handle->voip_data_ul_wr_index, pSrc, nSize); pVoIP->frames_available_to_read++; if (pVoIP->frames_available_to_read > 1) aTrace(LOG_ALSA_INTERFACE, "more than 1 frame" " available frame_size %d, readcount %d\n", pVoIP->frame_size_ul, pVoIP->frames_available_to_read); #ifdef CONFIG_VOIP_BUFFER_INCREASE pVoIP->buffer_handle->voip_data_ul_wr_index += nSize; if (pVoIP->buffer_handle->voip_data_ul_wr_index >= pVoIP->buffer_size_ul) { pVoIP->buffer_handle->voip_data_ul_wr_index -= pVoIP->buffer_size_ul; } #endif } } wake_up(&pVoIP->sleep); }
/**************************************************************************** * * Function Name: void csl_caph_switch_init(cUInt32 baseAddress) * * Description: init CAPH switch block * ****************************************************************************/ void csl_caph_switch_init(UInt32 baseAddress) { aTrace(LOG_AUDIO_CSL, "csl_caph_switch_init:: "); csl_caph_switch_initDSTStatus(); handle = chal_caph_switch_init(baseAddress); aTrace(LOG_AUDIO_CSL, "csl_caph_switch_Init:: baseAddress = 0x%lx\n", baseAddress); return; }
/** * Function Name: DSPDRV_Init * * Description: Initialize DSP driver * * Notes: * ******************************************************************************/ void DSPDRV_Init() { UInt32 *dsp_shared_mem; int rc; AP_SharedMem_t *shared_mem; UInt16 temp; aTrace(LOG_AUDIO_DSP, "DSPDRV_Init:\n"); /* get DSP AP shared memory */ dsp_shared_mem = ioremap_nocache(AP_SH_BASE, AP_SH_SIZE); if (dsp_shared_mem == NULL) { aTrace(LOG_AUDIO_DSP, "\n\r\t* mapping shared memory failed\n\r"); return; } shared_mem = (AP_SharedMem_t *) dsp_shared_mem; temp = shared_mem->shared_dsp_support_chip_reg_ap_int; /* initialize DSP AP shared memory */ VPSHAREDMEM_Init(dsp_shared_mem); shared_mem->shared_dsp_support_chip_reg_ap_int = temp; /* Create Tasklet */ tasklet_init(&(dsp_drv.task), dsp_thread_proc, (unsigned long)(&dsp_drv)); /* enable AP to DSP interrupt */ IRQ_EnableRIPInt(); /* enable DSP to AP interrupt */ IRQ_Enable_BModem_Interrupt(); /* Plug in the ISR enables IRQ198 */ rc = request_irq(COMMS_SUBS6_IRQ, rip_isr, IRQF_DISABLED | IRQF_NO_SUSPEND, "bcm215xx-dsp", &(dsp_drv)); if (rc < 0) { aTrace(LOG_AUDIO_DSP, "RIPISR: %s failed to attach interrupt, rc = %d\n", __func__, rc); return; } CSL_VPU_Enable(); return; }
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++ * * Function Name: PcmPlaybackPrepare * * Description: Prepare PCM playback device, next call is Trigger or Close * *------------------------------------------------------------ */ static int PcmPlaybackPrepare(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; brcm_alsa_chip_t *chip = snd_pcm_substream_chip(substream); BRCM_AUDIO_Param_Prepare_t parm_prepare; aTrace(LOG_ALSA_INTERFACE, "ALSA-CAPH playback_prepare " "stream=%d period=%d period_size=%d," "bufsize=%d start_threshold=%ld stop_threshold=%ld" " frame_bits %d rate=%d ch=%d\n", substream->number, (int)runtime->periods, (int)runtime->period_size, (int)runtime->buffer_size, runtime->start_threshold, runtime->stop_threshold, runtime->frame_bits, runtime->rate, runtime->channels); chip->streamCtl[substream->number].stream_hw_ptr = 0; parm_prepare.drv_handle = substream->runtime->private_data; parm_prepare.cbParams.pfCallBack = AUDIO_DRIVER_InterruptPeriodCB; parm_prepare.cbParams.pPrivateData = (void *)substream; parm_prepare.period_count = runtime->periods; parm_prepare.period_bytes = frames_to_bytes(runtime, runtime->period_size); parm_prepare.buf_param.buf_size = runtime->dma_bytes; /*virtual address */ parm_prepare.buf_param.pBuf = runtime->dma_area; /* physical address */ parm_prepare.buf_param.phy_addr = (UInt32) (runtime->dma_addr); aTrace(LOG_ALSA_INTERFACE, "buf_size = %d pBuf=0x%lx phy_addr=0x%x\n", runtime->dma_bytes, (UInt32) runtime->dma_area, runtime->dma_addr); parm_prepare.drv_config.sample_rate = runtime->rate; parm_prepare.drv_config.num_channel = runtime->channels; parm_prepare.drv_config.bits_per_sample = 16; parm_prepare.drv_config.instanceId = substream->number; parm_prepare.drv_config.arm2sp_mixMode = chip->pi32SpeechMixOption[substream->number]; parm_prepare.stream = substream->number; AUDIO_Ctrl_Trigger(ACTION_AUD_SetPrePareParameters, &parm_prepare, NULL, 0); /* DEBUG("\n%lx:playback_prepare period bytes=%d, periods =%d, buffersize=%d\n",jiffies, g_brcm_alsa_chip->period_bytes[0], runtime->periods, runtime->dma_bytes); */ return 0; }
/**************************************************************************** * * Function Name: void csl_caph_switch_stop_transfer(CSL_CAPH_SWITCH_CHNL_e * chnl) * * Description: stop the channel * ****************************************************************************/ void csl_caph_switch_stop_transfer(CSL_CAPH_SWITCH_CHNL_e chnl) { CAPH_SWITCH_CHNL_e chal_chnl = CAPH_SWITCH_CH_VOID; aTrace (LOG_AUDIO_CSL, "csl_caph_switch_stop_transfer:: "); aTrace (LOG_AUDIO_CSL, "csl_caph_switch_stop_transfer:: chnl = 0x%x", chnl); /* Get cHAL Channel */ chal_chnl = csl_caph_switch_get_chalchnl(chnl); /* Stop this channel */ chal_caph_switch_disable(handle, chal_chnl); return; }
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++ * * Function Name: PcmCapturePrepare * * Description: Prepare hardware to capture * *------------------------------------------------------------ */ static int PcmCapturePrepare(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; brcm_alsa_chip_t *chip = snd_pcm_substream_chip(substream); int substream_number = substream->number + CTL_STREAM_PANEL_PCMIN - 1; BRCM_AUDIO_Param_Prepare_t parm_prepare; aTrace(LOG_ALSA_INTERFACE, "ALSA-CAPH %lx:capture_prepare: stream=%d rate =%d," "format =%d channel=%d dma_area=0x%x dma_bytes=%d," "period_bytes=%d avail_min=%d periods=%d buffer_size=%d\n", jiffies, substream_number, runtime->rate, runtime->format, runtime->channels, (unsigned int)runtime->dma_area, runtime->dma_bytes, frames_to_bytes(runtime, runtime->period_size), frames_to_bytes(runtime, runtime->control->avail_min), runtime->periods, (int)runtime->buffer_size); chip->streamCtl[substream_number].stream_hw_ptr = 0; parm_prepare.drv_handle = substream->runtime->private_data; parm_prepare.cbParams.pfCallBack = AUDIO_DRIVER_CaptInterruptPeriodCB; parm_prepare.cbParams.pPrivateData = (void *)substream; parm_prepare.period_count = runtime->periods; parm_prepare.period_bytes = frames_to_bytes(runtime, runtime->period_size); parm_prepare.buf_param.buf_size = runtime->dma_bytes; /* virtual address */ parm_prepare.buf_param.pBuf = runtime->dma_area; /* physical address */ parm_prepare.buf_param.phy_addr = (UInt32) (runtime->dma_addr); aTrace(LOG_ALSA_INTERFACE, "buf_size = %d pBuf=0x%lx phy_addr=0x%x\n", runtime->dma_bytes, (UInt32) runtime->dma_area, runtime->dma_addr); parm_prepare.drv_config.sample_rate = runtime->rate; parm_prepare.drv_config.num_channel = runtime->channels; parm_prepare.drv_config.bits_per_sample = 16; parm_prepare.stream = substream_number; AUDIO_Ctrl_Trigger(ACTION_AUD_SetPrePareParameters, &parm_prepare, NULL, 0); return 0; }
/**************************************************************************** * * Function Name: void csl_caph_switch_deinit(void) * * Description: deinit CAPH switch block * ****************************************************************************/ void csl_caph_switch_deinit(void) { aTrace(LOG_AUDIO_CSL, "csl_caph_switch_deinit:: "); chal_caph_switch_deinit(handle); return; }
/**************************************************************************** * * Function Name: void csl_caph_cfifo_config_fifo(CSL_CAPH_CFIFO_FIFO_e fifo, * CSL_CAPH_CFIFO_DIRECTION_e direction, * UInt16 threshold) * * Description: configure CAPH CFIFO buffer * ****************************************************************************/ void csl_caph_cfifo_config_fifo(CSL_CAPH_CFIFO_FIFO_e fifo, CSL_CAPH_CFIFO_DIRECTION_e direction, UInt16 threshold) { CAPH_CFIFO_e chal_fifo = CAPH_CFIFO_VOID; CAPH_CFIFO_CHNL_DIRECTION_e chalDirect = CAPH_CFIFO_IN; aTrace (LOG_AUDIO_CSL, "csl_caph_cfifo_config_fifo:: fifo %d dir %d threshold %d.\r\n", fifo, direction, threshold); chal_fifo = csl_caph_cfifo_get_chal_fifo(fifo); chalDirect = csl_caph_cfifo_get_chal_direction(direction); if (chal_fifo != CAPH_CFIFO_VOID) { chal_caph_cfifo_set_direction(handle, chal_fifo, chalDirect); chal_caph_cfifo_queue_add_fifo(handle, chal_fifo, cfifo_queue); /* threshold2 is hardcoded to 0 */ chal_caph_cfifo_set_fifo_thres(handle, chal_fifo, threshold, 0); /* this is moved from csl_caph_cfifo_start_fifo to here */ /* if put in csl_caph_cfifo_start_fifo, * stuck happened with dsp_audio_v1.0 fpga image */ chal_caph_cfifo_clr_fifo(handle, chal_fifo); } return; }
/**************************************************************************** * * Function Name: CSL_CAPH_CFIFO_FIFO_e csl_caph_cfifo_obtain_fifo( * CSL_CAPH_DATAFOMAT_e dataFormat, * CSL_CAPH_CFIFO_SAMPLERATE_e sampleRate) * * Description: Obtain a CAPH CFIFO buffer * ****************************************************************************/ CSL_CAPH_CFIFO_FIFO_e csl_caph_cfifo_obtain_fifo(CSL_CAPH_DATAFORMAT_e dataFormat, CSL_CAPH_CFIFO_SAMPLERATE_e sampleRate) { UInt16 id = 0; CSL_CAPH_CFIFO_FIFO_e csl_caph_cfifo_ch = CSL_CAPH_CFIFO_NONE; aTrace (LOG_AUDIO_CSL, "csl_caph_cfifo_obtain_fifo::\n"); /* just find available cfifo in the pool. * use a better scheme based on dataformat and samplerate later. */ for (id = CSL_CAPH_CFIFO_FIFO1; id <= CSL_CAPH_CFIFO_FIFO16; id++) { if ((CSL_CFIFO_table[id].owner == CAPH_ARM) && (CSL_CFIFO_table[id].status == 0)) { csl_caph_cfifo_ch = (CSL_CAPH_CFIFO_FIFO_e) id; CSL_CFIFO_table[id].status = 1; break; } } return csl_caph_cfifo_ch; }
/**************************************************************************** * * Function Name: void void csl_caph_cfifo_fifo_init(void) * * Description: init CAPH CFIFO fifo address and size * ****************************************************************************/ static void csl_caph_cfifo_fifo_init(void) { UInt16 id, total_fifo_size = 0; CAPH_CFIFO_e chal_fifo; aTrace (LOG_AUDIO_CSL, "csl_caph_cfifo_fifo_init::\n"); for (id = CSL_CAPH_CFIFO_FIFO1; id <= CSL_CAPH_CFIFO_FIFO16; id++) { chal_fifo = csl_caph_cfifo_get_chal_fifo((CSL_CAPH_CFIFO_FIFO_e) id); chal_caph_fifo_clear_register(handle, chal_fifo); chal_caph_cfifo_set_address(handle, chal_fifo, CSL_CFIFO_table[id].address); chal_caph_cfifo_set_size(handle, chal_fifo, CSL_CFIFO_table[id].size); total_fifo_size += CSL_CFIFO_table[id].size; } audio_xassert(total_fifo_size <= CSL_CFIFO_TOTAL_SIZE, total_fifo_size); return; }
void Audio_InitRpc(void) { if (!audioRpcInited) { RPC_Handle_t handle; RPC_InitParams_t params = { 0 }; RPC_SyncInitParams_t syncParams; params.iType = INTERFACE_RPC_DEFAULT; params.table_size = (sizeof(AUDIO_Prim_dscrm) / sizeof(RPC_XdrInfo_t)); params.xdrtbl = AUDIO_Prim_dscrm; params.respCb = HandleAudioEventrespCb; params.reqCb = HandleAudioEventReqCb; params.rpcNtfFn = HandleAudioRpcNotification; syncParams.copyCb = AudioCopyPayload; handle = RPC_SyncRegisterClient(¶ms, &syncParams); audioClientId = RPC_SYS_GetClientID(handle); #if defined(FUSE_COMMS_PROCESSOR) SYS_RegisterForMSEvent(HandleCallStatusIndCb, 0); #endif audioRpcInited = TRUE; aTrace(LOG_AUDIO_DRIVER, "Audio_InitRpc %d", audioClientId); } }
/**************************************************************************** * * Function Name: void csl_caph_dma_deinit(void) * * Description: deinit CAPH dma block * ****************************************************************************/ void csl_caph_dma_deinit(void) { aTrace(LOG_AUDIO_CSL, "%s::\n", __func__); chal_caph_dma_deinit(handle); memset(dmaCH_ctrl, 0, sizeof(dmaCH_ctrl)); return; }
/**************************************************************************** * * Function Name:Result_t csl_audio_capture_deinit(UInt32 streamID) * * Description: De-initialize CSL capture layer * ****************************************************************************/ Result_t csl_audio_capture_deinit(UInt32 streamID) { CSL_CAPH_Capture_Drv_t *audDrv = NULL; unsigned long flags; audDrv = GetCaptureDriverByType(streamID); if (audDrv == NULL) return RESULT_ERROR; aTrace (LOG_AUDIO_CSL, "csl_audio_capture_deinit::dmaCH=0x%x, dmaCH2-0x%x\n", audDrv->dmaCH, audDrv->dmaCH2); audDrv->streamID = 0; audDrv->source = CSL_CAPH_DEV_NONE; audDrv->sink = CSL_CAPH_DEV_NONE; audDrv->pathID = 0; spin_lock_irqsave(&audDrv->configLock, flags); audDrv->dmaCB = NULL; spin_unlock_irqrestore(&audDrv->configLock, flags); audDrv->dmaCH = 0; audDrv->dmaCH2 = 0; audDrv->ringBuffer = NULL; audDrv->numBlocks = 0; audDrv->blockSize = 0; audDrv->blockIndex = 0; return RESULT_OK; }
UInt32 audio_control_generic(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; */ 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_generic tid=%ld, param1=%ld\n", tid, param1); CAPI2_audio_control_generic(tid, audioClientId, &audioParam); /* RPC_SyncWaitForResponse(tid, audioClientId, &ackResult, &msgType, NULL); */ return val; }
static int BCMAudLOG_mmap(struct file *filp, struct vm_area_struct *vma) { int ret; long length = vma->vm_end - vma->vm_start; aTrace(LOG_ALSA_INTERFACE, "ALSA-CAPH BCMLOG_mmap\n"); /* check length - do not allow larger mappings than the number of * pages allocated */ if (length > (PAGE_SIZE + (sizeof(LOG_FRAME_t) * 4))) { aError("\n Failed at page boundary\n\r"); return -EIO; } /* map the whole physically contiguous area in one piece */ ret = remap_pfn_range(vma, vma->vm_start, virt_to_phys((void *)bcmlog_stream_area) >> PAGE_SHIFT, length, vma->vm_page_prot); if (ret != 0) { aError("\n BCMLOG_mmap_kmem -EAGAIN \r\n"); return -EAGAIN; } return 0; }
/** * Function Name: VPSHAREDMEM_TriggerRIPInt * * Description: This function triggers DSP interrupt * * Notes: * ******************************************************************************/ void VPSHAREDMEM_TriggerRIPInt() { aTrace(LOG_AUDIO_DSP, "\n\r\t* VPSHAREDMEM_TriggerRIPInt\n\r"); IRQ_TriggerRIPInt(); }
void Audio_InitRpc(void) { if (!audioRpcInited) { RPC_Handle_t handle; RPC_InitParams_t params = { 0 }; RPC_SyncInitParams_t syncParams; params.iType = INTERFACE_RPC_DEFAULT; params.table_size = (sizeof(AUDIO_Prim_dscrm) / sizeof(RPC_XdrInfo_t)); params.xdrtbl = AUDIO_Prim_dscrm; params.respCb = HandleAudioEventrespCb; params.reqCb = HandleAudioEventReqCb; params.cpResetCb = HandleAudioCPResetCb; syncParams.copyCb = AudioCopyPayload; handle = RPC_SyncRegisterClient(¶ms, &syncParams); audioClientId = RPC_SYS_GetClientID(handle); #if defined(AUDIO_RPC_END_POINT) /* Initialize the Audio RPC thread's message queue. */ Audio_MsgQueueInit(); /* Register message handler to * RPC-IPC layer */ RPC_PACKET_RegisterDataInd(0, INTERFACE_AUDIO, AUDIO_RPC_MsgCb, NULL); #endif audioRpcInited = TRUE; aTrace(LOG_AUDIO_DRIVER, "Audio_InitRpc %d", audioClientId); } }
/** Description: AT command handler, handle command AT commands at+maudlooptest=P1,P2,P3 Parameters: pChip -- Pointer to chip data structure ParamCount -- Count of parameter array Params --- P1,P2,...,P6 **/ int AtMaudLoopback(brcm_alsa_chip_t *pChip, Int32 ParamCount, Int32 *Params) { aTrace(LOG_AUDIO_DRIVER, "%s P1-P6=%ld %ld %ld %ld %ld %ld cnt=%ld\n", __func__, Params[0], Params[1], Params[2], Params[3], Params[4], Params[5], ParamCount); return -1; }
/* Description: Kernel AT command handler and gernal purpose controls Parameters cmdIndex -- command index coresponding to AT comand ParamCount -- count of array Params Params -- Parameter array Return 0 on success, -1 otherwise */ int AtAudCtlHandler_put(Int32 cmdIndex, brcm_alsa_chip_t *pChip, Int32 ParamCount, Int32 *Params) { int rtn = 0; aTrace(LOG_AUDIO_DRIVER, "AT-AUD-put ctl=%ld ParamCount= %ld " "[%ld %ld %ld %ld %ld %ld %ld]\n", cmdIndex, ParamCount, Params[0], Params[1], Params[2], Params[3], Params[4], Params[5], Params[6]); switch (cmdIndex) { case AT_AUD_CTL_INDEX: { int count = sizeof(pChip->i32AtAudHandlerParms) / sizeof(pChip->i32AtAudHandlerParms[0]); if (count > ParamCount) count = ParamCount; memcpy(pChip->i32AtAudHandlerParms, Params, sizeof(pChip->i32AtAudHandlerParms[0]) * count); return 0; } case AT_AUD_CTL_DBG_LEVEL: gAudioDebugLevel = Params[0]; return 0; case AT_AUD_CTL_HANDLER: break; default: return -1; } switch (Params[0]) { case AT_AUD_HANDLER_MODE: rtn = AtMaudMode(pChip, ParamCount - 1, &Params[1]); break; case AT_AUD_HANDLER_VOL: rtn = AtMaudVol(pChip, ParamCount - 1, &Params[1]); break; case AT_AUD_HANDLER_TST: rtn = AtMaudTst(pChip, ParamCount - 1, &Params[1]); break; case AT_AUD_HANDLER_LOG: rtn = AtMaudLog(pChip, ParamCount - 1, &Params[1]); break; case AT_AUD_HANDLER_LBTST: rtn = AtMaudLoopback(pChip, ParamCount - 1, &Params[1]); break; default: aWarn( "%s Unsupported handler %ld\n", __func__, Params[0]); rtn = -1; break; } return rtn; }
UInt32 audio_cmf_filter(AudioCompfilter_t *cf) { UInt32 val = (UInt32) 0; aTrace(LOG_AUDIO_DRIVER, "audio_cmf_filter : dummy for AP only"); return val; }
void HandleAudioEventrespCb(RPC_Msg_t *pMsg, ResultDataBufHandle_t dataBufHandle, UInt32 userContextData) { aTrace(LOG_AUDIO_DRIVER, "HandleAudioEventrespCb : dummy for AP only"); }
/**************************************************************************** * * Function Name: void csl_caph_cfifo_deinit(void) * * Description: deinit CAPH CFIFO block * ****************************************************************************/ void csl_caph_cfifo_deinit(void) { aTrace(LOG_AUDIO_CSL, "csl_caph_cfifo_deinit::\n"); chal_caph_cfifo_deinit(handle); return; }
/**************************************************************************** * * Function Name: void csl_caph_switch_add_dst(CSL_CAPH_SWITCH_CHNL_e chnl, * UInt32 FIFO_dstAddr) * * Description: Add one destination to a CAPH switch channel * ****************************************************************************/ void csl_caph_switch_add_dst(CSL_CAPH_SWITCH_CHNL_e chnl, UInt32 FIFO_dstAddr) { CAPH_SWITCH_CHNL_e chal_chnl = CAPH_SWITCH_CH_VOID; aTrace(LOG_AUDIO_CSL, "csl_caph_switch_add_dst:: "); aTrace(LOG_AUDIO_CSL, "csl_caph_switch_add_dst:: chnl = 0x%x, dstcAddr = 0x%lx\n", chnl, FIFO_dstAddr); /* Get cHAL Channel */ chal_chnl = csl_caph_switch_get_chalchnl(chnl); /* Add one more destination for this channel */ if (CAPH_DST_OK != chal_caph_switch_add_dst(handle, chal_chnl, (UInt16) FIFO_dstAddr)) aError("csl_caph_switch_add_dst:: FAIL\n"); }
UInt32 audio_control_dsp(UInt32 param1, UInt32 param2, UInt32 param3, UInt32 param4, UInt32 param5, UInt32 param6) { UInt32 val = (UInt32) 0; aTrace(LOG_AUDIO_DRIVER, "audio_control_dsp : dummy for AP only"); return val; }
/**************************************************************************** * * Function Name: csl_caph_switch_enable_clock * * Description: enable/disable NOC global bit * ****************************************************************************/ void csl_caph_switch_enable_clock(int enable) { aTrace(LOG_AUDIO_CSL, "%s %d\n", __func__, enable); if (enable) chal_caph_switch_enable_clock(handle); else chal_caph_switch_disable_clock(handle); return; }
/**************************************************************************** * * Function Name: void csl_caph_dma_start_transfer(CSL_CAPH_DMA_CHNL_e chnl) * * Description: start the channel * ****************************************************************************/ void csl_caph_dma_start_transfer(CSL_CAPH_DMA_CHNL_e chnl) { aTrace(LOG_AUDIO_CSL, "%s:: %d\n", __func__, chnl); if (chnl != CSL_CAPH_DMA_NONE) chal_caph_dma_enable(handle, csl_caph_dma_get_chal_chnl(chnl)); return; }