// ==========================================================================
//
// Function Name: csl_audvoc_capture_init
//
// Description: Init audio path capture. 
//
// =========================================================================
UInt32 csl_audio_capture_init( CSL_AUDIO_DEVICE_e source, CSL_AUDIO_DEVICE_e sink )
{
	OSDAL_DMA_CLIENT	srcClient = OSDAL_DMA_CLIENT_AUDIO_IN_FIFO;
	CSL_AUDVOC_Drv_t	*audDrv = NULL;
	UInt32 streamID = CSL_AUDVOC_STREAM_NONE;

	Log_DebugPrintf(LOGID_SOC_AUDIO, "csl_audvoc_capture_init:: \n");
	if (source == CSL_AUDVOC_DEV_CAPTURE_BTW)
		srcClient = OSDAL_DMA_CLIENT_AUDIO_WB_MIXERTAP;
		
	// Get DMA channel
    if(OSDAL_DMA_Obtain_Channel(srcClient, OSDAL_DMA_CLIENT_MEMORY, &dmaChAudio) != OSDAL_ERR_OK)
    {
        Log_DebugPrintf(LOGID_SOC_AUDIO, "csl_audvoc_capture_init:: Error, Obtain channel failed.\n");
		return CSL_AUDVOC_STREAM_NONE;
    }

	Log_DebugPrintf(LOGID_SOC_AUDIO, "csl_audvoc_capture_init:: DMA channel for audio path capture 0x%x\n", dmaChAudio);

	if (source == CSL_AUDVOC_DEV_CAPTURE_AUDIO)
	{
		streamID = CSL_AUDVOC_STREAM_AUDIO;
	}
	else if (source == CSL_AUDVOC_DEV_CAPTURE_BTW)
	{
		streamID = CSL_AUDVOC_STREAM_BTW;
	}
	else
	{
		return streamID;     
	}
	
	audDrv = GetDriverByType (streamID);

	if (audDrv == NULL)
		return CSL_AUDVOC_STREAM_NONE;
	
	memset(audDrv, 0, sizeof(CSL_AUDVOC_Drv_t));
	audDrv->streamID = streamID;
	audDrv->source = source;
	audDrv->sink = sink;
	audDrv->dmaCH = dmaChAudio;
	
	return audDrv->streamID;
}
// ==========================================================================
//
// Function Name: csl_audvoc_render_init
//
// Description: Init the audio path render
//
// =========================================================================
UInt32 csl_audio_render_init (CSL_AUDIO_DEVICE_e source, CSL_AUDIO_DEVICE_e sink)
{
	OSDAL_DMA_CLIENT	dstClient = OSDAL_DMA_CLIENT_AUDIO_OUT_FIFO;
	CSL_AUDVOC_Drv_t	*audDrv = NULL;
	UInt32 streamID = CSL_AUDVOC_STREAM_NONE;
	
	if (sink == CSL_AUDVOC_DEV_RENDER_POLYRINGER)
		dstClient = OSDAL_DMA_CLIENT_POLYRING_OUT_FIFO;
	
	// Get DMA channel
    if(OSDAL_DMA_Obtain_Channel(OSDAL_DMA_CLIENT_MEMORY, dstClient, &dmaChAudio) != OSDAL_ERR_OK)
    {
        Log_DebugPrintf(LOGID_SOC_AUDIO, "csl_audvoc_render_init:: Error, Obtain channel failed.\n");
		return CSL_AUDVOC_STREAM_NONE;
    }

	Log_DebugPrintf(LOGID_SOC_AUDIO, "csl_audvoc_render_init:: DMA channel for audio path render 0x%x\n", dmaChAudio);

	if (sink == CSL_AUDVOC_DEV_RENDER_AUDIO)
	{
		streamID = CSL_AUDVOC_STREAM_AUDIO;
	}
	else if (sink == CSL_AUDVOC_DEV_RENDER_POLYRINGER)
	{
		streamID = CSL_AUDVOC_STREAM_POLYRINGER;
	}
	else
	{
		return streamID;     
	}
	
	audDrv = GetDriverByType (streamID);

	if (audDrv == NULL)
		return CSL_AUDVOC_STREAM_NONE;
	
	memset(audDrv, 0, sizeof(CSL_AUDVOC_Drv_t));
	audDrv->streamID = streamID;
	audDrv->source = source;
	audDrv->sink = sink;
	audDrv->dmaCH = dmaChAudio;
	
	return audDrv->streamID;
}