// ===================================================================
//
// 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;
}
Example #2
0
//******************************************************************************
// Function Name:	CP_Audio_ISR_Handler
//
// Description:		This function is called by  high level RIP interrupt service routine
//					to handles Audio status queue 
//******************************************************************************
void CP_Audio_ISR_Handler(StatQ_t status_msg)
{
	ISRCMD_t status;

	if(!qAudioMsg && !taskAudioIsr)
	{
		IPC_AudioControlSend((char *)&status_msg, sizeof(status_msg));

		if(!qAudioMsg)
			qAudioMsg = OSQUEUE_Create( QUEUESIZE_CP_ISRMSG,
							sizeof(ISRCMD_t), OSSUSPEND_PRIORITY);
		
		if(!taskAudioIsr)
			taskAudioIsr = 	OSTASK_Create( CP_Audio_ISR_TaskEntry, 
					TASKNAME_CP_Audio_ISR,
					TASKPRI_CP_Audio_ISR,
					STACKSIZE_CP_Audio_ISR
					);
	}
	else
	{
		status.type = TYPE_SEND_IPC_AUDIO_CTRL;
		status.payload = status_msg;
		OSQUEUE_Post(qAudioMsg, (QMsg_t *)&status, TICKS_FOREVER);	
	}

}
void SysUsbRpc_Init(void)
{
    if(!SysUsbRpc_Queue  )
    {
        SysUsbRpc_Queue  = OSQUEUE_Create(QUEUESIZE_USBIPC, sizeof(InterTaskMsg_t *), OSSUSPEND_FIFO);
        OSQUEUE_ChangeName(SysUsbRpc_Queue  , "USBIPC_Q");
        (void)OSTASK_Create(SysUsbRpc_Entry, TASKNAME_USBIPC, TASKPRI_USBIPC, STACKSIZE_USBIPC);
    }
    return;
}
Example #4
0
void EEM_Init(void)
{
    RPC_Result_t result;

    result = RPC_PACKET_RegisterDataInd (0,INTERFACE_USB_EEM, EEM_DataIndCb, EEM_FlowControlCb);
    Log_DebugPrintf(LOGID_SYSEEMRPC, "AP EEM_Init result:%d", result);    
	
	eem_data_Queue = OSQUEUE_Create(QUEUESIZE_EEM, sizeof(EEM_QueueEntry_t), OSSUSPEND_PRIORITY);
	OSQUEUE_ChangeName (eem_data_Queue, "EEMQ");
	OSTASK_Create( eemDataTask_Entry, (TName_t)"EEMT", NORMAL, STACKSIZE_MSC*2);

}
/*
 *
 * 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
}
//===========================================================
//
// 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;
}