Ejemplo n.º 1
0
IPC_ReturnCode_T IPC_SendBuffer(IPC_Buffer Buffer, IPC_Priority_T Priority)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);

	IPC_TRACE(IPC_Channel_Buffer, "IPC_SendBuffer",
		  "Buffer %d (%08X), Priority %d", BufferPtr->BufferId, Buffer,
		  Priority, 0);

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_SendBuffer",
			  "Invalid Buffer %08X", Buffer, 0, 0, 0);
		return IPC_ERROR;
	}

	BufferPtr->TimeStampSend = TIMER_GetValue();
	BufferPtr->StatusCode = IPC_BUFFER_STATUS_SENT;

	IPC_PoolAddBytesSent(BufferPtr->Pool,
			     BufferPtr->DataSize + BufferPtr->HeaderSize);

#ifdef IPC_BUFFER_STATS
	/* Debug output - turned off by default for performance */
	if (BufferPtr->BufferId == 0 && 0 == LISR_Active)
		IPC_PoolDumpStats(BufferPtr->Pool);
#endif

	IPC_SmSendBuffer(Buffer);

	return IPC_OK;
}
/* Only called by the SM HISR, so no critical reigon */
static IPC_Buffer IPC_SmFifoRead(IPC_Fifo Fifo)
{
	IPC_Buffer Buffer;
	IPC_U32 ReadIndex;

	ReadIndex = Fifo->ReadIndex;

	IPC_TRACE(IPC_Channel_Debug, "IPC_SmFifoRead",
		  "Fifo %08X, %d entries, read: %d, Write %d", Fifo,
		  IPC_FIFOCOUNT(Fifo), ReadIndex, Fifo->WriteIndex);

	if (ReadIndex == Fifo->WriteIndex) {
		IPC_TRACE(IPC_Channel_Sm, "IPC_SmFifoRead", "Fifo %08X, Empty",
			  Fifo, 0, 0, 0);
		return (IPC_Buffer) 0;
	}

	Buffer = Fifo->Buffer[ReadIndex];

	Fifo->ReadIndex = IPC_FIFOINCREMENT(ReadIndex);

	IPC_TRACE(IPC_Channel_Sm, "IPC_SmFifoRead",
		  "Fifo %08X, Read  %08X, %d entries", Fifo, Buffer,
		  IPC_FIFOCOUNT(Fifo), 0);

	return Buffer;
}
Ejemplo n.º 3
0
void IPC_PoolDumpStats(IPC_BufferPool Pool)
{
	IPC_BufferPool_T *PoolPtr = IPC_PoolToPtr(Pool);

	if (!PoolPtr) {
		IPC_TRACE(IPC_Channel_General, "IPC_Stats", "Pool %08X Invalid",
			  Pool, 0, 0, 0);
		return;
	};

	IPC_TRACE(IPC_Channel_General, "IPC_Stats",
		  "Pool %08X: UserP %08X, BufSize %d, BufCount %d", Pool,
		  PoolPtr->UserParameter, PoolPtr->MaxDataSize,
		  PoolPtr->MaxBuffers);

	IPC_TRACE(IPC_Channel_General, "         ",
		  "Alloc %d, Fail %d, FcStart %d, FcStop %d",
		  PoolPtr->Allocations, PoolPtr->AllocationFailures,
		  PoolPtr->FlowStartCalls, PoolPtr->FlowStopCalls);

	IPC_TRACE(IPC_Channel_General, "         ",
		  "Sent %d, FreeBufs %d, LowWaterMark %d, FcState %d",
		  PoolPtr->BytesSent, PoolPtr->FreeBuffers,
		  PoolPtr->LowWaterMark, PoolPtr->FlowControlState);
}
Ejemplo n.º 4
0
void IPC_FreeBuffer(IPC_Buffer Buffer)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);
	IPC_CPU_ID_T OwningCpu;

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_FreeBuffer",
			  "Invalid Buffer %08X", Buffer, 0, 0, 0);
		return;
	}

	if (BufferPtr->StatusCode == IPC_BUFFER_STATUS_FREE) {
		IPC_TRACE(IPC_Channel_Error, "IPC_FreeBuffer",
			  "Repeated Free Buffer %08X", Buffer, 0, 0, 0);
		return;
	}

	OwningCpu = IPC_PoolOwningCpu(BufferPtr->Pool);
	BufferPtr->TimeStampFree = TIMER_GetValue();
	BufferPtr->StatusCode = IPC_BUFFER_STATUS_FREE;

	if (OwningCpu == IPC_SM_CURRENT_CPU) {
		IPC_TRACE(IPC_Channel_Buffer, "IPC_FreeBuffer",
			  "Buffer %08X, ID %d Same CPU ", Buffer,
			  BufferPtr->BufferId, 0, 0);
		IPC_BufferReturn(Buffer, BufferPtr->Pool);
	} else {
		IPC_TRACE(IPC_Channel_Buffer, "IPC_FreeBuffer",
			  "Buffer %08X, ID %d Other CPU", Buffer,
			  BufferPtr->BufferId, 0, 0);
		IPC_SmFreeBuffer(Buffer, OwningCpu);
	}
}
Ejemplo n.º 5
0
void *IPC_BufferHeaderRemove(IPC_Buffer Buffer, IPC_U32 HeaderSize)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferHeaderRemove",
			  "Invalid Buffer %d", Buffer, 0, 0, 0);
		return 0;
	}

	if (HeaderSize > BufferPtr->HeaderSize) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferHeaderRemove",
			  "Buffer %08X, HeaderSize %d too big", Buffer,
			  HeaderSize, 0, 0);
		return 0;
	} else {

		IPC_TRACE(IPC_Channel_Data, "IPC_BufferHeaderRemove",
			  "Buffer %08X, HeaderSize %d", Buffer, HeaderSize, 0,
			  0);
		BufferPtr->HeaderSize -= HeaderSize;
		return IPC_SmAddress(BufferPtr->DataOffset -
				     BufferPtr->HeaderSize);
	}
}
Ejemplo n.º 6
0
void IPC_DecrementBufferDataPointer(IPC_Buffer Buffer, IPC_U32 offset)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);
	IPC_SmPtr DataOffset = 0;

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_MoveBufferDataPointer ",
			  "Invalid Buffer %d", Buffer, 0, 0, 0);
		return;
	}
	DataOffset = BufferPtr->DataOffset - offset;

	IPC_TRACE(IPC_Channel_Data, "IPC_MoveBufferDataPointer ",
		  "Buffer %08X, Ptr %08X", Buffer, DataOffset, 0, 0);

	if (DataOffset <
	    (BufferPtr->DataBufferStart) + IPC_BufferHeaderSizeGet(Buffer)) {
		IPC_TRACE(IPC_Channel_Error, "IPC_MoveBufferDataPointer ",
			  "Invalid Pointer %08X", BufferPtr->DataOffset, 0, 0,
			  0);
		return;
	}
	BufferPtr->DataOffset = DataOffset;
	BufferPtr->DataSize += offset;
	BufferPtr->HeaderSize -= offset;
}
Ejemplo n.º 7
0
IPC_U32 IPC_BufferSetDataSize(IPC_Buffer Buffer, IPC_U32 Length)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);
	IPC_U32 MaxDataSize;

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferSetDataSize",
			  "Invalid Buffer %d", Buffer, 0, 0, 0);
		return 0;
	}

	MaxDataSize = IPC_PoolMaxDataSize(BufferPtr->Pool);

	if (Length > MaxDataSize) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferSetDataSize",
			  "Buffer %08X, Length %d too big", Buffer, Length, 0,
			  0);
		return 0;
	} else {
		IPC_TRACE(IPC_Channel_Data, "IPC_BufferSetDataSize",
			  "Buffer %08X, Length %d", Buffer, Length, 0, 0);
		BufferPtr->DataSize = Length;
		return Length;
	}
}
IPC_SmPtr IPC_SmPoolAlloc(IPC_U32 PoolOverhead,
			IPC_U32 HeaderSize,
			IPC_U32 DataSize,
			IPC_U32 BufferCount)
{
	IPC_SmPtr Pool;

	if (SmLocalControl.SmControl->
	    CurrentBuffers[IPC_CPU_ID_INDEX(IPC_SM_CURRENT_CPU)] +
	    BufferCount >= IPC_SM_MAX_BUFFERS) {
		IPC_TRACE(IPC_Channel_Error, "IPC_SmPoolAlloc",
			  "Too Many Buffers", 0, 0, 0, 0);
		return 0;
	}

	Pool = IPC_SmAlloc(PoolOverhead
			   + (IPC_BufferOverhead() + HeaderSize +
			      DataSize) * BufferCount);

	if (Pool == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_SmPoolAlloc",
			  "Failed to Allocate Sm", 0, 0, 0, 0);
		return 0;
	}

	SmLocalControl.SmControl->
	    CurrentBuffers[IPC_CPU_ID_INDEX(IPC_SM_CURRENT_CPU)] += BufferCount;

	IPC_SmAddPool(Pool);

	return Pool;
}
Ejemplo n.º 9
0
void *IPC_BufferFill(IPC_Buffer Buffer, void *SourcePtr, IPC_U32 SourceLength)
{
	IPC_Buffer_T *BufferPtr;
	IPC_U32 MaxDataSize;

	if (SourceLength == 0)
		return NULL;

	BufferPtr = IPC_BufferToPtr(Buffer);
	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferFill",
			  "Invalid Buffer %d", Buffer, 0, 0, 0);
		return NULL;
	}

	MaxDataSize = IPC_PoolMaxDataSize(BufferPtr->Pool);

	if (MaxDataSize < SourceLength) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferFill",
			  "Buffer %08X, Length %d too big", Buffer,
			  SourceLength, 0, 0);
		return NULL;
	}

	IPC_TRACE(IPC_Channel_Data, "IPC_BufferFill",
		  "Buffer %08X, From %08P, Length %d", Buffer, SourcePtr,
		  SourceLength, 0);

	BufferPtr->DataSize = SourceLength;

	return memcpy(IPC_SmAddress(BufferPtr->DataOffset), SourcePtr,
		      SourceLength);
}
void IPC_SmFifoWrite(IPC_Fifo Fifo, IPC_Buffer Message)
{
	CRITICAL_REIGON_SETUP IPC_U32 OriginalWritePointer;

	IPC_TRACE(IPC_Channel_Sm, "IPC_SmFifoWrite", "Fifo %08X, Buffer %08X",
		  Fifo, Message, 0, 0);

	IPC_TRACE(IPC_Channel_Debug, "IPC_SmFifoWrite",
		  "Fifo %08X,  %d entries, read: %d, Write %d", Fifo,
		  IPC_FIFOCOUNT(Fifo), Fifo->ReadIndex, Fifo->WriteIndex);

	CRITICAL_REIGON_ENTER OriginalWritePointer = Fifo->WriteIndex;

	Fifo->Buffer[OriginalWritePointer] = Message;
	Fifo->WriteIndex = IPC_FIFOINCREMENT(OriginalWritePointer);
	Fifo->WriteCount++;

	if (IPC_FIFOCOUNT(Fifo) > Fifo->HighWaterMark)
		Fifo->HighWaterMark = IPC_FIFOCOUNT(Fifo);

	CRITICAL_REIGON_LEAVE if (OriginalWritePointer == 0) {
		IPC_TRACE(IPC_Channel_Debug, "IPC_SmFifoWrite",
			  "Fifo %08X, Count %d, HighWaterMark %d", Fifo,
			  Fifo->WriteCount, Fifo->HighWaterMark, 0);
	}

	if (Fifo->ReadIndex == OriginalWritePointer) {
		/* Remote end is not currently reading FIFO */
		IPC_TRACE(IPC_Channel_Sm, "IPC_SmFifoWrite",
			  "Interrupting other Cpu", 0, 0, 0, 0);
		RAISE_INTERRUPT;
	}
}
IPC_SmPtr IPC_SmAlloc(IPC_U32 Size)
{
	IPC_CPU_ID_T Cpu = IPC_SM_CURRENT_CPU;
	volatile IPC_U32 *ApAllocated =
	    &SmLocalControl.SmControl->Allocated[IPC_CPU_ID_INDEX(IPC_AP_CPU)];
	volatile IPC_U32 *CpAllocated =
	    &SmLocalControl.SmControl->Allocated[IPC_CPU_ID_INDEX(IPC_CP_CPU)];
	IPC_SmPtr Allocated;

	if ((*CpAllocated - *ApAllocated) < Size) {
		IPC_TRACE(IPC_Channel_Error, "IPC_SmAlloc", "Not Enough Space",
			  0, 0, 0, 0);
		return 0;
	} else {
		switch (Cpu) {
		case IPC_AP_CPU:
			{
				/* Allocate from the bottom up for AP */
				Allocated = *ApAllocated;
				*ApAllocated += Size;
			}
			break;

		case IPC_CP_CPU:
			{
				/* Allocate from the top down for CP */
				*CpAllocated -= Size;
				Allocated = *CpAllocated;
			}
			break;

		default:
			{
				IPC_TRACE(IPC_Channel_Error, "IPC_SmAlloc",
					  "Unknown CPU %d", Cpu, 0, 0, 0);
				return 0;
			}
		}

		if (*CpAllocated < *ApAllocated) {
			IPC_TRACE(IPC_Channel_Error, "IPC_SmAlloc",
				  "Memory overallocated", 0, 0, 0, 0);
			return 0;
		}

		IPC_TRACE(IPC_Channel_Sm, "IPC_SmAlloc",
			  "%d Bytes Allocated at %08X", Size, Allocated, 0, 0);
		return Allocated;
	}
}
Ejemplo n.º 12
0
IPC_U32 IPC_BufferDataSize(IPC_Buffer Buffer)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferDataSize",
			  "Invalid Buffer %d", Buffer, 0, 0, 0);
		return 0;
	}

	IPC_TRACE(IPC_Channel_Data, "IPC_BufferDataSize",
		  "Buffer %08X, Size %d", Buffer, BufferPtr->DataSize, 0, 0);

	return BufferPtr->DataSize;
}
Ejemplo n.º 13
0
void *IPC_BufferHeaderPointer(IPC_Buffer Buffer)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferHeaderPointer",
			  "Invalid Buffer %d", Buffer, 0, 0, 0);
		return 0;
	}

	IPC_TRACE(IPC_Channel_Data, "IPC_BufferHeaderPointer", "Buffer %08X",
		  Buffer, 0, 0, 0);

	return IPC_SmAddress(BufferPtr->DataOffset - BufferPtr->HeaderSize);
}
Ejemplo n.º 14
0
void *IPC_BufferFillByLinkList(IPC_Buffer Buffer,
				IPC_LinkList_T *LinkListPtr,
				IPC_U32 LinkListLength)
{
	IPC_Buffer_T *BufferPtr;
	IPC_U32 MaxDataSize;
	IPC_U32 SourceLength;
	IPC_U32 i;
	unsigned char *p;
	unsigned char *q;

	SourceLength = 0;
	for (i = 0; i < LinkListLength; i++)
		SourceLength += LinkListPtr[i].size;

	if (SourceLength == 0)
		return NULL;

	BufferPtr = IPC_BufferToPtr(Buffer);
	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferFillByLinkList",
			  "Invalid Buffer %d", Buffer, 0, 0, 0);
		return NULL;
	}

	MaxDataSize = IPC_PoolMaxDataSize(BufferPtr->Pool);

	if (MaxDataSize < SourceLength) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferFillByLinkList",
			  "Buffer %08X, Length %d too big", Buffer,
			  SourceLength, 0, 0);
		return NULL;
	}

	IPC_TRACE(IPC_Channel_Data, "IPC_BufferFillByLinkList",
		  "Buffer %08X, LinkListPtr %08X, Length %d", Buffer,
		  LinkListPtr, SourceLength, 0);

	BufferPtr->DataSize = SourceLength;

	p = q = IPC_SmAddress(BufferPtr->DataOffset);
	for (i = 0; i < LinkListLength; i++) {
		memcpy(p, LinkListPtr[i].byte_array, LinkListPtr[i].size);
		p += LinkListPtr[i].size;
	}
	return (void *)q;
}
void IPC_SmSendBuffer(IPC_Buffer Buffer)
{
	IPC_EndpointId_T DestinationEpId;
	IPC_Endpoint DestinationEpPtr;
	IPC_CPU_ID_T DestinationCpu;

	DestinationEpId = IPC_BufferDestinationEndpointId(Buffer);

#ifdef IPC_DEBUG
	if (DestinationEpId == IPC_EP_None) {
		IPC_TRACE(IPC_Channel_Error,
			  "IPC_SmSendBuffer",
			  "Invalid Destination Endpoint %08X for Buffer %08X",
			  DestinationEpId, Buffer, 0, 0);
		return;
	}
#endif

#ifdef FUSE_IPC_CRASH_SUPPORT
	if (g_bCpCrashed == IPC_TRUE) {
		IPC_TRACE(IPC_Channel_Error,
			  "IPC_SmSendBuffer",
			  "Trying to send after CP has crashed for Buffer %08X",
			  Buffer, 0, 0, 0);
		return;
	}
#endif

	DestinationEpPtr = IPC_SmEndpointInfo(DestinationEpId);
	DestinationCpu = DestinationEpPtr->Cpu;

	IPC_TRACE(IPC_Channel_Sm,
		  "IPC_SmSendBuffer",
		  "DestinationCpu %02X, Buffer %08X",
		  DestinationCpu, Buffer, 0, 0);

	if (DestinationCpu == IPC_SM_CURRENT_CPU) {
		(*DestinationEpPtr->DeliveryFunction) (Buffer);
	} else {
		IPC_Fifo SendFifo =
		    &SmLocalControl.SmControl->
		    Fifos[IPC_CPU_ID_INDEX(DestinationCpu)].SendFifo;
		IPC_SmFifoWrite(SendFifo, Buffer);
	}
}
Ejemplo n.º 16
0
IPC_U32 IPC_BufferHeaderSizeGet(IPC_Buffer Buffer)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);
	IPC_U32 HeaderSize;

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferHeaderSizeGet",
			  "Invalid Buffer %d", Buffer, 0, 0, 0);
		return 0;
	}

	HeaderSize = BufferPtr->HeaderSize;

	IPC_TRACE(IPC_Channel_Data, "IPC_BufferHeaderSizeGet",
		  "Buffer %08X, HeaderSize %d", Buffer, HeaderSize, 0, 0);

	return HeaderSize;
}
Ejemplo n.º 17
0
void IPC_BufferReturnToPool(IPC_Buffer Buffer, IPC_BufferPool Pool)
{
	IPC_BufferPool_T *PoolPtr = IPC_PoolToPtr(Pool);
	IPC_U32 BufferCount;
	IPC_Boolean FlowControlCallNeeded = IPC_FALSE;

	CRITICAL_REIGON_SETUP
	    IPC_TRACE(IPC_Channel_Buffer, "IPC_BufferReturnToPool",
		      "Buffer %d (%08X), now %d in pool", IPC_BufferId(Buffer),
		      Buffer, PoolPtr->FreeBuffers + 1, 0);

	CRITICAL_REIGON_ENTER(PoolPtr->Lock);

	BufferCount = ++PoolPtr->FreeBuffers;

#ifdef IPC_DEBUG
	IPC_QRemove(IPC_BufferQueue(Buffer));
#endif
	IPC_QAddBack(IPC_BufferQueue(Buffer),
		     IPC_POOLFreeQ(IPC_SmOffset(PoolPtr)));

	/* Flow Control Check */
	if (BufferCount == PoolPtr->FlowStartLimit)
		CHECK_FLOW_STATE(PoolPtr, IPC_FLOW_START, FlowControlCallNeeded)

		    CRITICAL_REIGON_LEAVE(PoolPtr->Lock);

	if (FlowControlCallNeeded)
		IPC_ReportFlowControlEvent(PoolPtr, IPC_FLOW_START);

	/* Last ditch check - should never happen */
	if (PoolPtr->FlowControlState == IPC_FLOW_STOP
	    && !PoolPtr->FlowControlCallPending
	    && PoolPtr->FlowStartLimit < BufferCount) {
		IPC_TRACE(IPC_Channel_FlowControl, "IPC_BufferReturnToPool",
			  "Retry Flow Start", 0, 0, 0, 0);
		IPC_ReportFlowControlEvent(PoolPtr, IPC_FLOW_START);
	}

	/* For IPC_AllocateBufferWait () */
	if ((BufferCount == 1) && (PoolPtr->EmptyEvent))
		IPC_EVENT_SET(PoolPtr->EmptyEvent);
}
Ejemplo n.º 18
0
IPC_U32 IPC_PoolFreeBuffers(IPC_BufferPool Pool)
{
	IPC_BufferPool_T *PoolPtr = IPC_PoolToPtr(Pool);
	if (!PoolPtr) {
		IPC_TRACE(IPC_Channel_Error, "IPC_PoolFreeBuffers",
			  "Invalid Pool %d", Pool, 0, 0, 0);
		return 0;
	}
	return PoolPtr->FreeBuffers;
}
Ejemplo n.º 19
0
void IPC_BufferReturn(IPC_Buffer Buffer, IPC_BufferPool Pool)
{
	IPC_BufferPool_T *PoolPtr = IPC_PoolToPtr(Pool);

	if (PoolPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferReturn",
			  "Invalid Pool for Buffer %08X", Buffer, 0, 0, 0);
		return;
	}

	if (PoolPtr->BufferFreeFunction) {
		IPC_TRACE(IPC_Channel_Buffer, "IPC_BufferReturn",
			  "User Function %08X called for Buffer %08X",
			  PoolPtr->BufferFreeFunction, Buffer, 0, 0);
		(PoolPtr->BufferFreeFunction) (Pool, Buffer);
	} else {
		IPC_BufferReturnToPool(Buffer, Pool);
	}
}
Ejemplo n.º 20
0
IPC_EndpointId_T IPC_BufferDestinationEndpointId(IPC_Buffer Buffer)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);
	IPC_EndpointId_T DestinationEndpointId;

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferDestinationEndpoint",
			  "Invalid Buffer %08X", Buffer, 0, 0, 0);
		return IPC_EP_None;
	}

	DestinationEndpointId = IPC_PoolDestinationEndpointId(BufferPtr->Pool);

	IPC_TRACE(IPC_Channel_Data, "IPC_BufferDestinationEndpoint",
		  "Buffer %08X, EpId %08X", Buffer, DestinationEndpointId, 0,
		  0);

	return DestinationEndpointId;

}
void IPC_SmFreeBuffer(IPC_Buffer Buffer, IPC_CPU_ID_T OwningCpu)
{
	IPC_Fifo FreeFifo =
	    &SmLocalControl.SmControl->Fifos[IPC_CPU_ID_INDEX(OwningCpu)].
	    FreeFifo;

	IPC_TRACE(IPC_Channel_Sm,
		  "IPC_SmFreeBuffer", "Buffer %08X", Buffer, (IPC_U32) 0, 0, 0);

	IPC_SmFifoWrite(FreeFifo, Buffer);
}
Ejemplo n.º 22
0
IPC_EndpointId_T IPC_BufferSourceEndpointId(IPC_Buffer Buffer)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferSourceEndpoint",
			  "Invalid Buffer %08X", Buffer, 0, 0, 0);
		return IPC_EP_None;
	}

	return IPC_PoolSourceEndpointId(BufferPtr->Pool);
}
Ejemplo n.º 23
0
IPC_U32 IPC_BufferUserParameterGet(IPC_Buffer Buffer)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferUserParameterGet",
			  "Invalid Buffer %d", Buffer, 0, 0, 0);
		return 0;
	}

	return BufferPtr->UserParameter;
}
Ejemplo n.º 24
0
IPC_U32 IPC_BufferPoolUserParameter(IPC_Buffer Buffer)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);
	IPC_U32 Parameter;

	Parameter = IPC_PoolUserParameterGet(BufferPtr->Pool);

	IPC_TRACE(IPC_Channel_Data, "IPC_BufferPoolUserParameter",
		  "Buffer %08X, Parameter %08X", Buffer, Parameter, 0, 0);

	return Parameter;
}
Ejemplo n.º 25
0
//**************************************************
void IPC_PoolAddBytesSent (IPC_BufferPool Pool, IPC_U32 Bytes)
{
	IPC_BufferPool_T *	PoolPtr	= IPC_PoolToPtr (Pool);

	if (!PoolPtr)
	{
		IPC_TRACE (IPC_Channel_Error, "IPC_PoolAddBytesSent", "Invalid Pool %d", Pool, 0, 0, 0);
		return;
	}

	PoolPtr->BytesSent += Bytes;
}
Ejemplo n.º 26
0
//**************************************************
void  IPC_PoolSetFreeCallback (IPC_BufferPool Pool, IPC_BufferFreeFPtr_T	BufferFreeFunction)
{
	IPC_BufferPool_T *	PoolPtr	= IPC_PoolToPtr (Pool);

	if (!PoolPtr)
	{
		IPC_TRACE (IPC_Channel_Error, "IPC_PoolSetFreeCallback", "Invalid Pool %d", Pool, 0, 0, 0);
		return;
	}

	PoolPtr->BufferFreeFunction = BufferFreeFunction;
}
Ejemplo n.º 27
0
//**************************************************
IPC_U32 IPC_PoolUserParameterGet (IPC_BufferPool Pool)
{
	IPC_BufferPool_T *	PoolPtr	= IPC_PoolToPtr (Pool);

	if (!Pool)
	{
		IPC_TRACE (IPC_Channel_Error, "IPC_PoolUserParameterGet", "Invalid Pool %d", Pool, 0, 0, 0);
		return 0;
	}

	return PoolPtr->UserParameter;
}
IPC_SmQ IPC_QCreate(void)
{
	IPC_SmQ Queue = IPC_SmAlloc(sizeof(IPC_QHead_T));

	if (Queue == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_QCreate",
			  "IPC_SmAlloc failed", 0, 0, 0, 0);
		return 0;
	}

	return IPC_QInitialise(Queue, Queue);
}
Ejemplo n.º 29
0
IPC_BufferPool IPC_BufferOwningPool(IPC_Buffer Buffer)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferOwningPool",
			  "Invalid Buffer %08X", Buffer, 0, 0, 0);
		return 0;
	}

	return BufferPtr->Pool;
}
Ejemplo n.º 30
0
void *IPC_BufferLocalDescriptor(IPC_Buffer Buffer)
{
	IPC_Buffer_T *BufferPtr = IPC_BufferToPtr(Buffer);

	if (BufferPtr == 0) {
		IPC_TRACE(IPC_Channel_Error, "IPC_BufferLocalDescriptorl",
			  "Invalid Buffer %08X", Buffer, 0, 0, 0);
		return 0;
	}

	return (void *)BufferPtr->LocalData;
}