lib/sw_services/xilplmi/src/xplmi_event_logging.c
int XPlmi_EventLogging(XPlmi_Cmd * Cmd)
{
	int Status = XST_FAILURE;
	u32 LoggingCmd = Cmd->Payload[0U];
	u64 Arg1 = (u64)Cmd->Payload[1U];
	u64 Arg2 = (u64)Cmd->Payload[2U];
	u32 Arg3 = Cmd->Payload[3U];
	u64 StartAddr;

	switch (LoggingCmd) {
		case XPLMI_LOGGING_CMD_CONFIG_LOG_LEVEL:
			Arg1 = (u64)((1U << (u32)Arg1) - 1U);
			if (Arg1 <= XPlmiDbgCurrentTypes) {
				DebugLog->LogLevel = (u8)((Arg1 << XPLMI_LOG_LEVEL_SHIFT) | Arg1);
				Status = XST_SUCCESS;
			} else {
				Status = (int)XPLMI_ERR_INVALID_LOG_LEVEL;
			}
			break;
		case XPLMI_LOGGING_CMD_CONFIG_LOG_MEM:
			StartAddr = (Arg1 << 32U) | Arg2;
			Status = XPlmi_ConfigureLogMem(&DebugLog->LogBuffer,
					StartAddr, Arg3, XPLMI_DEBUG_LOG_BUFFER);
			break;
		case XPLMI_LOGGING_CMD_RETRIEVE_LOG_DATA:
			Status = XPlmi_RetrieveBufferData(&DebugLog->LogBuffer,
				(Arg1 << 32U) | Arg2);
			break;
		case XPLMI_LOGGING_CMD_RETRIEVE_LOG_BUFFER_INFO:
			XPlmi_RetrieveBufferInfo(Cmd, &DebugLog->LogBuffer);
			Status = XST_SUCCESS;
			break;
		case XPLMI_LOGGING_CMD_CONFIG_TRACE_MEM:
			StartAddr = (Arg1 << 32U) | Arg2;
			Status = XPlmi_ConfigureLogMem(&TraceLog, StartAddr,
					Arg3, XPLMI_TRACE_LOG_BUFFER);
			break;
		case XPLMI_LOGGING_CMD_RETRIEVE_TRACE_DATA:
			Status = XPlmi_RetrieveBufferData(&TraceLog,
					(Arg1 << 32U) | Arg2);
			break;
		case XPLMI_LOGGING_CMD_RETRIEVE_TRACE_BUFFER_INFO:
			XPlmi_RetrieveBufferInfo(Cmd, &TraceLog);
			Status = XST_SUCCESS;
			break;
		case XPLMI_LOGGING_CMD_CONFIG_UART:
			Status = XPlmi_ConfigUart((u8)Arg1, (u8)Arg2);
			break;
		default:
			XPlmi_Printf(DEBUG_GENERAL,
				"Received invalid event logging command\n\r");
			Status = XST_INVALID_PARAM;
			break;
	}

	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function provides Event Logging command execution.
 *		Command payload parameters are
 *		Sub command
 *		1 - Configure print log level
 *			Arg1 - Log Level
 *		2 - Configure Debug Log buffer memory
 *			Arg1 - High Address
 *			Arg2 - Low Address
 *			Arg3 - Length
 *		3 - Retrieve Debug Log buffer
 *			Arg1 - High Address
 *			Arg2 - Low Address
 *		4 - Retrieve Debug Log buffer information
 *		5 - Configure Trace Log buffer memory
 *			Arg1 - High Address
 *			Arg2 - Low Address
 *			Arg3 - Length
 *		6 - Retrieve Trace Log buffer
 *			Arg1 - High Address
 *			Arg2 - Low Address
 *		7 - Retrieve Trace Log buffer information
 *		8 - Configure Uart
 *			Arg1 - Uart Select
 *			Arg2 - Uart Enable
 *
 * @param	Cmd is pointer to the command structure

 * @return	Returns the Status of Event Logging API
 *
 *****************************************************************************/
@brief       This function provides Event Logging command execution.

@param       Cmd is pointer to the command structure

@return      Returns the Status of Event Logging API
@brief This function provides Event Logging command execution . @param Cmd is pointer to the command structure @return Returns the Status of Event Logging API
int XPlmi_EventLogging(XPlmi_Cmd * Cmd)
{
	int Status = XST_FAILURE;
	u32 LoggingCmd = Cmd->Payload[0U];
	u64 Arg1 = (u64)Cmd->Payload[1U];
	u64 Arg2 = (u64)Cmd->Payload[2U];
	u32 Arg3 = Cmd->Payload[3U];
	u64 StartAddr;
	switch (LoggingCmd) {
		case XPLMI_LOGGING_CMD_CONFIG_LOG_LEVEL:
			Arg1 = (u64)((1U << (u32)Arg1) - 1U);
			if (Arg1 <= XPlmiDbgCurrentTypes) {
				DebugLog->LogLevel = (u8)((Arg1 << XPLMI_LOG_LEVEL_SHIFT) | Arg1);
				Status = XST_SUCCESS;
			} else {
				Status = (int)XPLMI_ERR_INVALID_LOG_LEVEL;
			}
			break;
		case XPLMI_LOGGING_CMD_CONFIG_LOG_MEM:
			StartAddr = (Arg1 << 32U) | Arg2;
			Status = XPlmi_ConfigureLogMem(&DebugLog->LogBuffer,
					StartAddr, Arg3, XPLMI_DEBUG_LOG_BUFFER);
			break;
		case XPLMI_LOGGING_CMD_RETRIEVE_LOG_DATA:
			Status = XPlmi_RetrieveBufferData(&DebugLog->LogBuffer,
				(Arg1 << 32U) | Arg2);
			break;
		case XPLMI_LOGGING_CMD_RETRIEVE_LOG_BUFFER_INFO:
			XPlmi_RetrieveBufferInfo(Cmd, &DebugLog->LogBuffer);
			Status = XST_SUCCESS;
			break;
		case XPLMI_LOGGING_CMD_CONFIG_TRACE_MEM:
			StartAddr = (Arg1 << 32U) | Arg2;
			Status = XPlmi_ConfigureLogMem(&TraceLog, StartAddr,
					Arg3, XPLMI_TRACE_LOG_BUFFER);
			break;
		case XPLMI_LOGGING_CMD_RETRIEVE_TRACE_DATA:
			Status = XPlmi_RetrieveBufferData(&TraceLog,
					(Arg1 << 32U) | Arg2);
			break;
		case XPLMI_LOGGING_CMD_RETRIEVE_TRACE_BUFFER_INFO:
			XPlmi_RetrieveBufferInfo(Cmd, &TraceLog);
			Status = XST_SUCCESS;
			break;
		case XPLMI_LOGGING_CMD_CONFIG_UART:
			Status = XPlmi_ConfigUart((u8)Arg1, (u8)Arg2);
			break;
		default:
			XPlmi_Printf(DEBUG_GENERAL,
				"Received invalid event logging command\n\r");
			Status = XST_INVALID_PARAM;
			break;
	}
	return Status;
}
int XPlmi_EventLogging ( XPlmi_Cmd * Cmd ) { int Status = XST_FAILURE ; u32 LoggingCmd = Cmd -> Payload [ 0U ] ; u64 Arg1 = ( u64 ) Cmd -> Payload [ 1U ] ; u64 Arg2 = ( u64 ) Cmd -> Payload [ 2U ] ; u32 Arg3 = Cmd -> Payload [ 3U ] ; u64 StartAddr ; switch ( LoggingCmd ) { case XPLMI_LOGGING_CMD_CONFIG_LOG_LEVEL : Arg1 = ( u64 ) ( ( 1U << ( u32 ) Arg1 ) - 1U ) ; if ( Arg1 <= XPlmiDbgCurrentTypes ) { DebugLog -> LogLevel = ( u8 ) ( ( Arg1 << XPLMI_LOG_LEVEL_SHIFT ) | Arg1 ) ; Status = XST_SUCCESS ; } else { Status = ( int ) XPLMI_ERR_INVALID_LOG_LEVEL ; } break ; case XPLMI_LOGGING_CMD_CONFIG_LOG_MEM : StartAddr = ( Arg1 << 32U ) | Arg2 ; Status = XPlmi_ConfigureLogMem ( & DebugLog -> LogBuffer , StartAddr , Arg3 , XPLMI_DEBUG_LOG_BUFFER ) ; break ; case XPLMI_LOGGING_CMD_RETRIEVE_LOG_DATA : Status = XPlmi_RetrieveBufferData ( & DebugLog -> LogBuffer , ( Arg1 << 32U ) | Arg2 ) ; break ; case XPLMI_LOGGING_CMD_RETRIEVE_LOG_BUFFER_INFO : XPlmi_RetrieveBufferInfo ( Cmd , & DebugLog -> LogBuffer ) ; Status = XST_SUCCESS ; break ; case XPLMI_LOGGING_CMD_CONFIG_TRACE_MEM : StartAddr = ( Arg1 << 32U ) | Arg2 ; Status = XPlmi_ConfigureLogMem ( & TraceLog , StartAddr , Arg3 , XPLMI_TRACE_LOG_BUFFER ) ; break ; case XPLMI_LOGGING_CMD_RETRIEVE_TRACE_DATA : Status = XPlmi_RetrieveBufferData ( & TraceLog , ( Arg1 << 32U ) | Arg2 ) ; break ; case XPLMI_LOGGING_CMD_RETRIEVE_TRACE_BUFFER_INFO : XPlmi_RetrieveBufferInfo ( Cmd , & TraceLog ) ; Status = XST_SUCCESS ; break ; case XPLMI_LOGGING_CMD_CONFIG_UART : Status = XPlmi_ConfigUart ( ( u8 ) Arg1 , ( u8 ) Arg2 ) ; break ; default : XPlmi_Printf ( DEBUG_GENERAL , " \n \r " ) ; Status = XST_INVALID_PARAM ; break ; } return Status ; }
@brief       This function provides Event Logging command execution.
@brief This function provides Event Logging command execution .