lib/sw_services/xilplmi/src/xplmi_event_logging.c
static int XPlmi_ConfigureLogMem(XPlmi_CircularBuffer *LogBuffer, u64 StartAddr,
		u32 NumBytes, u8 BufType)
{
	int Status = XST_FAILURE;
	u64 EndAddr = 0U;
	u32 StartLimit;
	u32 EndLimit;

	if ((NumBytes == 0U) ||
		((NumBytes & XPLMI_WORD_LEN_MASK) != 0U)) {
		Status = (int)XPLMI_ERR_INVALID_LOG_BUF_LEN;
		goto END1;
	}

	EndAddr = StartAddr + NumBytes - 1U;
	Status = XPlmi_VerifyAddrRange(StartAddr, EndAddr);
	if (Status != XST_SUCCESS) {
		if (BufType == XPLMI_TRACE_LOG_BUFFER) {
			StartLimit = XPLMI_TRACE_LOG_BUFFER_ADDR;
			EndLimit = XPLMI_TRACE_LOG_BUFFER_HIGH_ADDR;
		}
		else if (BufType == XPLMI_DEBUG_LOG_BUFFER) {
			StartLimit = XPLMI_DEBUG_LOG_BUFFER_ADDR;
			EndLimit = XPLMI_DEBUG_LOG_BUFFER_HIGH_ADDR;
		}
		else {
			goto END;
		}
		if ((StartAddr < StartLimit) || (EndAddr > EndLimit)) {
			Status = (int)XPLMI_ERR_INVALID_LOG_BUF_ADDR;
			goto END1;
		}
	}
END:
	LogBuffer->StartAddr = StartAddr;
	LogBuffer->Offset = 0x0U;
	LogBuffer->Len = NumBytes;
	LogBuffer->IsBufferFull = (u32)FALSE;
	Status = XST_SUCCESS;

END1:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function configures Log Buffer with the given memory address
 * and size. It also validates the given address range
 *
 * @param 	LogBuffer is the circular buffer structure to be configured
 * @param 	StartAddr is the starting address of the given buffer
 * @param 	NumBytes is number of bytes the circular buffer can hold
 * @param 	BufType is the type of log buffer
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function configures Log Buffer with the given memory address
and size. It also validates the given address range

@param       LogBuffer is the circular buffer structure to be configured
@param       StartAddr is the starting address of the given buffer
@param       NumBytes is number of bytes the circular buffer can hold
@param       BufType is the type of log buffer

@return      XST_SUCCESS on success and error code on failure
@brief This function configures Log Buffer with the given memory address and size . It also validates the given address range @param LogBuffer is the circular buffer structure to be configured @param StartAddr is the starting address of the given buffer @param NumBytes is number of bytes the circular buffer can hold @param BufType is the type of log buffer @return XST_SUCCESS on success and error code on failure
static int XPlmi_ConfigureLogMem(XPlmi_CircularBuffer *LogBuffer, u64 StartAddr,
		u32 NumBytes, u8 BufType)
{
	int Status = XST_FAILURE;
	u64 EndAddr = 0U;
	u32 StartLimit;
	u32 EndLimit;
	if ((NumBytes == 0U) ||
		((NumBytes & XPLMI_WORD_LEN_MASK) != 0U)) {
		Status = (int)XPLMI_ERR_INVALID_LOG_BUF_LEN;
		goto END1;
	}
	EndAddr = StartAddr + NumBytes - 1U;
	Status = XPlmi_VerifyAddrRange(StartAddr, EndAddr);
	if (Status != XST_SUCCESS) {
		if (BufType == XPLMI_TRACE_LOG_BUFFER) {
			StartLimit = XPLMI_TRACE_LOG_BUFFER_ADDR;
			EndLimit = XPLMI_TRACE_LOG_BUFFER_HIGH_ADDR;
		}
		else if (BufType == XPLMI_DEBUG_LOG_BUFFER) {
			StartLimit = XPLMI_DEBUG_LOG_BUFFER_ADDR;
			EndLimit = XPLMI_DEBUG_LOG_BUFFER_HIGH_ADDR;
		}
		else {
			goto END;
		}
		if ((StartAddr < StartLimit) || (EndAddr > EndLimit)) {
			Status = (int)XPLMI_ERR_INVALID_LOG_BUF_ADDR;
			goto END1;
		}
	}
END:
	LogBuffer->StartAddr = StartAddr;
	LogBuffer->Offset = 0x0U;
	LogBuffer->Len = NumBytes;
	LogBuffer->IsBufferFull = (u32)FALSE;
	Status = XST_SUCCESS;
END1:
	return Status;
}
static int XPlmi_ConfigureLogMem ( XPlmi_CircularBuffer * LogBuffer , u64 StartAddr , u32 NumBytes , u8 BufType ) { int Status = XST_FAILURE ; u64 EndAddr = 0U ; u32 StartLimit ; u32 EndLimit ; if ( ( NumBytes == 0U ) || ( ( NumBytes & XPLMI_WORD_LEN_MASK ) != 0U ) ) { Status = ( int ) XPLMI_ERR_INVALID_LOG_BUF_LEN ; goto END1 ; } EndAddr = StartAddr + NumBytes - 1U ; Status = XPlmi_VerifyAddrRange ( StartAddr , EndAddr ) ; if ( Status != XST_SUCCESS ) { if ( BufType == XPLMI_TRACE_LOG_BUFFER ) { StartLimit = XPLMI_TRACE_LOG_BUFFER_ADDR ; EndLimit = XPLMI_TRACE_LOG_BUFFER_HIGH_ADDR ; } else if ( BufType == XPLMI_DEBUG_LOG_BUFFER ) { StartLimit = XPLMI_DEBUG_LOG_BUFFER_ADDR ; EndLimit = XPLMI_DEBUG_LOG_BUFFER_HIGH_ADDR ; } else { goto END ; } if ( ( StartAddr < StartLimit ) || ( EndAddr > EndLimit ) ) { Status = ( int ) XPLMI_ERR_INVALID_LOG_BUF_ADDR ; goto END1 ; } } END : LogBuffer -> StartAddr = StartAddr ; LogBuffer -> Offset = 0x0U ; LogBuffer -> Len = NumBytes ; LogBuffer -> IsBufferFull = ( u32 ) FALSE ; Status = XST_SUCCESS ; END1 : return Status ; }
@brief       This function configures Log Buffer with the given memory address
 and size.
@brief This function configures Log Buffer with the given memory address and size .