コード例 #1
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
/* called to initiate notification of clients of start of CP reset */
void RPC_PACKET_HandleNotification(
	struct RpcNotificationEvent_t inEvent)
{
	struct RpcNotificationEvent_t rpcNtfEvt;
	PACKET_InterfaceType_t currIF;

	rpcNtfEvt.event = inEvent.event;
	rpcNtfEvt.param = inEvent.param;
	for (currIF = INTERFACE_START; currIF < INTERFACE_TOTAL; currIF++)
		if (ipcInfoList[currIF].isInit) {
			if (ipcInfoList[currIF].rpcNotificationFunc) {
				_DBG_(RPC_TRACE
				      ("RPC_PACKET_HandleNotification\n"));
				_DBG_(RPC_TRACE("  notify IF %d\n", currIF));
				rpcNtfEvt.ifType = currIF;
			ipcInfoList[currIF].rpcNotificationFunc(
					rpcNtfEvt);
			}
			if (ipcInfoList[currIF].rpcFilterNotificationFunc) {
				_DBG_(RPC_TRACE
				      ("RPC_PACKET_HandleNotification\n"));
				_DBG_(RPC_TRACE("  notify fltr IF %d\n",
						currIF));
				rpcNtfEvt.ifType = currIF;
			ipcInfoList[currIF].rpcFilterNotificationFunc(
				rpcNtfEvt);
			}
		}
}
コード例 #2
0
ファイル: rpc_sys.c プロジェクト: emreharbutoglu/i9105Sammy
/* cp silent reset callback for async rpc layer; called from rpc_ipc layer */
static void RPC_Handle_CPReset(RPC_CPResetEvent_t event,
			       PACKET_InterfaceType_t interfaceType)
{
	int i;

	if ((sCpResetting && event == RPC_CPRESET_START) ||
	    (!sCpResetting && event == RPC_CPRESET_COMPLETE)) {
		/* already resetting, so just return */
		_DBG_(RPC_TRACE("RPC_Handle_CPReset already processing %s",
				sCpResetting ?
				"RPC_CPRESET_START" : "RPC_CPRESET_COMPLETE"));
		return;
	}

	_DBG_(RPC_TRACE("RPC_Handle_CPReset event %s interface %d",
			event == RPC_CPRESET_START ?
			"RPC_CPRESET_START" :
			"RPC_CPRESET_COMPLETE", interfaceType));

	sCpResetting = (event == RPC_CPRESET_START);
	/* notify all clients for given interface */
	for (i = 1; i <= gClientIndex; i++)
		if (gClientMap[i].cpResetCb != NULL &&
		    (PACKET_InterfaceType_t)gClientMap[i].iType ==
		    interfaceType) {
			_DBG_(RPC_TRACE("RPC_Handle_CPReset client:%d",
					gClientIDMap[i]));
			gClientLocalMap[i].ackdCPReset = FALSE;
			(gClientMap[i].cpResetCb) (event, gClientIDMap[i]);
		}

	_DBG_(RPC_TRACE("RPC_Handle_CPReset done for interface %d",
			interfaceType));
}
コード例 #3
0
ファイル: rpc_ipc.c プロジェクト: asdlei00/Ace-i
UInt32 RPC_PACKET_Get_Num_FreeBuffers(PACKET_InterfaceType_t interfaceType, UInt8 channel)
{
	UInt32 totalFreeBuffers = 0;
	UInt32 freeBuffers = 0;
	int index;

	if(channel == 0xFF)
	{
		for(index=0; index < MAX_CHANNELS; index++)
		{
			if(ipcInfoList[interfaceType].ipc_buf_pool[index] != 0)
			{
				freeBuffers = IPC_PoolFreeBuffers(ipcInfoList[interfaceType].ipc_buf_pool[index]);
				totalFreeBuffers += freeBuffers;
				
				_DBG_(RPC_TRACE("RPC_PACKET_Get_Num_FreeBuffers(%c)itype=%d ch=%d cur=%d total=%d\r\n",(gRpcProcType == RPC_COMMS)?'C':'A',interfaceType,channel,freeBuffers,totalFreeBuffers));
			}
		}
	}
	else
	{
		if(channel < MAX_CHANNELS && ipcInfoList[interfaceType].ipc_buf_pool[channel])
			totalFreeBuffers = IPC_PoolFreeBuffers(ipcInfoList[interfaceType].ipc_buf_pool[channel]);
		
		_DBG_(RPC_TRACE("RPC_PACKET_Get_Num_FreeBuffers(%c)itype=%d ch=%d total=%d\r\n",(gRpcProcType == RPC_COMMS)?'C':'A',interfaceType,channel,totalFreeBuffers));
	}


    return totalFreeBuffers;
}
コード例 #4
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;
}
コード例 #5
0
ファイル: rpc_ipc.c プロジェクト: asdlei00/Ace-i
PACKET_BufHandle_t RPC_PACKET_AllocateBufferEx(PACKET_InterfaceType_t interfaceType, UInt32 requiredSize, UInt8 channel, UInt32 waitTime)
{
	int index = -1;
	IPC_Buffer bufHandle = 0;

	//Determine the pool index for the interface
	if( interfaceType == INTERFACE_PACKET)
	{
		index = 0;//All channels use the same buffer pool
	}
	else
	{
		for(index=0; index < MAX_CHANNELS; index++)
		{
			if(ipcBufList[interfaceType].pkt_size[index] >= requiredSize)
				break;
		}
		if(index >= MAX_CHANNELS)
		{
			_DBG_(RPC_TRACE("RPC_PACKET_AllocateBuffer itype=%d invalid channel %d\r\n",interfaceType, index));
			return NULL;
		}
	}

	//Create the pool om demand
	if(ipcInfoList[interfaceType].ipc_buf_pool[index] == 0)
		RPC_CreateBufferPool(interfaceType, index);
	
	if(interfaceType == INTERFACE_PACKET && DETAIL_DATA_LOG_ENABLED)
		_DBG_(RPC_TRACE_DATA_DETAIL("RPC_PACKET_AllocateBuffer(%c) PKT BEFORE %d\r\n",(gRpcProcType == RPC_COMMS)?'C':'A',requiredSize));

	if(waitTime == PKT_ALLOC_NOWAIT)
		bufHandle = IPC_AllocateBuffer(ipcInfoList[interfaceType].ipc_buf_pool[index]);
	else
		bufHandle = IPC_AllocateBufferWait(ipcInfoList[interfaceType].ipc_buf_pool[index], waitTime);
	
	if(interfaceType == INTERFACE_PACKET && DETAIL_DATA_LOG_ENABLED)
		_DBG_(RPC_TRACE_DATA_DETAIL("RPC_PACKET_AllocateBuffer(%c) PKT AFTER %d\r\n",(gRpcProcType == RPC_COMMS)?'C':'A',requiredSize));
	

	if(0 == bufHandle)
	{
		_DBG_(RPC_TRACE("RPC_PACKET_AllocateBuffer failed %d, %d, %d\r\n", interfaceType, requiredSize, index));
	}

	if(bufHandle)
		IPC_BufferSetDataSize(bufHandle, requiredSize);

	return (PACKET_BufHandle_t)bufHandle;
}
コード例 #6
0
void HandleDrxEventRspCb(RPC_Msg_t *pMsg,
			 ResultDataBufHandle_t dataBufHandle,
			 UInt32 userContextData)
{
	_DBG_(RPC_TRACE("HandleDrxEventRspCb %d\r\n", pMsg->msgId));
	if (pMsg->msgId == MSG_ADC_DRX_SYNC_IND) {
		/*Handle event */
	} else if (pMsg->msgId == MSG_RPC_SIMPLE_REQ_RSP) {
		RPC_SimpleMsg_t *pSimpMsg = (RPC_SimpleMsg_t *) pMsg->dataBuf;
		_DBG_(RPC_TRACE
		      ("HandleDrxEventRspCb MSG_RPC_SIMPLE_REQ_RSP %d %d\r\n",
		       pSimpMsg->type, pSimpMsg->param1));

	}
	RPC_SYSFreeResultDataBuffer(dataBufHandle);
}
コード例 #7
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
static void RPC_FlowCntrl(IPC_BufferPool Pool, IPC_FlowCtrlEvent_T Event)
{
	IPC_EndpointId_T epId = IPC_PoolSourceEndpointId(Pool);
	Int8 type = GetInterfaceType(epId);
	Int8 pool_index;

	if (type != -1) {
		pool_index =
		    rpcGetPoolIndex((PACKET_InterfaceType_t)type, Pool);

		if (ipcInfoList[(int)type].flowControlCb != NULL)
			ipcInfoList[(int)type].flowControlCb((Event ==
							      IPC_FLOW_START) ?
							     RPC_FLOW_START :
							     RPC_FLOW_STOP,
							     (UInt8)((pool_index
								      >=
								      0)
								     ?
								     (pool_index
								      +
								      1) : 0));

		_DBG_(RPC_TRACE
		      ("RPC_FlowCntrl(%c) type=%d event=%d\r\n",
		       (gRpcProcType == RPC_COMMS) ? 'C' : 'A', type, Event));
	}

}
コード例 #8
0
ファイル: rpc_sys.c プロジェクト: emreharbutoglu/i9105Sammy
Boolean RPC_IsRegisteredClient(UInt8 channel, PACKET_BufHandle_t dataBufHandle)
{
	Boolean ret = FALSE;

	UInt8 xdrReqClient =
	    RPC_PACKET_GetContext(INTERFACE_CAPI2, dataBufHandle);
	UInt16 msgId = RPC_PACKET_GetContextEx(INTERFACE_CAPI2, dataBufHandle);
	Boolean isValid = RPC_IsValidMsg((MsgType_t)msgId);
	UInt8 clientHandle = RPC_SYS_GetClientHandle(channel);
	UInt8 clientAckHandle = RPC_SYS_GetClientHandle(xdrReqClient);

	if (msgId == MSG_CAPI2_ACK_RSP) {
		ret = (xdrReqClient > 0 && clientAckHandle > 0);

	} else {
		if (channel > 0)
			ret = (clientHandle != 0) ? TRUE : FALSE;
		else
			ret = isValid;
	}

	if (ret)
		_DBG_(RPC_TRACE
		      ("RPC_IsRegisteredClient[ret=%d] ch=%d xdrClient=%d msgId=0x%x validMsg=%d validClient=%d validAckClient=%d",
		       ret, channel, xdrReqClient, msgId, isValid, clientHandle,
		       clientAckHandle));
	return ret;
}
コード例 #9
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
RPC_Result_t RPC_PACKET_SendData(UInt8 rpcClientID,
				 PACKET_InterfaceType_t interfaceType,
				 UInt8 channel,
				 PACKET_BufHandle_t dataBufHandle)
{
	IPC_ReturnCode_T ipcError = IPC_ERROR;
	UInt8 *pCid =
	    (UInt8 *)IPC_BufferHeaderSizeSet((IPC_Buffer) dataBufHandle, 4);

	/*fixes compiler warnings */
	if (rpcClientID) ;

	if (pCid) {
		pCid[0] = channel;
		if (sCPResetting) {
			_DBG_(RPC_TRACE
			      ("RPC_PACKET_SendData: cp resetting, ignore send\n"));
			ipcError = IPC_ERROR;
		} else
			ipcError =
			    IPC_SendBuffer((IPC_Buffer) dataBufHandle,
					   IPC_PRIORITY_DEFAULT);
	}

	return (ipcError == IPC_OK) ? RPC_RESULT_OK : RPC_RESULT_ERROR;
}
コード例 #10
0
ファイル: rpc_sys.c プロジェクト: manoranjan2050/Compact
RPC_Handle_t RPC_SYS_RegisterClient(const RPC_InitParams_t *params) 
{
	UInt8 userClientID;
	UInt8 clientIndex = 0;

	gClientIndex++;

	clientIndex = gClientIndex;

	if(clientIndex >= MAX_RPC_CLIENTS)
		return (RPC_Handle_t)NULL;

	gClientMap[clientIndex] = *params;

	RPC_PACKET_RegisterDataInd(0, (PACKET_InterfaceType_t)(gClientMap[clientIndex].iType), RPC_BufferDelivery, params->flowCb);

	rpc_internal_xdr_init();
	rpc_register_xdr(clientIndex, params->xdrtbl, params->table_size);

	userClientID = SYS_GenClientID();

	gClientIDs[userClientID] = clientIndex;
	gClientIDMap[clientIndex] = userClientID;
	gClientLocalMap[clientIndex].notifyUnsolicited = FALSE;

	_DBG_(RPC_TRACE("RPC_SYS_RegisterClient index=%d userClientID=%d", clientIndex, userClientID));

	return (RPC_Handle_t)clientIndex;
}
コード例 #11
0
ファイル: rpc_sync.c プロジェクト: CVlaspoel/VSMC-i9105p
// get unused task/response map struct to be used with current task
TaskRequestMap_t *GetNewMapForCurrentTask()
{
	TaskRequestMap_t *taskMap = NULL;
	UInt8 i;

	OSSEMAPHORE_Obtain(semaTaskReq, TICKS_FOREVER);

	for (i = 0; i < MAX_TASKS_NUM; i++) {
		_DBG_(RPC_TRACE
		      ("GetNewMapForCurrentTask detail task %lx index = %d\r\n",
		       (UInt32)((sTaskRequestMap + i)->task), i));

		if (NULL == (sTaskRequestMap + i)->task) {
			(sTaskRequestMap + i)->task =
			    (Task_t) OSTASK_GetCurrentTask();
			taskMap = (sTaskRequestMap + i);
			break;
		}
	}

	if (MAX_TASKS_NUM == i) {
		for (i = 0; i < MAX_TASKS_NUM; i++) {
			_DBG_(RPC_TRACE
			      ("GetNewMapForCurrentTask 2nd loop task %lx index = %d\r\n",
			       (UInt32)((sTaskRequestMap + i)->task), i));

			if (FALSE ==
			    OSTASK_IsValidTask((sTaskRequestMap + i)->task)) {
				(sTaskRequestMap + i)->task =
				    (Task_t) OSTASK_GetCurrentTask();
				taskMap = (sTaskRequestMap + i);
				break;
			}

		}
	}

	OSSEMAPHORE_Release(semaTaskReq);

	_DBG_(RPC_TRACE
	      ("GetNewMapForCurrentTask task %lx index= %d\r\n",
	       (UInt32)OSTASK_GetCurrentTask(), i));

	return taskMap;
}
コード例 #12
0
ファイル: rpc_sys.c プロジェクト: emreharbutoglu/i9105Sammy
Boolean RPC_RegisterUnsolicitedMsgs(RPC_Handle_t handle, const UInt16 *msgIds,
				    UInt8 listSize)
{
	if (!msgIds || listSize == 0) {
		_DBG_(RPC_TRACE
		      ("RPC_RegisterUnsolicitedMsgs FAIL handle=0x%x listSize=%d",
		       handle, listSize));
		return FALSE;
	}

	_DBG_(RPC_TRACE
	      ("RPC_RegisterUnsolicitedMsgs handle=0x%x listSize=%d list=[%x:%x:%x:%x:%x]",
	       handle, listSize, msgIds[0], msgIds[1], msgIds[2], msgIds[3],
	       msgIds[4]));

	return rpc_lookup_set_mask(msgIds, listSize,
				   RPC_XDR_INFO_MASK_UNSOLICITED);
}
コード例 #13
0
ファイル: rpc_sync.c プロジェクト: CVlaspoel/VSMC-i9105p
/**
	Handle the ack result from the RPC function call.
	@param		tid (in) Transaction id for request.
	@param		ack (in) Ack result for request

**/
void RPC_SyncHandleAck(UInt32 tid, UInt8 clientID, RPC_ACK_Result_t ack,
		       UInt32 ackData)
{
	OSStatus_t semaStatus;
	// find the map struct corresponding to this transaction ID
	TaskRequestMap_t *taskMap = NULL;
	Boolean isResultPending = (ackData) ? TRUE : FALSE;

	if (tid == 0) {
		_DBG_(RPC_TRACE
		      ("RPC_SyncHandleAck Ignored tid %d ack %d pending %d\r\n",
		       (int)tid, ack, isResultPending));
		return;
	}

	taskMap = GetMapForTID(tid);
//      assert(taskMap);

	if (taskMap) {
		// record ack status
		taskMap->ack = ack;
		taskMap->isResultPending = isResultPending;

		_DBG_(RPC_TRACE
		      ("RPC_SyncHandleAck tid %d ack %d pending %d\r\n",
		       (int)tid, ack, isResultPending));

		// since there won't be anybody waiting on it (ie. it will
		// be dispatched using the client ID/msg type)
		if ((ACK_SUCCESS == ack) && isResultPending) {
			taskMap->tid = 0;
		}
		// notify calling task of receipt of ack
		semaStatus = OSSEMAPHORE_Release(taskMap->ackSema);
		if (semaStatus != OSSTATUS_SUCCESS) {
			_DBG_(RPC_TRACE
			      ("WARNING!!!! RPC_SyncHandleAck: Semaphore release failed\r\n"));
		}
	} else {
		_DBG_(RPC_TRACE
		      ("WARNING!!!! RPC_SyncHandleAck No Task map found tid %d ack %d pending %d\r\n",
		       (int)tid, ack, isResultPending));
	}
}
コード例 #14
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
/* callback from IPC to indicate status of CP reset process */
void RPC_PACKET_RPCNotificationHandler(IPC_CPResetEvent_t inEvent)
{
	struct RpcNotificationEvent_t rpcEvent;
	PACKET_InterfaceType_t currIF;

	_DBG_(RPC_TRACE("RPC_PACKET_RPCNotificationHandler\n"));

	sCPResetting = (inEvent == IPC_CPRESET_START);

	if (inEvent == IPC_CPRESET_START)
		for (currIF = INTERFACE_START;
		     currIF < INTERFACE_TOTAL; currIF++) {
			ipcInfoList[currIF].readyForCPReset = FALSE;
			ipcInfoList[currIF].filterReadyForCPReset = FALSE;
		}

	if (inEvent == IPC_CPRESET_COMPLETE) {
		int index;

		/* reset done, so reset buffer pool pointers */
		for (currIF = INTERFACE_START;
		     currIF < INTERFACE_TOTAL; currIF++)
			for (index = 0; index < MAX_CHANNELS; index++)
				ipcInfoList[currIF].ipc_buf_pool[index] = 0;

		/* re-register our endpoints */
		RPC_IPC_APEndPointInit();
	}

	sIsNotifyingCPReset = TRUE;

	rpcEvent.event = RPC_CPRESET_EVT;
	rpcEvent.param = (inEvent == IPC_CPRESET_START) ?
	    RPC_CPRESET_START : RPC_CPRESET_COMPLETE;
	RPC_PACKET_HandleNotification(rpcEvent);

	sIsNotifyingCPReset = FALSE;

	if (inEvent == IPC_CPRESET_START)
		CheckReadyForCPReset();

	_DBG_(RPC_TRACE("exit RPC_PACKET_RPCNotificationHandler\n"));
}
コード例 #15
0
ファイル: rpc_sys.c プロジェクト: emreharbutoglu/i9105Sammy
void RPC_AckCPReset(UInt8 clientID)
{
	UInt8 index = RPC_SYS_GetClientHandle(clientID);
	int i;
	Boolean bReady = TRUE;

	_DBG_(RPC_TRACE("RPC_AckCPReset client %d index %d\n",
			clientID, index));

	if (index <= gClientIndex)
		gClientLocalMap[index].ackdCPReset = TRUE;

	/* check if all for given PACKET_InterfaceType_t have ack'd;
	   if so, ack to rpc_ipc layer
	 */
	for (i = 1; i <= gClientIndex; i++)
		if (gClientMap[index].iType == gClientMap[i].iType &&
		    gClientMap[i].cpResetCb &&
		    !gClientLocalMap[i].ackdCPReset) {
			/* at least one client for given
			   interface type has not yet ack'd
			   so we're not ready yet
			 */
			_DBG_(RPC_TRACE("RPC_AckCPReset fail index %d\n", i));
			bReady = FALSE;
			break;
		} else {
			_DBG_(RPC_TRACE("RPC_AckCPReset %d %d %d %d %d\n",
					i, index, gClientMap[index].iType,
					gClientMap[i].iType,
					gClientLocalMap[i].ackdCPReset));
		}

	if (bReady) {
		_DBG_(RPC_TRACE
		      ("RPC_AckCPReset calling RPC_PACKET_AckReadyForCPReset\n"));
		RPC_PACKET_AckReadyForCPReset(0,
					      (PACKET_InterfaceType_t)
					      gClientMap[index].iType);
	}
}
コード例 #16
0
ファイル: rpc_sys.c プロジェクト: manoranjan2050/Compact
Boolean RPC_RegisterUnsolicitedMsgs(RPC_Handle_t handle, const UInt16 *msgIds, UInt8 listSize)
{
	UInt8 index = 0;

	if(!msgIds || listSize == 0)
	{
		_DBG_(RPC_TRACE("RPC_RegisterUnsolicitedMsgs FAIL handle=0x%x listSize=%d", handle, listSize));
		return FALSE;
	}

	_DBG_(RPC_TRACE("RPC_RegisterUnsolicitedMsgs handle=0x%x listSize=%d ", handle, listSize));

	_DBG_(RPC_TRACE("list=["));
	for (index=0; index<listSize; index++)
	{
		_DBG_(RPC_TRACE("%x", msgIds[index]));
	}
	_DBG_(RPC_TRACE("]"));

	return rpc_lookup_set_mask(msgIds, listSize, RPC_XDR_INFO_MASK_UNSOLICITED);
}
コード例 #17
0
ファイル: rpc_sync.c プロジェクト: CVlaspoel/VSMC-i9105p
/**
	Delete context from tid. 
	@param		tid (in) tid 

**/
void RPC_SyncDeleteCbkFromTid(UInt32 tid)
{
	RPC_SyncContext_t *ctx = (RPC_SyncContext_t *) tid;

	assert(ctx != NULL);

	_DBG_(RPC_TRACE
	      ("RPC_SyncDeleteCbkFromTid tid %d sig=%lx \r\n", (int)tid,
	       ctx->sig));

	if (ctx->sig == 0xBABEFACE && ctx->val != 0) {
		ctx->sig = 0;
		ctx->val = 0;
		OSHEAP_Delete(ctx);
	} else {
		_DBG_(RPC_TRACE
		      ("RPC_SyncDeleteCbkFromTid ERROR tid %d sig=%lx \r\n",
		       (int)tid, ctx->sig));
		xassert(0, tid);
	}
}
コード例 #18
0
ファイル: rpc_sys.c プロジェクト: manoranjan2050/Compact
Boolean RPC_EnableUnsolicitedMsgs(RPC_Handle_t handle, Boolean bSet)
{
	UInt8 index = (UInt8)handle;

	_DBG_(RPC_TRACE("RPC_EnableUnsolicitedMsgs handle=0x%x index=%d bSet=%d", handle, index, bSet));
	if(index <= gClientIndex)
	{
		gClientLocalMap[index].notifyUnsolicited = bSet;
		return TRUE;
	}
	return FALSE;
}
コード例 #19
0
ファイル: rpc_sync.c プロジェクト: CVlaspoel/VSMC-i9105p
/**
	Get context from tid. 
	@param		tid (in) tid 

**/
UInt32 RPC_SyncGetCbkFromTid(UInt32 tid)
{
	UInt32 val = 0;
	RPC_SyncContext_t *ctx = (RPC_SyncContext_t *) tid;

	assert(ctx != NULL);

	_DBG_(RPC_TRACE
	      ("RPC_SyncGetCbkFromTid tid %d sig=%lx \r\n",
	       (int)tid, ctx->sig));

	if (ctx->sig == 0xBABEFACE && ctx->val != 0) {
		val = ctx->val;
	} else {
		_DBG_(RPC_TRACE
		      ("RPC_SyncGetCbkFromTid ERROR tid %d sig=%lx \r\n",
		       (int)tid, ctx->sig));
		xassert(0, tid);
	}
	return val;
}
コード例 #20
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;
}
コード例 #21
0
ファイル: stsdk.c プロジェクト: ElecardSTB/elecard-apps
int st_rpcAsync(elcdRpcCommand_t cmd, cJSON* params, rpcCallback_t callback, void *pArg)
{
	int res = -1;

	int i;
	for( i = 0; i<RPC_POOL_SIZE; i++ )
		if( pool.waiting[i].id == 0 )
			break;
	if( i >= RPC_POOL_SIZE )
	{
		eprintf("%s: RPC pool is full\n", __FUNCTION__);
		return -1;
	}

	unsigned int id = get_id();
	char *msg = rpc_request( rpc_getCmdName(cmd), id, params );
	if( !msg )
	{
		eprintf("%s: failed to create RPC message\n", __FUNCTION__);
		return -1;
	}
	pool.waiting[i].id   = id;
	pool.waiting[i].callback = callback;
	pool.waiting[i].pArg = pArg;
#ifdef DEBUG
	pool.waiting[i].cmd  = cmd;
#endif
#ifdef RPC_POOL_TRACE
	pool.waiting[i].msg  = msg;
	dprintf("%s[%2d]: -> %s\n", __FUNCTION__, i, msg);
#endif
	RPC_TRACE("st: -> %s\n", msg);
#ifdef RPC_DUMP
	write(st_rpc_fd, msg, strlen(msg));
	write(st_rpc_fd, "\n", 1);
#endif
	if( client_write( &pool.socket, msg, strlen(msg)+1 ) > 0 )
	{
		res = i;
		st_poolPrint();
	}
	else
	{
		eprintf("%s: failed to write %s\n", __FUNCTION__, rpc_getCmdName(cmd));
		st_poolFreeAt(i);
	}
#ifndef RPC_POOL_TRACE
	free(msg);
#endif
	return res;
}
コード例 #22
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
void CheckReadyForCPReset(void)
{
	PACKET_InterfaceType_t currIF;
	Boolean ready = TRUE;

	/* check if all init'd entries in ipcInfoList[] have ack'd
	   if so, tell IPC CP can be reset; otherwise wait
	   (IPC should set timer; if it expires before RPC says ready
	   for reset, IPC should just crash AP as well)
	 */
	for (currIF = INTERFACE_START; currIF < INTERFACE_TOTAL; currIF++)
		if (ipcInfoList[currIF].isInit &&
		    ((ipcInfoList[currIF].pktIndCb &&
		      !ipcInfoList[currIF].readyForCPReset) ||
		     (ipcInfoList[currIF].filterPktIndCb &&
		      !ipcInfoList[currIF].filterReadyForCPReset))) {
			/* haven't all ack'd yet,
			   so we're not ready for reset
			 */
			_DBG_(RPC_TRACE("CheckReadyForCPReset not done IF%d\n",
					currIF));
			ready = FALSE;
			break;
		}

	if (ready) {
		_DBG_(RPC_TRACE("CheckReadyForCPReset done\n"));
		/* ready for start CP reset, so notify IPC here */
		IPCAP_ReadyForReset(sIPCResetClientId);

		for (currIF = INTERFACE_START; currIF < INTERFACE_TOTAL;
		     currIF++) {
			_DBG_(RPC_TRACE
			      ("freeing buffer pools for IF%d\n", currIF));
			RPC_FreeBufferPools(currIF);
		}
	}
}
コード例 #23
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
void RPC_PACKET_FilterAckReadyForCPReset(UInt8 rpcClientID,
					 PACKET_InterfaceType_t interfaceType)
{
	if (rpcClientID) {
	}
	/*fixes compiler warnings */

	ipcInfoList[interfaceType].filterReadyForCPReset = TRUE;

	_DBG_(RPC_TRACE("RPC_PACKET_FilterAckReadyForCPReset IF:%d\n",
			interfaceType));

	if (!sIsNotifyingCPReset)
		CheckReadyForCPReset();
}
コード例 #24
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
/* Frees all buffer pools for the interface type. */
static void RPC_FreeBufferPools(PACKET_InterfaceType_t interfaceType)
{
	int index;
	for (index = 0; index < MAX_CHANNELS; index++) {
		if (ipcInfoList[interfaceType].ipc_buf_pool[index] != 0) {
			IPC_PoolDelete(ipcInfoList
				       [interfaceType].ipc_buf_pool[index]);
			_DBG_(RPC_TRACE
			      ("RPC_FreeBufferPools(%c) i=%d\n",
			       (gRpcProcType == RPC_COMMS) ? 'C' : 'A',
			       (int)interfaceType));
		}
	}

}
コード例 #25
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);
}
コード例 #26
0
void test_rpc(int input1, int input2)
{
	_DBG_(RPC_TRACE("test_rpc %d %d\r\n", input1, input2));

	if (input1 == 1) {
		registerDrxEvent();
	} else if (input1 == 2) {
		sendDrxSignal();
	} else if (input1 == 3) {
		RPC_SimpleMsg_t msg = { 0 };
		msg.type = 100;
		msg.param1 = 200;

		RPC_SendSimpleMsg(1, EM_RPC_CLIENT_ID, &msg);
	}
}
コード例 #27
0
Result_t RPC_SendMsg(RPC_InternalMsg_t* rpcMsg)
{
	char* stream;
	bool_t ret;
	UInt32 len;
	PACKET_InterfaceType_t rpcInterfaceType;
	PACKET_BufHandle_t bufHandle;
	//coverity[var_decl], "entry" will be inited in function rpc_fast_lookup()
	RPC_InternalXdrInfo_t entry;
	UInt32 maxPktSize =0;
	Result_t result = RESULT_OK;

	ret = rpc_fast_lookup((UInt16)rpcMsg->rootMsg.msgId, &entry);
	if(!ret || entry.xdrInfo == NULL)
	{
		_DBG_(RPC_TRACE("RPC_SerializeMsg: failed!"));
		return RESULT_ERROR;
	}

	if(rpcMsg->msgType == RPC_TYPE_REQUEST)
	{
		rpcMsg->clientIndex = entry.clientIndex;
	}

	rpcInterfaceType = RPC_GetInterfaceType((UInt8)entry.clientIndex);
	maxPktSize = RPC_GetMaxPktSize(rpcInterfaceType, entry.xdrInfo->maxMsgSize);
	maxPktSize = (maxPktSize==0) ? MAX_MSG_STREAM_SIZE : maxPktSize;

	bufHandle = RPC_PACKET_AllocateBuffer (rpcInterfaceType, maxPktSize, 0);
	if(!bufHandle)
	{
		xassert(0,rpcMsg->rootMsg.msgId);
		return RESULT_ERROR;
	}

	stream = RPC_PACKET_GetBufferData(bufHandle);
	if(stream == 0)
		return RESULT_ERROR;

	result = RPC_SerializeMsg(rpcMsg, stream, maxPktSize, &len);

	RPC_PACKET_SetBufferLength(bufHandle, len);
	RPC_PACKET_SendData(0, rpcInterfaceType, 0, bufHandle);

	return result;
}
コード例 #28
0
ファイル: rpc_ipc.c プロジェクト: CVlaspoel/VSMC-i9105p
UInt32 RPC_PACKET_IncrementBufferRef(PACKET_BufHandle_t dataBufHandle,
				     UInt8 rpcClientID)
{
	IPC_U32 refCount;

	RPC_LOCK;

	refCount = IPC_BufferUserParameterGet((IPC_Buffer) dataBufHandle);

	IPC_BufferUserParameterSet((IPC_Buffer) dataBufHandle, (++refCount));

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

	RPC_UNLOCK;

	return refCount;
}
コード例 #29
0
ファイル: rpc_sync.c プロジェクト: CVlaspoel/VSMC-i9105p
/**
	Add ctx to tid. 
	@param		val (in) context value to be added 

**/
UInt32 RPC_SyncAddCbkToTid(UInt32 val)
{
	RPC_SyncContext_t *ctx;
	TaskRequestMap_t *taskMap = GetMapForCurrentTask();
	assert(taskMap);

	ctx = OSHEAP_Alloc(sizeof(RPC_SyncContext_t));
	assert(ctx != NULL);
	ctx->sig = 0xBABEFACE;
	ctx->val = val;

	_DBG_(RPC_TRACE
	      ("RPC_SyncAddCbkToTid oldTid=%d newTid=%ld TaskID=%p\r\n",
	       (int)taskMap->tid, (UInt32)ctx, taskMap->task));

	taskMap->tid = (UInt32)ctx;

	return (UInt32)ctx;
}
コード例 #30
0
ファイル: rpc_ipc.c プロジェクト: asdlei00/Ace-i
static void RPC_CreateBufferPool(PACKET_InterfaceType_t type, int channel_index)
{
	UInt32 val = 0;

	ipcInfoList[type].isInit = TRUE;
	ipcInfoList[type].ipc_buf_pool[channel_index] = IPC_CreateBufferPool(ipcBufList[type].srcEpId, 
																	  ipcBufList[type].destEpId, 
																	  ipcBufList[type].max_pkts[channel_index], 
																	  ipcBufList[type].pkt_size[channel_index], 
																	  ipcBufList[type].start_threshold,
																	  ipcBufList[type].end_threshold);
	val = ( (channel_index << 16 ) | (type & 0xFFFF) );

	_DBG_(RPC_TRACE("RPC_CreateBufferPool(%c) type:%d, index:%d, pool:%x\r\n", (gRpcProcType == RPC_COMMS)?'C':'A', type, channel_index, ipcInfoList[type].ipc_buf_pool[channel_index]));
	
	xassert(ipcInfoList[type].ipc_buf_pool[channel_index] != NULL, val);
	
	ipcInfoList[type].ipc_buf_id[channel_index] = channel_index+1;
}