コード例 #1
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
RPC_Result_t RPC_PACKET_FreeBuffer(PACKET_BufHandle_t dataBufHandle)
{
	_DBG_(RPC_TRACE
	      ("RPC_PACKET_FreeBuffer FREE h=%d\r\n", (int)dataBufHandle));

	if (!sCPResetting)
		IPC_FreeBuffer((IPC_Buffer) dataBufHandle);

	RpcDbgUpdatePktState((int)dataBufHandle, PKT_STATE_PKT_FREE);
	rpc_wake_lock_remove((UInt32)dataBufHandle);
	freeRpcPkts++;
	return RPC_RESULT_OK;
}
コード例 #2
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
RPC_Result_t RPC_PACKET_FreeBufferEx(PACKET_BufHandle_t dataBufHandle,
				     UInt8 rpcClientID)
{
	IPC_U32 refCount = 0;

	RPC_LOCK;

	if (!sCPResetting) {
		refCount = IPC_BufferUserParameterGet((IPC_Buffer)
						      dataBufHandle);

		if (refCount == 0) {
			_DBG_(RPC_TRACE
			      ("k:RPC_PACKET_FreeBufferEx ERROR h=%d, cid=%d\r\n",
			       (int)dataBufHandle, rpcClientID));
			RPC_UNLOCK;
			return RPC_RESULT_ERROR;
		}

		--refCount;
		IPC_BufferUserParameterSet((IPC_Buffer) dataBufHandle,
					   refCount);
	}

	if (refCount == 0) {
		freeRpcPkts++;
		_DBG_(RPC_TRACE
		      ("k:RPC_PACKET_FreeBufferEx FREE h=%d, cid=%d rcvPkts=%d freePkts=%d\r\n",
		       (int)dataBufHandle, (int)rpcClientID, (int)recvRpcPkts,
		       (int)freeRpcPkts));
		if (!sCPResetting)
			IPC_FreeBuffer((IPC_Buffer) dataBufHandle);
		RpcDbgUpdatePktStateEx((int)dataBufHandle, PKT_STATE_PKT_FREE,
				       rpcClientID, PKT_STATE_CID_FREE, 0, 0,
				       0xFF);
		rpc_wake_lock_remove((UInt32)dataBufHandle);
	} else {

		RpcDbgUpdatePktStateEx((int)dataBufHandle, PKT_STATE_NA,
				       rpcClientID, PKT_STATE_CID_FREE, 0, 0,
				       0xFF);

		_DBG_(RPC_TRACE
		      ("k:RPC_PACKET_FreeBufferEx h=%d, ref=%d, cid=%d\r\n",
		       (int)dataBufHandle, (int)refCount, (int)rpcClientID));
	}

	RPC_UNLOCK;
	return RPC_RESULT_OK;
}
コード例 #3
0
/**
   @fn void ipcs_capi2app_bd(IPC_Buffer ipc_buffer);
*/
void ipcs_capi2app_bd(IPC_Buffer ipc_buffer)
{
	IPC_DEBUG(DBG_INFO, ">> %s\n", __FUNCTION__);

   if (g_clnt_info_tbl[EpCapi2App].buffer_delivery_cb != ipcs_capi2app_bd)
   {
      (*g_clnt_info_tbl[EpCapi2App].buffer_delivery_cb)(ipc_buffer);
   }
   else
   {
   	IPC_FreeBuffer(ipc_buffer);
   }

	IPC_DEBUG(DBG_INFO, "<< %s\n", __FUNCTION__);
}
コード例 #4
0
/**
   @fn void ipcs_audioctrl_bd(IPC_Buffer ipc_buffer);
*/
void ipcs_audioctrl_bd(IPC_Buffer ipc_buffer)
{
	IPC_DEBUG(DBG_INFO, ">> %s\n", __FUNCTION__);

   if (g_clnt_info_tbl[EpAudioControl].buffer_delivery_cb != ipcs_audioctrl_bd)
   {
      (*g_clnt_info_tbl[EpAudioControl].buffer_delivery_cb)(ipc_buffer);
   }
   else
   {
   	IPC_FreeBuffer(ipc_buffer);
   }

	IPC_DEBUG(DBG_INFO, "<< %s\n", __FUNCTION__);
}
コード例 #5
0
ファイル: rpc_ipc.c プロジェクト: asdlei00/Ace-i
static void RPC_BufferDelivery(IPC_Buffer bufHandle)
{
	RPC_Result_t result = RPC_RESULT_ERROR;
	UInt8* pCid = (UInt8*)IPC_BufferHeaderPointer(bufHandle);
	IPC_EndpointId_T destId = IPC_BufferDestinationEndpointId(bufHandle);
	Int8 type = GetInterfaceType(destId);

	if(type != -1 && ipcInfoList[type].pktIndCb != NULL)
		result = ipcInfoList[type].pktIndCb((PACKET_InterfaceType_t)type, (UInt8)pCid[0], (PACKET_BufHandle_t)bufHandle);
	else
		_DBG_(RPC_TRACE("RPC_BufferDelivery(%c) FAIL destIP=%d handle=%x",(gRpcProcType == RPC_COMMS)?'C':'A',destId, bufHandle));


	if(result != RPC_RESULT_PENDING)
		IPC_FreeBuffer(bufHandle);
}
コード例 #6
0
//**************************************************
void AudioControlAp_DeliveryFunction	(IPC_Buffer Buffer)
{
	char *		Response		= IPC_BufferDataPointer (Buffer);
	U32			ResponseLength	= IPC_BufferDataSize  (Buffer);
    char dd[256];

	//(void) dprintf(5, "\n\nAudioControlCp_DeliveryFunction: Length %d. First 16 bytes...\n\n", ResponseLength);
    memcpy(dd, Response, ResponseLength);

#if 0
	{
    int i=0;
    Log_DebugPrintf(LOGID_AUDIO,"\n%02X %02X %02X %02X %02X %02X %02X %02X\n", dd[i], dd[i+1], dd[i+2], dd[i+3], dd[i+4], dd[i+5], dd[i+6], dd[i+7]);
    i=8;
    Log_DebugPrintf(LOGID_AUDIO,"\n%02X %02X %02X %02X %02X %02X %02X %02X\n", dd[i], dd[i+1], dd[i+2], dd[i+3], dd[i+4], dd[i+5], dd[i+6], dd[i+7]);
    i=16;
	}
#endif

    IPC_process_dsp_interrupt(dd, ResponseLength);

	IPC_FreeBuffer (Buffer);
}
コード例 #7
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
static int rpcKthreadFn(MsgQueueHandle_t *mHandle, void *data)
{
	IPC_Buffer bufHandle = (IPC_Buffer) data;
	RPC_Result_t result = RPC_RESULT_ERROR;
	UInt8 *pCid = (UInt8 *)IPC_BufferHeaderPointer(bufHandle);
	IPC_EndpointId_T destId = IPC_BufferDestinationEndpointId(bufHandle);
	Int8 type = GetInterfaceType(destId);

/*	_DBG_(RPC_TRACE
	      ("RPC_BufferDelivery PROCESS mHandle=%x event=%d\n", (int)mHandle,
	       (int)data));*/

	if (ipcInfoList[(int)type].filterPktIndCb != NULL) {
		RpcDbgUpdatePktState((int)bufHandle, PKT_STATE_RPC_PROCESS);

		result =
		    ipcInfoList[(int)
				type].filterPktIndCb((PACKET_InterfaceType_t)
						     type, (UInt8)pCid[0],
						     (PACKET_BufHandle_t)
						     bufHandle);
	}

	if (result != RPC_RESULT_PENDING) {
		_DBG_(RPC_TRACE
		      ("IPC_FreeBuffer (No Handling) h=%d\r\n",
		       (int)bufHandle));

		RpcDbgUpdatePktState((int)bufHandle, PKT_STATE_PKT_FREE);
		IPC_FreeBuffer(bufHandle);
		freeRpcPkts++;
		rpc_wake_lock_remove((UInt32)bufHandle);
	}

	return 0;
}
コード例 #8
0
static void AudioControlAp_DeliveryFunction (IPC_Buffer buf)
{
        brcm_dsp_interrupt_hisr(IPC_BufferDataPointer(buf), IPC_BufferDataSize(buf));
        IPC_FreeBuffer(buf);
}
コード例 #9
0
void ipcs_cplog_bd(IPC_Buffer ipc_buffer)
{
	BCMLOG_HandleCpLogMsg( (const char*)IPC_BufferDataPointer(ipc_buffer), IPC_BufferDataSize(ipc_buffer) ) ;
	IPC_FreeBuffer(ipc_buffer);
}
コード例 #10
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
static void RPC_BufferDelivery(IPC_Buffer bufHandle)
{
	PACKET_InterfaceType_t ifType;
	RPC_IPCInfo_t *pInfo;
	Int32 isReservedPkt = 0;
	int ret;
	RPC_Result_t result = RPC_RESULT_ERROR;
	UInt8 *pCid = (UInt8 *)IPC_BufferHeaderPointer(bufHandle);
	IPC_EndpointId_T destId = IPC_BufferDestinationEndpointId(bufHandle);
	int type = GetInterfaceType(destId);
	PACKET_BufHandle_t pktBufHandle = (PACKET_BufHandle_t) bufHandle;

	if (type == -1 || pCid == NULL) {
		IPC_FreeBuffer(bufHandle);
		_DBG_(RPC_TRACE("RPC_BufferDelivery FAIL pkt=%d t=%d cid=%d",
				pktBufHandle, type, pCid));
		return;
	}
	pInfo = &ipcInfoList[type];
	ifType = (PACKET_InterfaceType_t)type;
	if (pInfo->pktIndCb == NULL && pInfo->filterPktIndCb == NULL) {
		IPC_FreeBuffer(bufHandle);
		_DBG_(RPC_TRACE("RPC_BufferDelivery FAIL No Cbk pkt=%d\r\n",
				pktBufHandle));
		return;
	}
	if (ifType != INTERFACE_PACKET) {
		IPC_U32 uParam;
		/*For bckward compatibility, remove in future release */

		uParam = IPC_BufferUserParameterGet(bufHandle);
		if (uParam == CAPI2_RESERVE_POOL_ID) {
			/* TBD: Add recovery mechanism */
			IPC_FreeBuffer(bufHandle);
			_DBG_(RPC_TRACE
			      ("RPC_BufferDelivery RESERVED (Drop) h=%d if=%d rcvPkts=%d freePkts=%d\r\n",
			       (int)bufHandle, (int)type,
			       (int)recvRpcPkts, (int)freeRpcPkts));
			return;
		}

		isReservedPkt = RPC_PACKET_IsReservedPkt(pktBufHandle);
		/* Log incoming packet */
		rpcLogNewPacket(pktBufHandle, ifType, pInfo, pCid,
				isReservedPkt);

	}

	if (pInfo->pktIndCb != NULL && isReservedPkt == 0)
		result = pInfo->pktIndCb((PACKET_InterfaceType_t)type,
					 (UInt8)pCid[0], pktBufHandle);

	if (result == RPC_RESULT_PENDING)
		return;		/* Sysrpc packet come here */
	if (pInfo->filterPktIndCb == NULL) {
		IPC_FreeBuffer(bufHandle);
		rpcLogFreePacket((PACKET_InterfaceType_t)type, pktBufHandle);
		return;		/* net or vt interface pkt come here */
	}
#ifdef USE_KTHREAD_HANDOVER
	if (isReservedPkt &&
	    MsgQueueCount(&rpcMQhandle) >= CFG_RPC_CMD_MAX_PACKETS) {
		IPC_FreeBuffer(bufHandle);
		rpcLogFreePacket((PACKET_InterfaceType_t)type, pktBufHandle);
		_DBG_(RPC_TRACE("RPC_BufferDelivery(rz) RpcQ FULL h=%d c=%d\n",
				(int)bufHandle, MsgQueueCount(&rpcMQhandle)));
		return;
	}

	/* Post it to RPC Thread */
	ret = MsgQueueAdd(&rpcMQhandle, (void *)bufHandle);

	if (ret != 0) {
		IPC_FreeBuffer(bufHandle);
		rpcLogFreePacket((PACKET_InterfaceType_t)type, pktBufHandle);
		_DBG_(RPC_TRACE("RPC_BufferDelivery Queue FAIL h=%d r=%d\n",
				(int)bufHandle, ret));
		return;
	}
	RpcDbgUpdatePktState((int)bufHandle, PKT_STATE_RPC_POST);

	result = RPC_RESULT_PENDING;
#else
	/* If using workerqueue instead of tasklet,
	   filterPktIndCb can be called directly */
	result = pInfo->filterPktIndCb((PACKET_InterfaceType_t)type,
				       (UInt8)pCid[0], (PACKET_BufHandle_t)
				       bufHandle);
#endif

	/* If Packet not consumed by secondary client then return */

	//Coverity [DEADCODE]
	if (result != RPC_RESULT_PENDING) {
		/* Packet was never consumed */
		/* coverity [dead_error_line] */
		IPC_FreeBuffer(bufHandle);
		rpcLogFreePacket((PACKET_InterfaceType_t)type, pktBufHandle);
		_DBG_(RPC_TRACE("RPC_BufferDelivery filterCb FAIL h=%d r=%d\n",
				(int)bufHandle, ret));
		return;
	}

	_DBG_(RPC_TRACE("RPC_BufferDelivery filterCb OK h=%d\n",
			(int)bufHandle));
	return;
}
コード例 #11
0
ファイル: rpc_ipc.c プロジェクト: asdlei00/Ace-i
RPC_Result_t RPC_PACKET_FreeBuffer(PACKET_BufHandle_t dataBufHandle)
{
	IPC_FreeBuffer((IPC_Buffer)dataBufHandle);
	return RPC_RESULT_OK;
}
コード例 #12
0
void IPC_ProcessEvents(void)
{
	IPC_Buffer Buffer;
	IPC_CPU_ID_T Cpu = IPC_SM_CURRENT_CPU;

	IPC_TRACE(IPC_Channel_Hisr, "IPC_ProcessEvents", "CPU %02X", Cpu, 0, 0,
		  0);

	if (!SmLocalControl.ConfiguredReported) {

		if ((SmLocalControl.SmControl->
		     Initialised[IPC_CPU_ID_INDEX(Cpu)] == IPC_SmConfigured)
		    && (SmLocalControl.SmControl->
			Initialised[IPC_CPU_ID_INDEX(IPC_OTHER_CPU[Cpu])] ==
			IPC_SmConfigured)) {
			SmLocalControl.ConfiguredReported = IPC_TRUE;
			(*SmLocalControl.IPCInitialisedFunction) ();
		} else {
			IPC_TRACE(IPC_Channel_Error, "IPC_ProcessEvents",
				  "CPU %02X, Not Initialised", Cpu, 0, 0, 0);
			return;
		}
	}
#ifdef FUSE_IPC_CRASH_SUPPORT
	if ((Cpu == IPC_AP_CPU) && (g_bCpCrashed == IPC_FALSE)
	    && (SmLocalControl.SmControl->CrashCode != IPC_CP_NOT_CRASHED)) {
		/* CP has crashed so set the crash status */
		g_bCpCrashed = IPC_TRUE;

		/**
		 * CP should be analysing crach here as this is the first
		 * indication - but call crash function in case finished.
		 */
		if (SmLocalControl.IPCCPCrashed)
			SmLocalControl.IPCCPCrashed(SmLocalControl.SmControl->
						    CrashCode);

	}

	if (g_bCpCrashed == IPC_TRUE) {
		if ((SmLocalControl.SmControl->CrashCode !=
		     IPC_CP_ANALYSING_CRASH)
		    && (SmLocalControl.SmControl->CrashCode !=
			IPC_CP_NOT_CRASHED)) {

			/**
			 * if CP is not analysing any more than we should
			 * have crash dump now
			 *
			 * call the function to handle the crash dump
			 */
			if (SmLocalControl.IPCCPCrashed)
				SmLocalControl.IPCCPCrashed(SmLocalControl.
							    SmControl->
							    CrashCode);
			/**
			 * This function can call  IPCAP_GetCrashData to get
			 * crash location.
			 */
		} else {
			g_bCpCrashed = IPC_FALSE;
		}
	} else
#endif /* FUSE_IPC_CRASH_SUPPORT */
	{
		{
			IPC_Fifo SendFifo = SmLocalControl.SendFifo;

			while (0 != (Buffer = IPC_SmFifoRead(SendFifo))) {
				IPC_EndpointId_T DestinationEpId =
				    IPC_PoolDestinationEndpointId
				    (IPC_BufferOwningPool(Buffer));
				IPC_Endpoint DestinationEpPtr =
				    IPC_SmEndpointInfo(DestinationEpId);

#ifdef IPC_DEBUG
				if (DestinationEpPtr
				    && DestinationEpPtr->DeliveryFunction
				    && DestinationEpPtr->Cpu ==
				    IPC_SM_CURRENT_CPU) {
					IPC_TRACE(IPC_Channel_Hisr,
						  "IPC_ProcessEvents",
						  "Buffer %08X, size %d, EP %d, Fn %08X",
						  Buffer,
						  IPC_BufferDataSize(Buffer),
						  DestinationEpId,
						  (IPC_U32) DestinationEpPtr->
						  DeliveryFunction);

					(DestinationEpPtr->
					 DeliveryFunction) (Buffer);

				} else {
					IPC_TRACE(IPC_Channel_Error,
						  "IPC_ProcessEvents",
						  "No Delivery Function for EP %d, Function %08X, CpuId %d",
						  DestinationEpId,
						  (IPC_U32) DestinationEpPtr->
						  DeliveryFunction,
						  DestinationEpPtr->Cpu, 0);

					IPC_FreeBuffer(Buffer);
				}
#else
				(DestinationEpPtr->DeliveryFunction) (Buffer);
#endif
			}
		}
		{

			IPC_Fifo FreeFifo = SmLocalControl.FreeFifo;
			while (0 != (Buffer = IPC_SmFifoRead(FreeFifo))) {
				IPC_BufferReturn(Buffer,
						 IPC_BufferOwningPool(Buffer));
			}
		}
	}
}