static void SysUsbRpc_Entry(void)
{
    InterTaskMsg_t *msg;

    sys_usb_init();

    do 
    {
		OSStatus_t status;

        status = OSQUEUE_Pend(SysUsbRpc_Queue , (QMsg_t *) &msg, TICKS_FOREVER);

		if (status != OSSTATUS_SUCCESS)
		{
			Log_DebugPrintf(LOGID_USB, "SysUsbRpc_Entry: OSQUEUE_Pend() fail!\n");
			continue;
		}


        if (msg != NULL)
        {
            SysUsbRpc_GenReq(msg);
        }
    } while (TRUE);
}
/*
 *
 * Function Name:  cslDsi1UpdateTask
 *
 * Description:    DSI Controller 0 Update Task
 *
 */
static void cslDsi1UpdateTask(void)
{
	DSI_UPD_REQ_MSG_T updMsg;
	OSStatus_t osStat;
	CSL_LCD_RES_T res;
	DSI_HANDLE dsiH = &dsiBus[1];

	for (;;) {
		res = CSL_LCD_OK;

		/* Wait for update request */
		OSQUEUE_Pend(dsiH->updReqQ, (QMsg_t *)&updMsg, TICKS_FOREVER);

		/* Wait For signal from eof DMA */
		osStat = OSSEMAPHORE_Obtain(dsiH->semaDma,
					    TICKS_IN_MILLISECONDS(updMsg.updReq.
								  timeOut_ms));

		if (osStat != OSSTATUS_SUCCESS) {
			if (osStat == OSSTATUS_TIMEOUT) {
				LCD_DBG(LCD_DBG_ERR_ID, "[CSL DSI] %s: "
					"TIMED OUT While waiting for "
					"EOF DMA\n", __func__);
				res = CSL_LCD_OS_TOUT;
			} else {
				LCD_DBG(LCD_DBG_ERR_ID, "[CSL DSI] %s: "
					"OS ERR While waiting for EOF DMA\n",
					__func__);
				res = CSL_LCD_OS_ERR;
			}

			cslDsiDmaStop(&updMsg);
		}

		if (res == CSL_LCD_OK)
			res = cslDsiWaitForInt(dsiH, 100);
		else
			cslDsiWaitForInt(dsiH, 1);

		chal_dsi_de1_enable(dsiH->chalH, FALSE);
		chal_dsi_tx_start(dsiH->chalH, TX_PKT_ENG_1, FALSE);
		chal_dsi_tx_start(dsiH->chalH, TX_PKT_ENG_2, FALSE);

		if (!updMsg.clientH->hasLock)
			OSSEMAPHORE_Release(dsiH->semaDsi);

		if (updMsg.updReq.cslLcdCb) {
			updMsg.updReq.cslLcdCb(res, &updMsg.updReq.cslLcdCbRec);
		} else {
			LCD_DBG(LCD_DBG_ERR_ID, "[CSL DSI] %s: "
				"Callback EQ NULL, Skipping\n", __func__);
		}
	}
}
Exemple #3
0
static void eemDataTask_Entry( void )
{
   OSStatus_t			qStatus;
   EEM_QueueEntry_t	Msg;

	while( TRUE )
	{
		qStatus = OSQUEUE_Pend(eem_data_Queue, (QMsg_t *)&Msg, TICKS_FOREVER);

		if(qStatus == OSSTATUS_SUCCESS)
		{
			Log_DebugPrintf(LOGID_SYSEEMRPC, "EEM_DataIndCb: DISPATCH pkt:0x%x ", Msg.data);   
			eemDispatchPacket(Msg.data, Msg.id);
		}
	}
}
Exemple #4
0
//******************************************************************************
// Function Name:	CP_Audio_ISR_TaskEntry
//
// Description:		This is the task entry to process both audio and VPU related status 
//******************************************************************************
static void CP_Audio_ISR_TaskEntry( void ) 
{

	ISRCMD_t cmd;

	while(1)
	{
		OSQUEUE_Pend(qAudioMsg, (QMsg_t *)&cmd, TICKS_FOREVER );
		if (cmd.type == TYPE_SEND_IPC_AUDIO_CTRL)
		{
			StatQ_t msg;

			msg = cmd.payload;
			Log_DebugPrintf(LOGID_AUDIO, "CP_Audio_ISR_TaskEntry (AUDIO Type): 0x%x  : 0x%x : 0x%x :0x%x \r\n",msg.status,msg.arg0,msg.arg1,msg.arg2);
			IPC_AudioControlSend((char *)&msg, sizeof(StatQ_t));
		}
		else
			Log_DebugPrintf(LOGID_AUDIO, "CP_Audio_ISR_TaskEntry invalid status type \r\n");

	}

}
//==============================================================================================
// Function Name: AMRWB_Render_TaskEntry
//
//	Description: The main task entry of voice render when using DSP AMRWB decoder
//==============================================================
static void AMRWB_Render_TaskEntry ()
{
	VORENDER_MSG_t	msg;

	OSStatus_t		status;

	VORENDER_Drv_t	*audDrv = &sAMRWB_Drv;
	

	Log_DebugPrintf(LOGID_AUDIO, "AMRWBRender_TaskEntry: AMRWBRender_TaskEntry is running \r\n");

	while(TRUE)
	{
		status = OSQUEUE_Pend( audDrv->msgQueue, (QMsg_t *)&msg, TICKS_FOREVER );
		if (status == OSSTATUS_SUCCESS)
		{
			Log_DebugPrintf(LOGID_AUDIO, " AMRWBRender_TaskEntry::msgID = 0x%x.\n", msg.msgID);

			switch (msg.msgID)
			{
				case VORENDER_MSG_SET_TRANSFER:
					 audDrv->callbackThreshold = (UInt32)msg.parm1;
					 audDrv->interruptInterval = (UInt32)msg.parm2;
					 break;
				
				case VORENDER_MSG_CONFIG:
					ConfigAudDrv (audDrv, (VORENDER_Configure_t *)msg.parm1);
					break;

				case VORENDER_MSG_REGISTER_BUFDONE_CB:
					audDrv->bufDoneCb = (AUDDRV_VoiceRender_BufDoneCB_t)msg.parm1;
					break;

				case VORENDER_MSG_START:
					Log_DebugPrintf(LOGID_AUDIO, " AMRWBRender_TaskEntry::Start render\n");
					// Need to reset them, otherwise will use the values from the last play.
					arm_writeIndex = 0;
					dsp_readIndex = 0;
					dspif_AMRWB_play_start ( audDrv->config.playbackMode,
												audDrv->config.mixMode,
												audDrv->config.samplingRate,
												audDrv->config.speechMode, // used by AMRNB and AMRWB
												audDrv->config.dataRateSelection, // used by AMRNB and AMRWB
												audDrv->numFramesPerInterrupt);
					// need to reset sema after start dsp. dsp can send duplicate msgs to us.
					OSSEMAPHORE_ResetCnt(audDrv->stopDspAmrWbSema);
					break;

				case VORENDER_MSG_FINISH:
					audDrv->isFinishing = TRUE;
					break;

				case VORENDER_MSG_STOP:
					Log_DebugPrintf(LOGID_AUDIO, " AMRWBRender_TaskEntry::Stop render.\n");
					dspif_AMRWB_play_init_stop();
					//make sure dsp is stopped
					OSSEMAPHORE_Obtain (audDrv->stopDspAmrWbSema, TICKS_FOREVER);
					dspif_AMRWB_play_stop();
					CheckBufDoneUponStop(audDrv);
					Log_DebugPrintf(LOGID_AUDIO, " AMRWBRender_TaskEntry::Stop render - done.\n");
					OSSEMAPHORE_Release (audDrv->stopSema);
					break;

				case VORENDER_MSG_PAUSE:
					break;

				case VORENDER_MSG_RESUME:
					break;

				case VORENDER_MSG_ADD_BUFFER:
					CopyBufferToQueue (audDrv, (UInt8 *)msg.parm1, msg.parm2);
					OSSEMAPHORE_Release (audDrv->addBufSema);
					break;

				case VORENDER_MSG_FLUSH_BUFFER:
					Log_DebugPrintf(LOGID_AUDIO, "AMRWBRender_TaskEntry:: Flushed queue.\n");
					// flush the data in the Q
					AUDQUE_Flush(audDrv->audQueue);
					// Need to reset them, otherwise will use the values from the last play.
					arm_writeIndex = 0;
					dsp_readIndex = 0;
					// this will make dsp to flush data inside dsp
					dspif_AMRWB_play_start ( audDrv->config.playbackMode,
												audDrv->config.mixMode,
												audDrv->config.samplingRate,
												audDrv->config.speechMode, // used by AMRNB and AMRWB
												audDrv->config.dataRateSelection, // used by AMRNB and AMRWB
												audDrv->numFramesPerInterrupt);
					// need to reset sema after start dsp. dsp can send duplicate msgs to us.
					OSSEMAPHORE_ResetCnt(audDrv->stopDspAmrWbSema);
					break;

				case VORENDER_MSG_SHM_REQUEST:
					ProcessSharedMemRequest (audDrv, (UInt16)msg.parm1, (UInt16)msg.parm2);
					break;

				default:
					Log_DebugPrintf(LOGID_AUDIO, "AMRWBRender_TaskEntry: Unsupported msg, msgID = 0x%x \r\n", msg.msgID);
					break;
			}
		}
	}
}
//==============================================================================================
// Function Name: ARM2SP_Render_TaskEntry
//
//	Description: The main task entry of voice render when using DSP ARM2SP
//==============================================================
static void ARM2SP_Render_TaskEntry (void* arg)
{
	VORENDER_MSG_t	msg;

	OSStatus_t		status;

	VORENDER_Drv_t	*audDrv = (VORENDER_Drv_t*)arg;
	
	/* ARM2SP commands
	Start:    cmd(arg0, arg1=0)
	Pause:    cmd(arg0=0, arg1=1)    //ptr not reset
	Resume w/o fast forward:    cmd(arg0, arg1=1)    //prt continue
	Resumd w/ fast forward:    cmd(arg0, arg1=0) + arm flush left-over data    //same as new play
	*/


	Log_DebugPrintf(LOGID_AUDIO, "ARM2SP_Render_TaskEntry: ARM2SP_Render_TaskEntry is running \r\n");

	while(TRUE)
	{
		status = OSQUEUE_Pend( audDrv->msgQueue, (QMsg_t *)&msg, TICKS_FOREVER );
		if (status == OSSTATUS_SUCCESS)
		{
			Log_DebugPrintf(LOGID_AUDIO, " ARM2SP_Render_TaskEntry::msgID = 0x%x. parm1 = 0x%x, parm2 = 0x%x\n", 
											msg.msgID, msg.parm1, msg.parm2);
			switch (msg.msgID)
			{
				case VORENDER_MSG_SET_TRANSFER:
					 audDrv->callbackThreshold = (UInt32)msg.parm1;
					 audDrv->interruptInterval = (UInt32)msg.parm2;
					 break;

				case VORENDER_MSG_CONFIG:
					ConfigAudDrv (audDrv, (VORENDER_Configure_t *)msg.parm1);
					break;

				case VORENDER_MSG_REGISTER_BUFDONE_CB:
					audDrv->bufDoneCb = (AUDDRV_VoiceRender_BufDoneCB_t)msg.parm1;
					break;

				case VORENDER_MSG_START:
					dspif_ARM2SP_play_start ( AUDDRV_ARM2SP_GetInstanceID(audDrv->drvType),
												audDrv->config.playbackMode,
												audDrv->config.mixMode,
												audDrv->config.samplingRate,
												audDrv->numFramesPerInterrupt);
					break;

				case VORENDER_MSG_FINISH:
					audDrv->isFinishing = TRUE;
					break;

				case VORENDER_MSG_STOP:
					Log_DebugPrintf(LOGID_AUDIO, " ARM2SP_Render_TaskEntry::Stop render.\n");
					dspif_ARM2SP_play_stop(AUDDRV_ARM2SP_GetInstanceID(audDrv->drvType));
					CheckBufDoneUponStop(audDrv);
					OSSEMAPHORE_Release (audDrv->stopSema);
					break;

				case VORENDER_MSG_PAUSE:
					Log_DebugPrintf(LOGID_AUDIO, " ARM2SP_Render_TaskEntry::Pause render.\n");
					dspif_ARM2SP_play_pause(AUDDRV_ARM2SP_GetInstanceID(audDrv->drvType));
					break;

				case VORENDER_MSG_RESUME:
					dspif_ARM2SP_play_resume( AUDDRV_ARM2SP_GetInstanceID(audDrv->drvType),
												audDrv->config.playbackMode,
												audDrv->config.mixMode,
												audDrv->config.samplingRate,
												audDrv->numFramesPerInterrupt);
					break;

				case VORENDER_MSG_ADD_BUFFER:
					CopyBufferToQueue (audDrv, (UInt8 *)msg.parm1, msg.parm2);
					OSSEMAPHORE_Release (audDrv->addBufSema);
					break;

				case VORENDER_MSG_FLUSH_BUFFER:
					AUDQUE_Flush(audDrv->audQueue);
					dspif_ARM2SP_play_flush(AUDDRV_ARM2SP_GetInstanceID(audDrv->drvType));
					Log_DebugPrintf(LOGID_AUDIO, "ARM2SP_Render_TaskEntry:: Flushed queue.\n");
					break;
				
				case VORENDER_MSG_SHM_REQUEST:
					Log_DebugPrintf(LOGID_AUDIO, "AUDDRV ARM2SP VORENDER_MSG_SHM_REQUEST\n");
					
					ProcessSharedMemRequest (audDrv, (UInt16)msg.parm1, (UInt16)msg.parm2);
					break;

				default:
					Log_DebugPrintf(LOGID_AUDIO, "ARM2SP_Render_TaskEntry: Unsupported msg, msgID = 0x%x \r\n", msg.msgID);
					break;
			}
		}
	}
}
//==============================================================================================
// Function Name: VPU_Render_TaskEntry
//
//	Description: The main task entry of voice render when using DSP VPU
//==============================================================
static void VPU_Render_TaskEntry (void)
{
	VORENDER_MSG_t	msg;

	OSStatus_t		status;

	VORENDER_Drv_t	*audDrv = &sVPU_Drv;
	

	Log_DebugPrintf(LOGID_AUDIO, "VPU_Render_TaskEntry: VPU_Render_TaskEntry is running \r\n");

	while(TRUE)
	{
		status = OSQUEUE_Pend( audDrv->msgQueue, (QMsg_t *)&msg, TICKS_FOREVER );
		if (status == OSSTATUS_SUCCESS)
		{
			Log_DebugPrintf(LOGID_AUDIO, " VPU_Render_TaskEntry::msgID = 0x%x. parm1 = 0x%x, parm2 = 0x%x\n", 
											msg.msgID, msg.parm1, msg.parm2);

			switch (msg.msgID)
			{
				case VORENDER_MSG_SET_TRANSFER:
					 audDrv->callbackThreshold = (UInt32)msg.parm1;
					 audDrv->interruptInterval = (UInt32)msg.parm2;
					 break;
					 
				case VORENDER_MSG_CONFIG:
					ConfigAudDrv (audDrv, (VORENDER_Configure_t *)msg.parm1);
					break;

				case VORENDER_MSG_REGISTER_BUFDONE_CB:
					audDrv->bufDoneCb = (AUDDRV_VoiceRender_BufDoneCB_t)msg.parm1;
					break;

				case VORENDER_MSG_START:
					{
						dspif_VPU_play_start ( audDrv->config.playbackMode,
												audDrv->config.mixMode,
												audDrv->config.samplingRate,
												audDrv->config.speechMode, // used by AMRNB and AMRWB
												audDrv->config.dataRateSelection, // used by AMRNB and AMRWB
												audDrv->numFramesPerInterrupt);

						Log_DebugPrintf(LOGID_AUDIO, " VPU_Render_TaskEntry::Start render, playbackMode = 0x%x,  speechMode = 0x%x, dataRate = 0x%x, mixMode = 0x%x\n", 
							audDrv->config.playbackMode, audDrv->config.speechMode, audDrv->config.dataRateSelection, audDrv->config.mixMode);
					}
				
					break;

				case VORENDER_MSG_FINISH:
					audDrv->isFinishing = TRUE;
					break;

				case VORENDER_MSG_STOP:
					// stop or cancel, to be consisdered.
					dspif_VPU_play_stop();
					CheckBufDoneUponStop(audDrv);
					Log_DebugPrintf(LOGID_AUDIO, " VPU_Render_TaskEntry::Stop render.\n");
					OSSEMAPHORE_Release (audDrv->stopSema);
					break;

				case VORENDER_MSG_PAUSE:
					break;

				case VORENDER_MSG_RESUME:
					break;

				case VORENDER_MSG_ADD_BUFFER:
					CopyBufferToQueue (audDrv, (UInt8 *)msg.parm1, msg.parm2);
					OSSEMAPHORE_Release (audDrv->addBufSema);
					break;

				case VORENDER_MSG_FLUSH_BUFFER:
					AUDQUE_Flush(audDrv->audQueue);
					Log_DebugPrintf(LOGID_AUDIO, "VPU_Render_TaskEntry:: Flushed queue.\n");
					break;

				case VORENDER_MSG_SHM_REQUEST:
					ProcessSharedMemRequest (audDrv, (UInt16)msg.parm1, (UInt16)msg.parm2);
					break;

				default:
					Log_DebugPrintf(LOGID_AUDIO, "VPU_Render_TaskEntry: Unsupported msg, msgID = 0x%x \r\n", msg.msgID);
					break;
			}
		}
	}
}
// ===================================================================
//
// Function Name: AMRWBCapture_TaskEntry
//
// Description: The main task entry of the voice capture driver when using DSP ARMWB.
//
// ====================================================================
static void AMRWBCapture_TaskEntry (void)
{
	VOCAPTURE_MSG_t	msg;

	OSStatus_t		status;

	VOCAPTURE_Drv_t	*audDrv = &sAMRWB_Drv;
	

	Log_DebugPrintf(LOGID_AUDIO, "AMRWBCapture_TaskEntry: AMRWBCapture_TaskEntry is running \r\n");

	while(TRUE)
	{
		status = OSQUEUE_Pend( audDrv->msgQueue, (QMsg_t *)&msg, TICKS_FOREVER );
		if (status == OSSTATUS_SUCCESS)
		{
			Log_DebugPrintf(LOGID_AUDIO, " : AMRWBCapture_TaskEntry::msgID = 0x%x.\n", msg.msgID);

			switch (msg.msgID)
			{
				case VOCAPTURE_MSG_SET_TRANSFER:
					 audDrv->callbackThreshold = (UInt32)msg.parm1;
					 audDrv->interruptInterval = (UInt32)msg.parm2;
					 break;

				case VOCAPTURE_MSG_CONFIG:
					ConfigAudDrv (audDrv, (VOCAPTURE_Configure_t *)msg.parm1);
					break;

				case VOCAPTURE_MSG_REGISTER_BUFDONE_CB:
					audDrv->bufDoneCb = (AUDDRV_VoiceCapture_BufDoneCB_t)msg.parm1;
					break;

				case VOCAPTURE_MSG_START:	
					Log_DebugPrintf(LOGID_AUDIO, " : AMRWBCapture_TaskEntry::Start capture.\n");
					dspif_AMRWB_record_start ( audDrv->config.recordMode,
								audDrv->config.samplingRate,
								audDrv->config.speechMode, // used by AMRNB and AMRWB
								audDrv->config.dataRate, // used by AMRNB and AMRWB
								audDrv->config.procEnable,
								audDrv->config.dtxEnable,
								audDrv->numFramesPerInterrupt);
					break;

				case VOCAPTURE_MSG_STOP:
					//which cmd to stop the recording, besides the disable audio cmd (done when disable path)?
					Log_DebugPrintf(LOGID_AUDIO, " : AMRWBCapture_TaskEntry::Stop capture.\n");
					dspif_AMRWB_record_stop();
					CheckBufDoneUponStop(audDrv);
					OSSEMAPHORE_Release (audDrv->stopSema);
					break;

				case VOCAPTURE_MSG_PAUSE:
					break;

				case VOCAPTURE_MSG_RESUME:
					break;

				case VOCAPTURE_MSG_ADD_BUFFER:
					CopyBufferFromQueue (audDrv, (UInt8 *)msg.parm1, msg.parm2);
					OSSEMAPHORE_Release (audDrv->addBufSema);
					break;

				case VOCAPTURE_MSG_SHM_REQUEST:
					ProcessSharedMemRequest (audDrv, (UInt16)msg.parm1, (msg.parm2)<<1);
					break;

				default:
					Log_DebugPrintf(LOGID_AUDIO, "AMRWBCapture_TaskEntry: Unsupported msg, msgID = 0x%x \r\n", msg.msgID);
					break;
			}
		}
	}
}