XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon.c
s32 XAxiPmon_CfgInitialize(XAxiPmon *InstancePtr, XAxiPmon_Config *ConfigPtr,
						UINTPTR EffectiveAddr)
{
	/*
	 * Assert the input arguments.
	 */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(ConfigPtr != NULL);

	/*
	 * Set the values read from the device config and the base address.
	 */
	InstancePtr->Config.DeviceId = ConfigPtr->DeviceId;
	InstancePtr->Config.BaseAddress = EffectiveAddr;
	InstancePtr->Config.GlobalClkCounterWidth =
				ConfigPtr->GlobalClkCounterWidth;
	InstancePtr->Config.MetricSampleCounterWidth =
				ConfigPtr->MetricSampleCounterWidth;
	InstancePtr->Config.IsEventCount =
				ConfigPtr->IsEventCount;
	InstancePtr->Config.NumberofSlots =
				ConfigPtr->NumberofSlots;
	InstancePtr->Config.NumberofCounters =
				ConfigPtr->NumberofCounters;
	InstancePtr->Config.HaveSampledCounters =
				ConfigPtr->HaveSampledCounters;
	InstancePtr->Config.IsEventLog =
				ConfigPtr->IsEventLog;
	InstancePtr->Config.FifoDepth =
				ConfigPtr->FifoDepth;
	InstancePtr->Config.FifoWidth =
				ConfigPtr->FifoWidth;
	InstancePtr->Config.TidWidth =
				ConfigPtr->TidWidth;
	InstancePtr->Config.Is32BitFiltering = ConfigPtr->Is32BitFiltering;

	InstancePtr->Config.ScaleFactor = ConfigPtr->ScaleFactor;

	if ((ConfigPtr->ModeProfile == ConfigPtr->ModeTrace)
			|| (ConfigPtr->ModeAdvanced == 1U))
	{
		InstancePtr->Mode = XAPM_MODE_ADVANCED;
	} else if (ConfigPtr->ModeTrace == 1U) {
		InstancePtr->Mode = XAPM_MODE_TRACE;
	} else {
		InstancePtr->Mode = XAPM_MODE_PROFILE;
	}

	/*
	 * Indicate the instance is now ready to use, initialized without error.
	 */
	InstancePtr->IsReady = XIL_COMPONENT_IS_READY;

	/*
	 * Reset the Counters and FIFO based on Modes.
	 */

	/* Advanced and Profile */
	if((InstancePtr->Mode == XAPM_MODE_ADVANCED) ||
			(InstancePtr->Mode == XAPM_MODE_PROFILE))
	{
		(void)XAxiPmon_ResetMetricCounter(InstancePtr);
	}
	/* Advanced */
	if(InstancePtr->Mode == XAPM_MODE_ADVANCED)
	{
		XAxiPmon_ResetGlobalClkCounter(InstancePtr);
	}
	/* Advanced and Trace */
	if((InstancePtr->Mode == XAPM_MODE_ADVANCED) ||
			(InstancePtr->Mode == XAPM_MODE_TRACE))
	{
		(void)XAxiPmon_ResetFifo(InstancePtr);
	}
	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function initializes a specific XAxiPmon device/instance. This function
* must be called prior to using the AXI Performance Monitor device.
*
* @param	InstancePtr is a pointer to the XAxiPmon instance.
* @param	ConfigPtr points to the XAxiPmon device configuration structure.
* @param	EffectiveAddr is the device base address in the virtual memory
*		address space. If the address translation is not used then the
*		physical address is passed.
*		Unexpected errors may occur if the address mapping is changed
*		after this function is invoked.
*
* @return
*		- XST_SUCCESS if successful.
*
* @note		The user needs to first call the XAxiPmon_LookupConfig() API
*		which returns the Configuration structure pointer which is
*		passed as a parameter to the XAxiPmon_CfgInitialize() API.
*
******************************************************************************/
This function initializes a specific XAxiPmon device/instance. This function
must be called prior to using the AXI Performance Monitor device.
This function initializes a specific XAxiPmon device / instance . This function must be called prior to using the AXI Performance Monitor device .
s32 XAxiPmon_CfgInitialize(XAxiPmon *InstancePtr, XAxiPmon_Config *ConfigPtr,
						UINTPTR EffectiveAddr)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(ConfigPtr != NULL);
	InstancePtr->Config.DeviceId = ConfigPtr->DeviceId;
	InstancePtr->Config.BaseAddress = EffectiveAddr;
	InstancePtr->Config.GlobalClkCounterWidth =
				ConfigPtr->GlobalClkCounterWidth;
	InstancePtr->Config.MetricSampleCounterWidth =
				ConfigPtr->MetricSampleCounterWidth;
	InstancePtr->Config.IsEventCount =
				ConfigPtr->IsEventCount;
	InstancePtr->Config.NumberofSlots =
				ConfigPtr->NumberofSlots;
	InstancePtr->Config.NumberofCounters =
				ConfigPtr->NumberofCounters;
	InstancePtr->Config.HaveSampledCounters =
				ConfigPtr->HaveSampledCounters;
	InstancePtr->Config.IsEventLog =
				ConfigPtr->IsEventLog;
	InstancePtr->Config.FifoDepth =
				ConfigPtr->FifoDepth;
	InstancePtr->Config.FifoWidth =
				ConfigPtr->FifoWidth;
	InstancePtr->Config.TidWidth =
				ConfigPtr->TidWidth;
	InstancePtr->Config.Is32BitFiltering = ConfigPtr->Is32BitFiltering;
	InstancePtr->Config.ScaleFactor = ConfigPtr->ScaleFactor;
	if ((ConfigPtr->ModeProfile == ConfigPtr->ModeTrace)
			|| (ConfigPtr->ModeAdvanced == 1U))
	{
		InstancePtr->Mode = XAPM_MODE_ADVANCED;
	} else if (ConfigPtr->ModeTrace == 1U) {
		InstancePtr->Mode = XAPM_MODE_TRACE;
	} else {
		InstancePtr->Mode = XAPM_MODE_PROFILE;
	}
	InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
	if((InstancePtr->Mode == XAPM_MODE_ADVANCED) ||
			(InstancePtr->Mode == XAPM_MODE_PROFILE))
	{
		(void)XAxiPmon_ResetMetricCounter(InstancePtr);
	}
	if(InstancePtr->Mode == XAPM_MODE_ADVANCED)
	{
		XAxiPmon_ResetGlobalClkCounter(InstancePtr);
	}
	if((InstancePtr->Mode == XAPM_MODE_ADVANCED) ||
			(InstancePtr->Mode == XAPM_MODE_TRACE))
	{
		(void)XAxiPmon_ResetFifo(InstancePtr);
	}
	return XST_SUCCESS;
}
s32 XAxiPmon_CfgInitialize ( XAxiPmon * InstancePtr , XAxiPmon_Config * ConfigPtr , UINTPTR EffectiveAddr ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( ConfigPtr != NULL ) ; InstancePtr -> Config . DeviceId = ConfigPtr -> DeviceId ; InstancePtr -> Config . BaseAddress = EffectiveAddr ; InstancePtr -> Config . GlobalClkCounterWidth = ConfigPtr -> GlobalClkCounterWidth ; InstancePtr -> Config . MetricSampleCounterWidth = ConfigPtr -> MetricSampleCounterWidth ; InstancePtr -> Config . IsEventCount = ConfigPtr -> IsEventCount ; InstancePtr -> Config . NumberofSlots = ConfigPtr -> NumberofSlots ; InstancePtr -> Config . NumberofCounters = ConfigPtr -> NumberofCounters ; InstancePtr -> Config . HaveSampledCounters = ConfigPtr -> HaveSampledCounters ; InstancePtr -> Config . IsEventLog = ConfigPtr -> IsEventLog ; InstancePtr -> Config . FifoDepth = ConfigPtr -> FifoDepth ; InstancePtr -> Config . FifoWidth = ConfigPtr -> FifoWidth ; InstancePtr -> Config . TidWidth = ConfigPtr -> TidWidth ; InstancePtr -> Config . Is32BitFiltering = ConfigPtr -> Is32BitFiltering ; InstancePtr -> Config . ScaleFactor = ConfigPtr -> ScaleFactor ; if ( ( ConfigPtr -> ModeProfile == ConfigPtr -> ModeTrace ) || ( ConfigPtr -> ModeAdvanced == 1U ) ) { InstancePtr -> Mode = XAPM_MODE_ADVANCED ; } else if ( ConfigPtr -> ModeTrace == 1U ) { InstancePtr -> Mode = XAPM_MODE_TRACE ; } else { InstancePtr -> Mode = XAPM_MODE_PROFILE ; } InstancePtr -> IsReady = XIL_COMPONENT_IS_READY ; if ( ( InstancePtr -> Mode == XAPM_MODE_ADVANCED ) || ( InstancePtr -> Mode == XAPM_MODE_PROFILE ) ) { ( void ) XAxiPmon_ResetMetricCounter ( InstancePtr ) ; } if ( InstancePtr -> Mode == XAPM_MODE_ADVANCED ) { XAxiPmon_ResetGlobalClkCounter ( InstancePtr ) ; } if ( ( InstancePtr -> Mode == XAPM_MODE_ADVANCED ) || ( InstancePtr -> Mode == XAPM_MODE_TRACE ) ) { ( void ) XAxiPmon_ResetFifo ( InstancePtr ) ; } return XST_SUCCESS ; }
This function initializes a specific XAxiPmon device/instance.
This function initializes a specific XAxiPmon device / instance .
/*
	 * Assert the input arguments.
	 */ /*
	 * Set the values read from the device config and the base address.
	 */ /*
	 * Indicate the instance is now ready to use, initialized without error.
	 */ /*
	 * Reset the Counters and FIFO based on Modes.
	 */ /* Advanced and Profile */ /* Advanced */ /* Advanced and Trace */