XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon.c
u32 XAxiPmon_GetSampledMetricCounter(XAxiPmon *InstancePtr, u32 CounterNum)
{
	u32 RegValue;

	/*
	 * Assert the arguments.
	 */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid(InstancePtr->Mode != XAPM_MODE_TRACE);
	Xil_AssertNonvoid(CounterNum < XAPM_MAX_COUNTERS_PROFILE);
	Xil_AssertNonvoid((InstancePtr->Mode == XAPM_MODE_PROFILE) ||
		((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
			(InstancePtr->Config.HaveSampledCounters == 1U)));

	if (CounterNum < 10U ) {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
			((u32)XAPM_SMC0_OFFSET + (CounterNum * (u32)16)));
	}
	else if ((CounterNum >= 10U) && (CounterNum < 12U)) {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
			((u32)XAPM_SMC10_OFFSET + ((CounterNum - (u32)10) * (u32)16)));
	}
	else if ((CounterNum >= 12U) && (CounterNum < 24U)) {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
			((u32)XAPM_SMC12_OFFSET + ((CounterNum - (u32)12) * (u32)16)));
	}
	else if ((CounterNum >= 24U) && (CounterNum < 36U)) {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
			((u32)XAPM_SMC24_OFFSET + ((CounterNum - (u32)24) * (u32)16)));
	}
	else {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
			((u32)XAPM_SMC36_OFFSET + ((CounterNum - (u32)36) * (u32)16)));
	}

	return RegValue;
}
/****************************************************************************/
/**
*
* This function returns the contents of the Sampled Metric Counter Register.
*
* @param	InstancePtr is a pointer to the XAxiPmon instance.
* @param	CounterNum is the number of the Sampled Metric Counter to read.
*		Use the XAPM_METRIC_COUNTER* defines for the counter number in
*		xaxipmon.h. The valid values are 0 (XAPM_METRIC_COUNTER_0) to
*		47(XAPM_METRIC_COUNTER_47).
*
* @return	RegValue is the content of specified Sampled Metric Counter.
*
* @note		None.
*
*****************************************************************************/
This function returns the contents of the Sampled Metric Counter Register.
This function returns the contents of the Sampled Metric Counter Register .
u32 XAxiPmon_GetSampledMetricCounter(XAxiPmon *InstancePtr, u32 CounterNum)
{
	u32 RegValue;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid(InstancePtr->Mode != XAPM_MODE_TRACE);
	Xil_AssertNonvoid(CounterNum < XAPM_MAX_COUNTERS_PROFILE);
	Xil_AssertNonvoid((InstancePtr->Mode == XAPM_MODE_PROFILE) ||
		((InstancePtr->Mode == XAPM_MODE_ADVANCED) &&
			(InstancePtr->Config.HaveSampledCounters == 1U)));
	if (CounterNum < 10U ) {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
			((u32)XAPM_SMC0_OFFSET + (CounterNum * (u32)16)));
	}
	else if ((CounterNum >= 10U) && (CounterNum < 12U)) {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
			((u32)XAPM_SMC10_OFFSET + ((CounterNum - (u32)10) * (u32)16)));
	}
	else if ((CounterNum >= 12U) && (CounterNum < 24U)) {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
			((u32)XAPM_SMC12_OFFSET + ((CounterNum - (u32)12) * (u32)16)));
	}
	else if ((CounterNum >= 24U) && (CounterNum < 36U)) {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
			((u32)XAPM_SMC24_OFFSET + ((CounterNum - (u32)24) * (u32)16)));
	}
	else {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
			((u32)XAPM_SMC36_OFFSET + ((CounterNum - (u32)36) * (u32)16)));
	}
	return RegValue;
}
u32 XAxiPmon_GetSampledMetricCounter ( XAxiPmon * InstancePtr , u32 CounterNum ) { u32 RegValue ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; Xil_AssertNonvoid ( InstancePtr -> Mode != XAPM_MODE_TRACE ) ; Xil_AssertNonvoid ( CounterNum < XAPM_MAX_COUNTERS_PROFILE ) ; Xil_AssertNonvoid ( ( InstancePtr -> Mode == XAPM_MODE_PROFILE ) || ( ( InstancePtr -> Mode == XAPM_MODE_ADVANCED ) && ( InstancePtr -> Config . HaveSampledCounters == 1U ) ) ) ; if ( CounterNum < 10U ) { RegValue = XAxiPmon_ReadReg ( InstancePtr -> Config . BaseAddress , ( ( u32 ) XAPM_SMC0_OFFSET + ( CounterNum * ( u32 ) 16 ) ) ) ; } else if ( ( CounterNum >= 10U ) && ( CounterNum < 12U ) ) { RegValue = XAxiPmon_ReadReg ( InstancePtr -> Config . BaseAddress , ( ( u32 ) XAPM_SMC10_OFFSET + ( ( CounterNum - ( u32 ) 10 ) * ( u32 ) 16 ) ) ) ; } else if ( ( CounterNum >= 12U ) && ( CounterNum < 24U ) ) { RegValue = XAxiPmon_ReadReg ( InstancePtr -> Config . BaseAddress , ( ( u32 ) XAPM_SMC12_OFFSET + ( ( CounterNum - ( u32 ) 12 ) * ( u32 ) 16 ) ) ) ; } else if ( ( CounterNum >= 24U ) && ( CounterNum < 36U ) ) { RegValue = XAxiPmon_ReadReg ( InstancePtr -> Config . BaseAddress , ( ( u32 ) XAPM_SMC24_OFFSET + ( ( CounterNum - ( u32 ) 24 ) * ( u32 ) 16 ) ) ) ; } else { RegValue = XAxiPmon_ReadReg ( InstancePtr -> Config . BaseAddress , ( ( u32 ) XAPM_SMC36_OFFSET + ( ( CounterNum - ( u32 ) 36 ) * ( u32 ) 16 ) ) ) ; } return RegValue ; }
This function returns the contents of the Sampled Metric Counter Register.
This function returns the contents of the Sampled Metric Counter Register .
/*
	 * Assert the arguments.
	 */