XilinxProcessorIPLib/drivers/sysmon/src/xsysmon.c
u16 XSysMon_GetAdcData(XSysMon *InstancePtr, u8 Channel)
{
	u16 AdcData;
	/*
	 * Assert the arguments.
	 */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid((Channel <= XSM_CH_VBRAM) ||
			  ((Channel >= XSM_CH_VCCPINT) &&
			  (Channel <= XSM_CH_AUX_MAX)) ||
			  ((Channel >= XSM_CH_VUSR0) &&
			  (Channel <= XSM_CH_VUSR3)));

	/*
	 * Read the selected ADC converted data for the specified channel
	 * and return the value.
	 */
	if (Channel <= XSM_CH_AUX_MAX) {
		AdcData = (u16) (XSysMon_ReadReg(InstancePtr->
				Config.BaseAddress, XSM_TEMP_OFFSET +
				(Channel << 2)));
	} else {
		AdcData = (u16) (XSysMon_ReadReg(InstancePtr->
				Config.BaseAddress, XSM_VUSR0_OFFSET +
				((Channel - XSM_CH_VUSR0) << 2)));
	}

	return AdcData;
}
/****************************************************************************/
/**
*
* Get the ADC converted data for the specified channel.
*
* @param	InstancePtr is a pointer to the XSysMon instance.
* @param	Channel is the channel number. Use the XSM_CH_* defined in
*		the file xsysmon.h.
*		The valid channels are 0 to 5 and 16 to 31 for all the device
*		families. Channel 6 is valid for 7 Series and Zynq.
*		Channel 13, 14, 15 are valid for Zynq. 32 to 35 are valid for
*		Ultrascale.
*
* @return	A 16-bit value representing the ADC converted data for the
*		specified channel. The System Monitor/ADC device guarantees
* 		a 10 bit resolution for the ADC converted data and data is the
*		10 MSB bits of the 16 data read from the device.
*
* @note		The channels 7,8,9 are used for calibration of the device and
*           	hence there is no associated data with this channel.
*		Please make sure that the proper channel number is passed.
*
*****************************************************************************/
Get the ADC converted data for the specified channel.
Get the ADC converted data for the specified channel .
u16 XSysMon_GetAdcData(XSysMon *InstancePtr, u8 Channel)
{
	u16 AdcData;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid((Channel <= XSM_CH_VBRAM) ||
			  ((Channel >= XSM_CH_VCCPINT) &&
			  (Channel <= XSM_CH_AUX_MAX)) ||
			  ((Channel >= XSM_CH_VUSR0) &&
			  (Channel <= XSM_CH_VUSR3)));
	if (Channel <= XSM_CH_AUX_MAX) {
		AdcData = (u16) (XSysMon_ReadReg(InstancePtr->
				Config.BaseAddress, XSM_TEMP_OFFSET +
				(Channel << 2)));
	} else {
		AdcData = (u16) (XSysMon_ReadReg(InstancePtr->
				Config.BaseAddress, XSM_VUSR0_OFFSET +
				((Channel - XSM_CH_VUSR0) << 2)));
	}
	return AdcData;
}
u16 XSysMon_GetAdcData ( XSysMon * InstancePtr , u8 Channel ) { u16 AdcData ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; Xil_AssertNonvoid ( ( Channel <= XSM_CH_VBRAM ) || ( ( Channel >= XSM_CH_VCCPINT ) && ( Channel <= XSM_CH_AUX_MAX ) ) || ( ( Channel >= XSM_CH_VUSR0 ) && ( Channel <= XSM_CH_VUSR3 ) ) ) ; if ( Channel <= XSM_CH_AUX_MAX ) { AdcData = ( u16 ) ( XSysMon_ReadReg ( InstancePtr -> Config . BaseAddress , XSM_TEMP_OFFSET + ( Channel << 2 ) ) ) ; } else { AdcData = ( u16 ) ( XSysMon_ReadReg ( InstancePtr -> Config . BaseAddress , XSM_VUSR0_OFFSET + ( ( Channel - XSM_CH_VUSR0 ) << 2 ) ) ) ; } return AdcData ; }
Get the ADC converted data for the specified channel.
Get the ADC converted data for the specified channel .
/*
	 * Assert the arguments.
	 */ /*
	 * Read the selected ADC converted data for the specified channel
	 * and return the value.
	 */