XilinxProcessorIPLib/drivers/axipmon/src/xaxipmon.c
s32 XAxiPmon_GetMetrics(XAxiPmon *InstancePtr, u8 CounterNum, u8 *Metrics,
								u8 *Slot)
{
	u32 RegValue;
	/*
	 * Assert the arguments.
	 */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid(InstancePtr->Mode == XAPM_MODE_ADVANCED);
	Xil_AssertNonvoid(CounterNum <= XAPM_MAX_COUNTERS);

	if(CounterNum <= 3U) {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
					XAPM_MSR0_OFFSET);
		*Metrics = (u8)(RegValue >> (CounterNum * (u8)8)) & 0x1FU;
		*Slot 	= (u8)(RegValue >> ((CounterNum * (u8)8) + (u8)5)) & 0x07U;

	}
	else if((CounterNum >= 4U) && (CounterNum <= 7U)) {
		CounterNum = CounterNum - 4U;
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
					XAPM_MSR1_OFFSET);
		*Metrics = (u8)(RegValue >> (CounterNum * (u8)8)) & 0x1FU;
		*Slot 	= (u8)(RegValue >> ((CounterNum * (u8)8) + (u8)5)) & 0x07U;
	}
	else {
		CounterNum = CounterNum - 8U;
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
					XAPM_MSR2_OFFSET);
		*Metrics = (u8)(RegValue >> (CounterNum * (u8)8)) & 0x1FU;
		*Slot 	= (u8)(RegValue >> ((CounterNum * (u8)8) + (u8)5)) & 0x07U;
	}
	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function returns Metrics in the specified Counter from the corresponding
* Metric Selector Register.
*
* @param	InstancePtr is a pointer to the XAxiPmon instance.
* @param	CounterNum is the Counter Number.
*		The valid values are 0 to 9.
* @param	Metrics is a reference parameter from application where metrics
*		of specified counter is filled.
* @param	Slot is a reference parameter in which slot Id of
*		specified counter is filled
* @return	XST_SUCCESS if Success
*		XST_FAILURE if Failure
*
* @note		None.
*
*****************************************************************************/
This function returns Metrics in the specified Counter from the corresponding
Metric Selector Register.
This function returns Metrics in the specified Counter from the corresponding Metric Selector Register .
s32 XAxiPmon_GetMetrics(XAxiPmon *InstancePtr, u8 CounterNum, u8 *Metrics,
								u8 *Slot)
{
	u32 RegValue;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid(InstancePtr->Mode == XAPM_MODE_ADVANCED);
	Xil_AssertNonvoid(CounterNum <= XAPM_MAX_COUNTERS);
	if(CounterNum <= 3U) {
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
					XAPM_MSR0_OFFSET);
		*Metrics = (u8)(RegValue >> (CounterNum * (u8)8)) & 0x1FU;
		*Slot 	= (u8)(RegValue >> ((CounterNum * (u8)8) + (u8)5)) & 0x07U;
	}
	else if((CounterNum >= 4U) && (CounterNum <= 7U)) {
		CounterNum = CounterNum - 4U;
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
					XAPM_MSR1_OFFSET);
		*Metrics = (u8)(RegValue >> (CounterNum * (u8)8)) & 0x1FU;
		*Slot 	= (u8)(RegValue >> ((CounterNum * (u8)8) + (u8)5)) & 0x07U;
	}
	else {
		CounterNum = CounterNum - 8U;
		RegValue = XAxiPmon_ReadReg(InstancePtr->Config.BaseAddress,
					XAPM_MSR2_OFFSET);
		*Metrics = (u8)(RegValue >> (CounterNum * (u8)8)) & 0x1FU;
		*Slot 	= (u8)(RegValue >> ((CounterNum * (u8)8) + (u8)5)) & 0x07U;
	}
	return XST_SUCCESS;
}
s32 XAxiPmon_GetMetrics ( XAxiPmon * InstancePtr , u8 CounterNum , u8 * Metrics , u8 * Slot ) { u32 RegValue ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; Xil_AssertNonvoid ( InstancePtr -> Mode == XAPM_MODE_ADVANCED ) ; Xil_AssertNonvoid ( CounterNum <= XAPM_MAX_COUNTERS ) ; if ( CounterNum <= 3U ) { RegValue = XAxiPmon_ReadReg ( InstancePtr -> Config . BaseAddress , XAPM_MSR0_OFFSET ) ; * Metrics = ( u8 ) ( RegValue >> ( CounterNum * ( u8 ) 8 ) ) & 0x1FU ; * Slot = ( u8 ) ( RegValue >> ( ( CounterNum * ( u8 ) 8 ) + ( u8 ) 5 ) ) & 0x07U ; } else if ( ( CounterNum >= 4U ) && ( CounterNum <= 7U ) ) { CounterNum = CounterNum - 4U ; RegValue = XAxiPmon_ReadReg ( InstancePtr -> Config . BaseAddress , XAPM_MSR1_OFFSET ) ; * Metrics = ( u8 ) ( RegValue >> ( CounterNum * ( u8 ) 8 ) ) & 0x1FU ; * Slot = ( u8 ) ( RegValue >> ( ( CounterNum * ( u8 ) 8 ) + ( u8 ) 5 ) ) & 0x07U ; } else { CounterNum = CounterNum - 8U ; RegValue = XAxiPmon_ReadReg ( InstancePtr -> Config . BaseAddress , XAPM_MSR2_OFFSET ) ; * Metrics = ( u8 ) ( RegValue >> ( CounterNum * ( u8 ) 8 ) ) & 0x1FU ; * Slot = ( u8 ) ( RegValue >> ( ( CounterNum * ( u8 ) 8 ) + ( u8 ) 5 ) ) & 0x07U ; } return XST_SUCCESS ; }
This function returns Metrics in the specified Counter from the corresponding
Metric Selector Register.
This function returns Metrics in the specified Counter from the corresponding Metric Selector Register .
/*
	 * Assert the arguments.
	 */