XilinxProcessorIPLib/drivers/sysmonpsu/src/xsysmonpsu.c
u8 XSysMonPsu_GetAvg(XSysMonPsu *InstancePtr, u32 SysmonBlk)
{
	u32 Average;
	UINTPTR EffectiveBaseAddress;

	/* Assert the arguments. */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid((SysmonBlk == XSYSMON_PS)||(SysmonBlk == XSYSMON_PL));

	/* Calculate the effective baseaddress based on the Sysmon instance. */
	EffectiveBaseAddress =
			XSysMonPsu_GetEffBaseAddress(InstancePtr->Config.BaseAddress,
					SysmonBlk);

	/* Read the averaging value from the Configuration Register 0. */
	Average = XSysmonPsu_ReadReg(EffectiveBaseAddress +
				XSYSMONPSU_CFG_REG0_OFFSET) & XSYSMONPSU_CFG_REG0_AVRGNG_MASK;

	return (u8)(Average >> XSYSMONPSU_CFG_REG0_AVRGNG_SHIFT);
}
/****************************************************************************/
/**
*
* This function returns the number of samples of averaging configured for all
* the channels in the Configuration Register 0.
*
* @param	InstancePtr is a pointer to the XSysMonPsu instance.
* @param	SysmonBlk is the value that tells whether it is for PS Sysmon
*       block or PL Sysmon block register region.
*
* @return	The averaging read from the Configuration Register 0 is
*		returned. Use the XSM_AVG_* bit definitions defined in xsysmonpsu.h
*		file to interpret the returned value :
*		- XSM_AVG_0_SAMPLES means no averaging
*		- XSM_AVG_16_SAMPLES means 16 samples of averaging
*		- XSM_AVG_64_SAMPLES means 64 samples of averaging
*		- XSM_AVG_256_SAMPLES means 256 samples of averaging
*
* @note		None.
*
*****************************************************************************/
This function returns the number of samples of averaging configured for all
the channels in the Configuration Register 0.
This function returns the number of samples of averaging configured for all the channels in the Configuration Register 0 .
u8 XSysMonPsu_GetAvg(XSysMonPsu *InstancePtr, u32 SysmonBlk)
{
	u32 Average;
	UINTPTR EffectiveBaseAddress;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid((SysmonBlk == XSYSMON_PS)||(SysmonBlk == XSYSMON_PL));
	EffectiveBaseAddress =
			XSysMonPsu_GetEffBaseAddress(InstancePtr->Config.BaseAddress,
					SysmonBlk);
	Average = XSysmonPsu_ReadReg(EffectiveBaseAddress +
				XSYSMONPSU_CFG_REG0_OFFSET) & XSYSMONPSU_CFG_REG0_AVRGNG_MASK;
	return (u8)(Average >> XSYSMONPSU_CFG_REG0_AVRGNG_SHIFT);
}
u8 XSysMonPsu_GetAvg ( XSysMonPsu * InstancePtr , u32 SysmonBlk ) { u32 Average ; UINTPTR EffectiveBaseAddress ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; Xil_AssertNonvoid ( ( SysmonBlk == XSYSMON_PS ) || ( SysmonBlk == XSYSMON_PL ) ) ; EffectiveBaseAddress = XSysMonPsu_GetEffBaseAddress ( InstancePtr -> Config . BaseAddress , SysmonBlk ) ; Average = XSysmonPsu_ReadReg ( EffectiveBaseAddress + XSYSMONPSU_CFG_REG0_OFFSET ) & XSYSMONPSU_CFG_REG0_AVRGNG_MASK ; return ( u8 ) ( Average >> XSYSMONPSU_CFG_REG0_AVRGNG_SHIFT ) ; }
This function returns the number of samples of averaging configured for all
the channels in the Configuration Register 0.
This function returns the number of samples of averaging configured for all the channels in the Configuration Register 0 .
/* Assert the arguments. */ /* Calculate the effective baseaddress based on the Sysmon instance. */ /* Read the averaging value from the Configuration Register 0. */