Exemple #1
0
TaskRequestMap_t *RPC_SyncInitTaskMap(void)
{
	TaskRequestMap_t *taskMap = GetMapForCurrentTask();

	if (!taskMap) {
		taskMap = GetNewMapForCurrentTask();
		assert(taskMap);
		// fill in struct (task field is already filled in by GetNewMapForCurrentTask() call)
		taskMap->ackSema = OSSEMAPHORE_Create(1, OSSUSPEND_PRIORITY);
		assert(taskMap->ackSema);
		// start in signalled state
		OSSEMAPHORE_Obtain(taskMap->ackSema, TICKS_FOREVER);

		taskMap->rspSema = OSSEMAPHORE_Create(1, OSSUSPEND_PRIORITY);
		assert(taskMap->rspSema);
		// start in signalled state
		OSSEMAPHORE_Obtain(taskMap->rspSema, TICKS_FOREVER);

	}

	taskMap->tid = 0;
	taskMap->ack = ACK_FAILED;
	taskMap->state = RPC_SYNC_STATE_WAITING_FOR_ACK;
	taskMap->isResultPending = FALSE;
	taskMap->result = RESULT_ERROR;
	taskMap->data = NULL;
	taskMap->dataLen = 0;
	taskMap->rspSize = 0;
	taskMap->releaseC2Buf = TRUE;
	taskMap->dataBufHandle = NULL;

	return taskMap;
}
// ===================================================================
//
// Function Name: AUDDRV_VoiceCapture_Init
//
// Description: Initialize voice capture driver internal variables and task queue. 
//
// ====================================================================
Result_t AUDDRV_VoiceCapture_Init( VOCAPTURE_TYPE_t type )
{
	VOCAPTURE_Drv_t	*audDrv = NULL;

	audDrv = GetDriverByType (type);

	if (audDrv == NULL)
		return RESULT_ERROR;

	if (audDrv->isRunning)
		return RESULT_OK;

	memset (audDrv, 0, sizeof(VOCAPTURE_Drv_t));

	audDrv->drvType = type;
	audDrv->stopSema = OSSEMAPHORE_Create(0, OSSUSPEND_PRIORITY);
	audDrv->addBufSema = OSSEMAPHORE_Create(0, OSSUSPEND_PRIORITY);

	switch (audDrv->drvType)
	{
		case VOCAPTURE_TYPE_AMRNB:
		case VOCAPTURE_TYPE_PCM:
			audDrv->msgQueue = OSQUEUE_Create( QUEUESIZE_AUDDRV_VPUCAPTURE,
											sizeof(VOCAPTURE_MSG_t), OSSUSPEND_PRIORITY );
			OSQUEUE_ChangeName(audDrv->msgQueue, (const char *) "AUDDRV_VPUCAPTURE_Q" );

			audDrv->task = OSTASK_Create( (TEntry_t) VPUCapture_TaskEntry,
										TASKNAME_AUDDRV_VPUCAPTURE,
										TASKPRI_AUDDRV_VPUCAPTURE,
										STACKSIZE_AUDDRV_VPUCAPTURE
										);
			break;

		case VOCAPTURE_TYPE_AMRWB:
			audDrv->msgQueue = OSQUEUE_Create( QUEUESIZE_AUDDRV_AMRWBCAPTURE,
											sizeof(VOCAPTURE_MSG_t), OSSUSPEND_PRIORITY );
			OSQUEUE_ChangeName(audDrv->msgQueue, (const char *) "AUDDRV_AMRWBCAPTURE_Q" );

			audDrv->task = OSTASK_Create( (TEntry_t) AMRWBCapture_TaskEntry,
										TASKNAME_AUDDRV_AMRWBCAPTURE,
										TASKPRI_AUDDRV_AMRWBCAPTURE,
										STACKSIZE_AUDDRV_AMRWBCAPTURE
										);
			break;

		default:
			Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_VoiceCapture_Init:: Doesn't support audio driver type drvType = 0x%x\n", audDrv->drvType);
			return RESULT_ERROR;
//			break;
	}
	
	audDrv->isRunning = TRUE;

	Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_VoiceCapture_Init::Exit.\n");

	return RESULT_OK;
}
/**
*  This function will initialize Cam Driver.
*                       To Initialize to default settings, HAL_CAM_Init(NULL);
*                                                       To change default settings use ACTION_CAM_GetCameraSettings to get a copy of default camera settings,
*                                                       Modify default settings in HAL_CAM_Action_settings_st_tand pass back in HAL_CAM_Init(HAL_LCD_config_st* HAL_LCD_config)
*                                                           driver will copy new settings to local and initialize Camera.
*/
HAL_CAM_Result_en_t HAL_CAM_Init(
        CamSensorSelect_t           sensor_select,                      ///< (in) Select Camera Sensor
        HAL_CAM_config_st_t*        config_st                           ///< (out) device configuration structure
        )
{
//    Result_t result = RESULT_OK;
    HAL_CAM_Result_en_t hal_result = HAL_CAM_SUCCESS;

    pr_debug("HAL_CAM_Init \r\n");

#if 0
// Obtain Hal Cam Action Semaphore
    if( sHalCamActionSema == NULL )
    {
        sHalCamActionSema = OSSEMAPHORE_Create( 1, OSSUSPEND_PRIORITY );
        OSSEMAPHORE_ChangeName(sHalCamActionSema, "HalCamAction");
        pr_debug("sHalCamActionSema Created \r\n");
    }
    OSSEMAPHORE_Obtain(sHalCamActionSema,TICKS_FOREVER);

    if (config_st != NULL)
    {
    //  Get Current Camera Default Settings
        CAM_GetCameraSettings(config_st->cam_config_st, CamPowerOff, sensor_select);
    }

//  Initialize Camera Driver and Sensor
    result = CAM_Init(sensor_select);
    switch (result)
    {
        case CAM_UNSUPPORTED:
            hal_result = HAL_CAM_ERROR_ACTION_NOT_SUPPORTED;
            break;
        case CAM_FAILED:
            hal_result = HAL_CAM_ERROR_INTERNAL_ERROR;
            break;
        case RESULT_DONE:
            hal_result = HAL_CAM_SUCCESS;
            break;
        case RESULT_OK:
            hal_result = HAL_CAM_SUCCESS;
            break;
        default:
            hal_result = HAL_CAM_ERROR_ACTION_NOT_SUPPORTED;
            break;
    }

// Release Hal Cam Action Semaphore
    OSSEMAPHORE_Release(sHalCamActionSema);
#endif
    return hal_result;
}
Exemple #4
0
/**
	Initialize the RPC Sync Framework.  
	@param		timeout (in) Number of ticks to wait for emulator initialization
	@return		\n RESULT_OK for success, 
				\n RESULT_ERROR for failure, 
	@note
	This function will block until emulator is initialized or timeout duration has expired.
**/
Result_t RPC_SyncInitialize()
{
	Result_t result = RESULT_OK;

	// reset task map storage
	memset(&sTaskRequestMap, 0, sizeof(sTaskRequestMap));

	// create semaphore to manage access to array of task/req structs
	semaTaskReq = OSSEMAPHORE_Create(1, OSSUSPEND_PRIORITY);
	assert(semaTaskReq);

	return result;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//LaunchAudioHalThread
//	Create Worker thread.
//----------------------------------------------------------------
int LaunchAudioCtrlThread(void)
{
	sgThreadData.m_lock =  SPIN_LOCK_UNLOCKED;
	kfifo_alloc(&sgThreadData.m_pkfifo, KFIFO_SIZE, GFP_KERNEL);
	DEBUG("LaunchAudioCtrlThread KFIFO_SIZE= %d actual =%d\n", KFIFO_SIZE,sgThreadData.m_pkfifo.size);
    kfifo_alloc(&sgThreadData.m_pkfifo_out, KFIFO_SIZE, GFP_KERNEL);
    
	DEBUG("LaunchAudioCtrlThread KFIFO_SIZE= %d actual =%d\n", KFIFO_SIZE,sgThreadData.m_pkfifo_out.size);
	INIT_WORK(&sgThreadData.mwork, AudioCtrlWorkThread);
	
	sgThreadData.pWorkqueue_AudioControl = create_workqueue("AudioCtrlWq");
	if(!sgThreadData.pWorkqueue_AudioControl)
		DEBUG("\n Error : Can not create work queue:AudioCtrlWq\n");

    
    //create a semaphor for blocking
    sgThreadData.action_complete = OSSEMAPHORE_Create(0,0);

	return 0;
}
/*
 *
 * Function Name:  cslDsiOsInit
 *
 * Description:    DSI COntroller OS Interface Init
 *
 */
Boolean cslDsiOsInit(DSI_HANDLE dsiH)
{
	Boolean res = TRUE;

#ifdef UNDER_LINUX
	int ret;
#endif

	/* Update Request Queue */
	dsiH->updReqQ = OSQUEUE_Create(FLUSH_Q_SIZE,
			sizeof(DSI_UPD_REQ_MSG_T),
			OSSUSPEND_PRIORITY);
	if (!dsiH->updReqQ) {
		LCD_DBG(LCD_DBG_ERR_ID, "[CSL DSI] %s: OSQUEUE_Create failed\n",
			__func__);
		res = FALSE;
	} else {
		OSQUEUE_ChangeName(dsiH->updReqQ,
				   dsiH->bus ? "Dsi1Q" : "Dsi0Q");
	}

	/* Update Request Task */
	dsiH->updReqT = OSTASK_Create(dsiH->task,
			dsiH->
			bus ? (TName_t) "Dsi1T" : (TName_t)
			"Dsi0T", TASKPRI_DSI, STACKSIZE_DSI);
	if (!dsiH->updReqT) {
		LCD_DBG(LCD_DBG_ERR_ID, "[CSL DSI] %s: Create Task failure\n",
			__func__);
		res = FALSE;
	}
	/* DSI Interface Semaphore */
	dsiH->semaDsi = OSSEMAPHORE_Create(1, OSSUSPEND_PRIORITY);
	if (!dsiH->semaDsi) {
		LCD_DBG(LCD_DBG_ERR_ID, "[CSL DSI] %s: ERR Sema Creation!\n",
			__func__);
		res = FALSE;
	} else {
		OSSEMAPHORE_ChangeName(dsiH->semaDsi,
				dsiH->bus ? "Dsi1" : "Dsi0");
	}

	/* DSI Interrupt Event Semaphore */
	dsiH->semaInt = OSSEMAPHORE_Create(0, OSSUSPEND_PRIORITY);
	if (!dsiH->semaInt) {
		LCD_DBG(LCD_DBG_ERR_ID, "[CSL DSI] %s: ERR Sema Creation!\n",
			__func__);
		res = FALSE;
	} else {
		OSSEMAPHORE_ChangeName(dsiH->semaInt,
				dsiH->bus ? "Dsi1Int" : "Dsi0Int");
	}

	/* EndOfDma Semaphore */
	dsiH->semaDma = OSSEMAPHORE_Create(0, OSSUSPEND_PRIORITY);
	if (!dsiH->semaDma) {
		LCD_DBG(LCD_DBG_ERR_ID, "[CSL DSI] %s: ERR Sema Creation!\n",
			__func__);
		res = FALSE;
	} else {
		OSSEMAPHORE_ChangeName(dsiH->semaDma,
				dsiH->bus ? "Dsi1Dma" : "Dsi0Dma");
	}

#ifndef __KERNEL__
	/* DSI Controller Interrupt */
	dsiH->iHisr = OSINTERRUPT_Create((IEntry_t)dsiH->hisr,
			dsiH->bus ? (IName_t)"Dsi1" : (IName_t)"Dsi0",
			IPRIORITY_MIDDLE, HISRSTACKSIZE_DSISTAT);
#endif

#ifdef __KERNEL__
	ret = request_irq(dsiH->interruptId, dsiH->lisr, IRQF_DISABLED |
			  IRQF_NO_SUSPEND, "BRCM DSI CSL", NULL);
	if (ret < 0) {
		pr_err("%s(%s:%u)::request_irq failed IRQ %d\n",
		       __func__, __FILE__, __LINE__, dsiH->interruptId);
		goto free_irq;
	}
#else
	IRQ_Register(dsiH->interruptId, dsiH->lisr);
#endif

	return res;

#ifdef __KERNEL__
free_irq:
	free_irq(dsiH->interruptId, NULL);
	return res;
#endif
}
/**
*  This function will perform specific action from defined list, copy of parameters passed thru parm structure.
*
*/
HAL_CAM_Result_en_t HAL_CAM_Ctrl(
        HAL_CAM_Action_en_t action,                 ///< (in) device action
        void*               data,                   ///< (in/out) structure pointer to additional parameters for Set, Get, and IS
        void*               callback                ///< (in) callback function device driver calls once action complete, NULL if not needed
        )
{
    Result_t result = RESULT_OK;
    HAL_CAM_Result_en_t hal_result = HAL_CAM_SUCCESS;
#if 0
    CamIntfConfig_st_t *pSensorIntfConfig;

    pr_debug("HAL_CAM_Ctrl():  action=%d \r\n", action);

// Obtain Hal Cam Action Semaphore
    if( sHalCamActionSema == NULL )
    {
        sHalCamActionSema = OSSEMAPHORE_Create( 1, OSSUSPEND_PRIORITY );
        OSSEMAPHORE_ChangeName(sHalCamActionSema, "HalCamAction");
        pr_debug("sHalCamActionSema Created \r\n");
    }
    OSSEMAPHORE_Obtain(sHalCamActionSema,TICKS_FOREVER);
#endif

    switch (action)
    {
// *** Actions handled by hal camera driver
    // Camera Configuration
#if 0
        case ACTION_CAM_SetPowerMode:                           ///< CamPowerOff/CamPowerOn interface and sensor, use HAL_CAM_Action_power_mode_st_t to set
            result = CAM_SetPowerMode( ((HAL_CAM_Action_power_mode_st_t *)data)->sensor, ((HAL_CAM_Action_power_mode_st_t *)data)->mode );
            break;
        case ACTION_CAM_GetCameraSettings:              ///< Get Interface and Nominal/Min/Max camera settings, use HAL_CAM_Action_settings_st_t to get
            result = CAM_GetCameraSettings(((HAL_CAM_Action_settings_st_t *)data)->cam_config_st, ((HAL_CAM_Action_settings_st_t *)data)->mode, ((HAL_CAM_Action_settings_st_t *)data)->sensor);
            break;
        case ACTION_CAM_GetCameraInterface:             ///< Get I2C and Camera Controller interface settings, use HAL_CAM_Action_cam_interface_st_t to get
            pSensorIntfConfig = CAM_GetCameraInterface( ((HAL_CAM_Action_cam_interface_st_t *)data)->sensor );
            ((HAL_CAM_Action_cam_interface_st_t *)data)->i2c_dev_id = pSensorIntfConfig->sensor_config_i2c->i2c_device_id;
            ((HAL_CAM_Action_cam_interface_st_t *)data)->i2c_max_page = pSensorIntfConfig->sensor_config_i2c->i2c_max_page;
            ((HAL_CAM_Action_cam_interface_st_t *)data)->i2c_sub_addr_op = pSensorIntfConfig->sensor_config_i2c->i2c_sub_adr_op;
//            ((HAL_CAM_Action_cam_interface_st_t *)data)->controller_config = CAM_CNTRL_GetConfig();
            break;
    // Image Capture Modes
        case ACTION_CAM_CaptureImage:                           ///< Capture camera image, use HAL_CAM_Action_capture_image_st_t to enable
            result = CAM_CaptureImage( ((HAL_CAM_Action_capture_image_st_t *)data)->size, ((HAL_CAM_Action_capture_image_st_t *)data)->format,
                                                        ((HAL_CAM_Action_capture_image_st_t *)data)->sensor, ((HAL_CAM_Action_capture_image_st_t *)data)->buf, callback );
            break;
        case ACTION_CAM_CaptureVideo:                           ///< Start camera video capture, use HAL_CAM_Action_capture_video_st_t to enable
            result = CAM_CaptureVideo( ((HAL_CAM_Action_capture_video_st_t *)data)->size, ((HAL_CAM_Action_capture_video_st_t *)data)->format,
                                                        ((HAL_CAM_Action_capture_video_st_t *)data)->sensor, ((HAL_CAM_Action_capture_video_st_t *)data)->buf0,
                                                        ((HAL_CAM_Action_capture_video_st_t *)data)->buf1, callback );
            break;
        case ACTION_CAM_PreviewPPzoom:                          ///< Start camera preview/video capture, use HAL_CAM_Action_preview_PPzoom_st_t to enable
            result = CAM_PreviewPPzoom( ((HAL_CAM_Action_preview_PPzoom_st_t *)data)->window_scale,
                                        ((HAL_CAM_Action_preview_PPzoom_st_t *)data)->format, ((HAL_CAM_Action_preview_PPzoom_st_t *)data)->sensor,
                                        ((HAL_CAM_Action_preview_PPzoom_st_t *)data)->flash_mode, ((HAL_CAM_Action_preview_PPzoom_st_t *)data)->mode,
                                        ((HAL_CAM_Action_preview_PPzoom_st_t *)data)->buf0, ((HAL_CAM_Action_preview_PPzoom_st_t *)data)->buf1, callback );
            break;
        case ACTION_CAM_StillsPPzoom:                          ///< Start camera preview/video capture, use HAL_CAM_Action_preview_PPzoom_st_t to enable
            result = CAM_StillsPPzoom( ((HAL_CAM_Action_stills_PPzoom_st_t *)data)->window_scale, ((HAL_CAM_Action_stills_PPzoom_st_t *)data)->format,
                                        ((HAL_CAM_Action_stills_PPzoom_st_t *)data)->sensor, ((HAL_CAM_Action_stills_PPzoom_st_t *)data)->flash_mode,
                                        ((HAL_CAM_Action_stills_PPzoom_st_t *)data)->buf, callback );
            break;
        case ACTION_CAM_CapImageWithThumbNail:                  ///< Capture camera image with thumbnail, use HAL_CAM_Action_capture_image_with_thumbnail_st_t to enable
            result = CAM_CapImageWithThumbNail( ((HAL_CAM_Action_capture_image_with_thumbnail_st_t *)data)->size, ((HAL_CAM_Action_capture_image_with_thumbnail_st_t *)data)->format,
                                        ((HAL_CAM_Action_capture_image_with_thumbnail_st_t *)data)->sensor, ((HAL_CAM_Action_capture_image_with_thumbnail_st_t *)data)->buf,
                                        ((HAL_CAM_Action_capture_image_with_thumbnail_st_t *)data)->thumbnail_width, ((HAL_CAM_Action_capture_image_with_thumbnail_st_t *)data)->thumbnail_height,
                                        ((HAL_CAM_Action_capture_image_with_thumbnail_st_t *)data)->thumbnail_format,
                                        ((HAL_CAM_Action_capture_image_with_thumbnail_st_t *)data)->thumbnail_buf, callback );
            break;
        case ACTION_CAM_CapVideoWithViewFinder:                 ///< Start camera video capture with viewfinder, use HAL_CAM_Action_capture_video_with_viewfinder_st_t to enable
            result = CAM_CapVideoWithViewfinder( ((HAL_CAM_Action_capture_video_with_viewfinder_st_t *)data)->size, ((HAL_CAM_Action_capture_video_with_viewfinder_st_t *)data)->format,
                                        ((HAL_CAM_Action_capture_video_with_viewfinder_st_t *)data)->sensor, ((HAL_CAM_Action_capture_video_with_viewfinder_st_t *)data)->buf0,
                                        ((HAL_CAM_Action_capture_video_with_viewfinder_st_t *)data)->buf1,((HAL_CAM_Action_capture_video_with_viewfinder_st_t *)data)->viewfinder_size,
                                        ((HAL_CAM_Action_capture_video_with_viewfinder_st_t *)data)->viewfinder_format, ((HAL_CAM_Action_capture_video_with_viewfinder_st_t *)data)->viewfinder_buf0,
                                        ((HAL_CAM_Action_capture_video_with_viewfinder_st_t *)data)->viewfinder_buf1, callback );
            break;
        case ACTION_CAM_StopCapture:                    ///< Stop video or image capture, no additional parameters
            result = CAM_StopCapture();
            break;
		case ACTION_CAM_PauseCapture:					///< Pause viewfinder, video capture, no additional parameters
			result = CAM_PauseCapture();
			break;

		case ACTION_CAM_ResumeCapture:					///< Resume viewfinder, video capture, no additional parameters
			result = CAM_ResumeCapture();
			break;

    // Operation Control Settings
        case ACTION_CAM_SetWindowScale:             ///< Set the Camera window size and scale factors, use HAL_CAM_Action_window_scale_st_t to set
            result = CAM_SetWindowScale( (CamImageSize_t)((HAL_CAM_Action_window_scale_st_t *)data)->size,
                                                        (UInt32)((HAL_CAM_Action_window_scale_st_t *)data)->start_pixel, (UInt32)((HAL_CAM_Action_window_scale_st_t *)data)->end_pixel,
                                                        (UInt32)((HAL_CAM_Action_window_scale_st_t *)data)->start_line, (UInt32)((HAL_CAM_Action_window_scale_st_t *)data)->end_line,
                                                        (UInt32)((HAL_CAM_Action_window_scale_st_t *)data)->horizontal_SDF, (UInt32)((HAL_CAM_Action_window_scale_st_t *)data)->vertical_SDF );
            break;
        case ACTION_CAM_SetZoom:                                    ///< Set required zoom, use (UInt16) HAL_CAM_Action_param_st_t to set
            result = CAM_SetZoom( (UInt16)(((HAL_CAM_Action_param_st_t *)data)->param) );
            break;
        case ACTION_CAM_GetMaxWindowSize:                   ///< Camera Maximum Pixel Window size, use HAL_CAM_Action_window_st_t to get
            pSensorIntfConfig = CAM_GetCameraInterface( ((HAL_CAM_Action_window_st_t *)data)->sensor );
                                ((HAL_CAM_Action_window_st_t *)data)->width = pSensorIntfConfig->sensor_config_caps->output_st.max_width;
                                ((HAL_CAM_Action_window_st_t *)data)->height = pSensorIntfConfig->sensor_config_caps->output_st.max_height;
            break;
        case ACTION_CAM_GetMaxZoom:                             ///< Get maximum zoom allowed, use (UInt16) HAL_CAM_Action_param_st_t to get
#if defined(SS_2153) && defined(BROOKLYN_HW)
            ((HAL_CAM_Action_param_st_t *)data)->param = (UInt16)CAM_GetMaxZoom();
#else
            ((HAL_CAM_Action_param_st_t *)data)->param = (UInt16)CAM_GetMaxZoom(((HAL_CAM_Action_param_st_t *)data)->sensor);
#endif
            break;

    // Flash Settings
        case ACTION_CAM_SetFlashEnable:                     ///< Set flash enable TRUE/FALSE, use (Boolean) HAL_CAM_Action_param_st_t to set
            result = CAM_SetFlashEnable(*((Boolean*)((HAL_CAM_Action_param_st_t *)data)->param) );
            break;
    // Register Callback
		case	ACTION_CAM_SetESD_CB:						///< ESD callback setting
			result = CAM_SetEsdCb((((HAL_CAM_Action_param_st_t *)data)->param), ((HAL_CAM_Action_param_st_t *)data)->sensor );
			break;
#endif

    // Resolution not handled by all camera device drivers
#if 0
        case ACTION_CAM_GetSensorResolution:            ///< Get matching image size from passed pixel width and height, use HAL_CAM_Action_image_size_st_t to get CamImageSize_t
            result  = CAMDRV_GetResolution(((HAL_CAM_Action_resolution_st_t *)data)->size,
                                                    ((HAL_CAM_Action_resolution_st_t *)data)->mode,
                                                    ((HAL_CAM_Action_resolution_st_t *)data)->sensor,
                                                    ((HAL_CAM_Action_resolution_st_t *)data)->sensor_size);
            break;
#endif

// *** Actions for Camera Sensor Driver Only ***  (No baseband control, handled by camera device driver)
// Default: CAMDRV_xxx() Functions
// *********************************************************************************************************
// *********************************************************************************************************

// *** All other Customer Defined Actions:  Handled by camera device driver only
        default:
            pr_debug("HAL_CAM_Ctrl(): HAL_CAMDRV_Ctrl(): \r\n");
            result = CAMDRV_ActionCtrl(action, data, callback);
            if (result != RESULT_OK)
            {
                pr_debug("HAL_CAM_Ctrl(): HAL_CAMDRV_Ctrl(): ERROR: Invalid Action=%d \r\n", action);
            }
            break;
    }
    switch (result)
    {
        case CAM_UNSUPPORTED:
            hal_result = HAL_CAM_ERROR_ACTION_NOT_SUPPORTED;
            break;
        case CAM_FAILED:
            hal_result = HAL_CAM_ERROR_INTERNAL_ERROR;
            break;
        case RESULT_DONE:
            hal_result = HAL_CAM_SUCCESS;
            break;
        case RESULT_OK:
            hal_result = HAL_CAM_SUCCESS;
            break;
        default:
            hal_result = HAL_CAM_ERROR_ACTION_NOT_SUPPORTED;
            break;
    }

#if 0
// Release Hal Cam Action Semaphore
    OSSEMAPHORE_Release(sHalCamActionSema);

#endif
    return hal_result;
}
//===========================================================
//
// Function Name: AUDDRV_VoiceRender_Init
//
//	Description: Initialize voice render driver, init internal variables and task queue.
// 
//==================================================================
Result_t AUDDRV_VoiceRender_Init( VORENDER_TYPE_t type )
{
	VORENDER_Drv_t	*audDrv = NULL;

	audDrv = GetDriverByType (type);

	if (audDrv == NULL)
		return RESULT_ERROR;

	if (audDrv->isRunning)
		return RESULT_OK;

	memset (audDrv, 0, sizeof(VORENDER_Drv_t));

	audDrv->drvType = type;
	audDrv->stopSema = OSSEMAPHORE_Create(0, OSSUSPEND_PRIORITY);
	audDrv->addBufSema = OSSEMAPHORE_Create(0, OSSUSPEND_PRIORITY);
	audDrv->stopDspAmrWbSema = OSSEMAPHORE_Create(0, OSSUSPEND_PRIORITY);

	switch (audDrv->drvType)
	{
		case VORENDER_TYPE_AMRNB:
		case VORENDER_TYPE_PCM_VPU:
			audDrv->msgQueue = OSQUEUE_Create( QUEUESIZE_AUDDRV_VPURENDER,
											sizeof(VORENDER_MSG_t), OSSUSPEND_PRIORITY );
			OSQUEUE_ChangeName(audDrv->msgQueue, (const char *) "AUDDRV_VPURENDER_Q" );

			audDrv->task = OSTASK_Create( (TEntry_t) VPU_Render_TaskEntry,
										TASKNAME_AUDDRV_VPURENDER,
										TASKPRI_AUDDRV_VPURENDER,
										STACKSIZE_AUDDRV_VPURENDER
										);
			break;

		case VORENDER_TYPE_PCM_ARM2SP:
		case VORENDER_TYPE_PCM_ARM2SP2:	
			audDrv->msgQueue = OSQUEUE_Create( QUEUESIZE_AUDDRV_ARM2SPRENDER,
											sizeof(VORENDER_MSG_t), OSSUSPEND_PRIORITY );
			OSQUEUE_ChangeName(audDrv->msgQueue, (const char *) "AUDDRV_ARM2SPRENDER_Q" );

			audDrv->task = OSTASK_CreateWArg( (TEntryWArg_t) ARM2SP_Render_TaskEntry,
										TASKNAME_AUDDRV_ARM2SPRENDER,
										TASKPRI_AUDDRV_ARM2SPRENDER,
										STACKSIZE_AUDDRV_ARM2SPRENDER,
										(TArgc_t)audDrv,
										(TArgv_t)NULL										
										);
			break;

		case VORENDER_TYPE_AMRWB:
			audDrv->msgQueue = OSQUEUE_Create( QUEUESIZE_AUDDRV_AMRWBRENDER,
											sizeof(VORENDER_MSG_t), OSSUSPEND_PRIORITY );
			OSQUEUE_ChangeName(audDrv->msgQueue, (const char *) "AUDDRV_AMRWBRENDER_Q" );

			audDrv->task = OSTASK_Create( (TEntry_t) AMRWB_Render_TaskEntry,
										TASKNAME_AUDDRV_AMRWBRENDER,
										TASKPRI_AUDDRV_AMRWBRENDER,
										STACKSIZE_AUDDRV_AMRWBRENDER
										);
			break;

		default:
			Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_VoiceRender_Init:: Doesn't support audio driver type drvType = 0x%x\n", audDrv->drvType);
			return RESULT_ERROR;
//			break;
	}
	
	audDrv->isRunning = TRUE;

	Log_DebugPrintf(LOGID_AUDIO, "AUDDRV_VoiceRender_Init::Exit.\n");

	return RESULT_OK;
}