Software Drivers

xadcps.c File Reference

#include "xadcps.h"

Functions

void XAdcPs_WriteInternalReg (XAdcPs *InstancePtr, u32 RegOffset, u32 Data)
u32 XAdcPs_ReadInternalReg (XAdcPs *InstancePtr, u32 RegOffset)
int XAdcPs_CfgInitialize (XAdcPs *InstancePtr, XAdcPs_Config *ConfigPtr, u32 EffectiveAddr)
void XAdcPs_SetConfigRegister (XAdcPs *InstancePtr, u32 Data)
u32 XAdcPs_GetConfigRegister (XAdcPs *InstancePtr)
u32 XAdcPs_GetMiscStatus (XAdcPs *InstancePtr)
void XAdcPs_SetMiscCtrlRegister (XAdcPs *InstancePtr, u32 Data)
u32 XAdcPs_GetMiscCtrlRegister (XAdcPs *InstancePtr)
void XAdcPs_Reset (XAdcPs *InstancePtr)
u16 XAdcPs_GetAdcData (XAdcPs *InstancePtr, u8 Channel)
u16 XAdcPs_GetCalibCoefficient (XAdcPs *InstancePtr, u8 CoeffType)
u16 XAdcPs_GetMinMaxMeasurement (XAdcPs *InstancePtr, u8 MeasurementType)
void XAdcPs_SetAvg (XAdcPs *InstancePtr, u8 Average)
u8 XAdcPs_GetAvg (XAdcPs *InstancePtr)
int XAdcPs_SetSingleChParams (XAdcPs *InstancePtr, u8 Channel, int IncreaseAcqCycles, int IsEventMode, int IsDifferentialMode)
void XAdcPs_SetAlarmEnables (XAdcPs *InstancePtr, u16 AlmEnableMask)
u16 XAdcPs_GetAlarmEnables (XAdcPs *InstancePtr)
void XAdcPs_SetCalibEnables (XAdcPs *InstancePtr, u16 Calibration)
u16 XAdcPs_GetCalibEnables (XAdcPs *InstancePtr)
void XAdcPs_SetSequencerMode (XAdcPs *InstancePtr, u8 SequencerMode)
u8 XAdcPs_GetSequencerMode (XAdcPs *InstancePtr)
void XAdcPs_SetAdcClkDivisor (XAdcPs *InstancePtr, u8 Divisor)
u8 XAdcPs_GetAdcClkDivisor (XAdcPs *InstancePtr)
int XAdcPs_SetSeqChEnables (XAdcPs *InstancePtr, u32 ChEnableMask)
u32 XAdcPs_GetSeqChEnables (XAdcPs *InstancePtr)
int XAdcPs_SetSeqAvgEnables (XAdcPs *InstancePtr, u32 AvgEnableChMask)
u32 XAdcPs_GetSeqAvgEnables (XAdcPs *InstancePtr)
int XAdcPs_SetSeqInputMode (XAdcPs *InstancePtr, u32 InputModeChMask)
u32 XAdcPs_GetSeqInputMode (XAdcPs *InstancePtr)
int XAdcPs_SetSeqAcqTime (XAdcPs *InstancePtr, u32 AcqCyclesChMask)
u32 XAdcPs_GetSeqAcqTime (XAdcPs *InstancePtr)
void XAdcPs_SetAlarmThreshold (XAdcPs *InstancePtr, u8 AlarmThrReg, u16 Value)
u16 XAdcPs_GetAlarmThreshold (XAdcPs *InstancePtr, u8 AlarmThrReg)
void XAdcPs_EnableUserOverTemp (XAdcPs *InstancePtr)
void XAdcPs_DisableUserOverTemp (XAdcPs *InstancePtr)
void XAdcPs_SetSequencerEvent (XAdcPs *InstancePtr, int IsEventMode)
int XAdcPs_GetSamplingMode (XAdcPs *InstancePtr)
void XAdcPs_SetMuxMode (XAdcPs *InstancePtr, int MuxMode, u8 Channel)
void XAdcPs_SetPowerdownMode (XAdcPs *InstancePtr, u32 Mode)
u32 XAdcPs_GetPowerdownMode (XAdcPs *InstancePtr)

Detailed Description

This file contains the driver API functions that can be used to access the XADC device.

Refer to the xadcps.h header file for more information about this driver.

Note:
None.
 MODIFICATION HISTORY:
 Ver   Who    Date     Changes
 ----- -----  -------- -----------------------------------------------------
 1.00a ssb    12/22/11 First release based on the XPS/AXI xadc driver
 1.01a bss    02/18/13	Modified XAdcPs_SetSeqChEnables,XAdcPs_SetSeqAvgEnables
			XAdcPs_SetSeqInputMode and XAdcPs_SetSeqAcqTime APIs
			to fix CR #693371
 2.1   bss    08/05/14	Modified Assert for XAdcPs_SetSingleChParams to fix
			CR #807563.
 

Function Documentation

int XAdcPs_CfgInitialize ( XAdcPs InstancePtr,
XAdcPs_Config ConfigPtr,
u32  EffectiveAddr 
)

This function initializes a specific XAdcPs device/instance. This function must be called prior to using the XADC device.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
ConfigPtr points to the XAdcPs device configuration structure.
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.
Returns:
  • XST_SUCCESS if successful.
Note:
The user needs to first call the XAdcPs_LookupConfig() API which returns the Configuration structure pointer which is passed as a parameter to the XAdcPs_CfgInitialize() API.
void XAdcPs_DisableUserOverTemp ( XAdcPs InstancePtr  ) 

This function disables programming of the powerdown temperature for the OverTemp signal in the OT Powerdown register.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
None.
Note:
None.
void XAdcPs_EnableUserOverTemp ( XAdcPs InstancePtr  ) 

This function enables programming of the powerdown temperature for the OverTemp signal in the OT Powerdown register.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
None.
Note:
None.
u8 XAdcPs_GetAdcClkDivisor ( XAdcPs InstancePtr  ) 

The function gets the ADCCLK divisor from the Configuration Register 2.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
The divisor read from the Configuration Register 2.
Note:
The ADCCLK is an internal clock used by the ADC and is synchronized to the DCLK clock. The ADCCLK is equal to DCLK divided by the user selection in the Configuration Register 2.
u16 XAdcPs_GetAdcData ( XAdcPs InstancePtr,
u8  Channel 
)

Get the ADC converted data for the specified channel.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Channel is the channel number. Use the XADCPS_CH_* defined in the file xadcps.h. The valid channels are

  • 0 to 6
  • 13 to 31
Returns:
A 16-bit value representing the ADC converted data for the specified channel. The XADC 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.
u16 XAdcPs_GetAlarmEnables ( XAdcPs InstancePtr  ) 

This function gets the status of the alarm output enables in the Configuration Register 1.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
This is the bit-mask of the enabled alarm outputs in the Configuration Register 1. Use the masks XADCPS_CFR1_ALM*_* and XADCPS_CFR1_OT_MASK defined in xadcps_hw.h to interpret the returned value. Bit positions of 1 indicate that the alarm output is enabled. Bit positions of 0 indicate that the alarm output is disabled.
Note:
The implementation of the alarm enables in the Configuration register 1 is such that alarms for the bit positions of 1 will be disabled and alarms for bit positions of 0 will be enabled. The enabled alarm outputs returned by this function is the negated value of the the data read from the Configuration Register 1.
u16 XAdcPs_GetAlarmThreshold ( XAdcPs InstancePtr,
u8  AlarmThrReg 
)

This function returns the contents of the specified Alarm Threshold Register.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
AlarmThrReg is the index of an Alarm Threshold Register to be read. Use XADCPS_ATR_* constants defined in xadcps_hw.h to specify the index.
Returns:
A 16-bit value representing the contents of the selected Alarm Threshold Register.
Note:
None.
u8 XAdcPs_GetAvg ( XAdcPs InstancePtr  ) 

This function returns the number of samples of averaging configured for all the channels in the Configuration Register 0.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
The averaging read from the Configuration Register 0 is returned. Use the XADCPS_AVG_* bit definitions defined in xadcps.h file to interpret the returned value :
  • XADCPS_AVG_0_SAMPLES means no averaging
  • XADCPS_AVG_16_SAMPLES means 16 samples of averaging
  • XADCPS_AVG_64_SAMPLES means 64 samples of averaging
  • XADCPS_AVG_256_SAMPLES means 256 samples of averaging
Note:
None.
u16 XAdcPs_GetCalibCoefficient ( XAdcPs InstancePtr,
u8  CoeffType 
)

This function gets the calibration coefficient data for the specified parameter.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
CoeffType specifies the calibration coefficient to be read. Use XADCPS_CALIB_* constants defined in xadcps.h to specify the calibration coefficient to be read.
Returns:
A 16-bit value representing the calibration coefficient. The XADC 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:
None.
u16 XAdcPs_GetCalibEnables ( XAdcPs InstancePtr  ) 

This function reads the value of the calibration enables from the Configuration Register 1.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
The value of the calibration enables in the Configuration Register 1 :
  • XADCPS_CFR1_CAL_ADC_OFFSET_MASK : ADC offset correction
  • XADCPS_CFR1_CAL_ADC_GAIN_OFFSET_MASK : ADC gain and offset correction
  • XADCPS_CFR1_CAL_PS_OFFSET_MASK : Power Supply sensor offset correction
  • XADCPS_CFR1_CAL_PS_GAIN_OFFSET_MASK : Power Supply sensor gain and offset correction
  • XADCPS_CFR1_CAL_DISABLE_MASK : No Calibration
Note:
None.
u32 XAdcPs_GetConfigRegister ( XAdcPs InstancePtr  ) 

The functions reads the contents of the Config Register.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
A 32-bit value representing the contents of the Config Register. Use the XADCPS_SR_*_MASK constants defined in xadcps_hw.h to interpret the returned value.
Note:
None.
u16 XAdcPs_GetMinMaxMeasurement ( XAdcPs InstancePtr,
u8  MeasurementType 
)

This function reads the Minimum/Maximum measurement for one of the specified parameters. Use XADCPS_MAX_* and XADCPS_MIN_* constants defined in xadcps.h to specify the parameters (Temperature, VccInt, VccAux, VBram, VccPInt, VccPAux and VccPDro).

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
MeasurementType specifies the parameter for which the Minimum/Maximum measurement has to be read. Use XADCPS_MAX_* and XADCPS_MIN_* constants defined in xadcps.h to specify the data to be read.
Returns:
A 16-bit value representing the maximum/minimum measurement for specified parameter. The XADC 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:
None.
u32 XAdcPs_GetMiscCtrlRegister ( XAdcPs InstancePtr  ) 

The functions reads the contents of the Miscellaneous control register.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
A 32-bit value representing the contents of the Config Register. Use the XADCPS_SR_*_MASK constants defined in xadcps_hw.h to interpret the returned value.
Note:
None.
u32 XAdcPs_GetMiscStatus ( XAdcPs InstancePtr  ) 

The functions reads the contents of the Miscellaneous Status Register.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
A 32-bit value representing the contents of the Miscellaneous Status Register. Use the XADCPS_MSTS_*_MASK constants defined in xadcps_hw.h to interpret the returned value.
Note:
None.
u32 XAdcPs_GetPowerdownMode ( XAdcPs InstancePtr  ) 

This function gets the Power Down mode.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
Mode specifies the Power Down Mode
  • XADCPS_PD_MODE_NONE specifies NO Power Down (Both ADC A and ADC B are enabled)
  • XADCPS_PD_MODE_ADCB specfies the Power Down of ADC B
  • XADCPS_PD_MODE_XADC specifies the Power Down of both ADC A and ADC B.
Note:
None.
int XAdcPs_GetSamplingMode ( XAdcPs InstancePtr  ) 

This function returns the sampling mode.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
The sampling mode
  • 0 specifies continuous sampling
  • 1 specifies event driven sampling mode
Note:
None.
u32 XAdcPs_GetSeqAcqTime ( XAdcPs InstancePtr  ) 

This function gets the status of acquisition from the ADC Channel Acquisition Time Sequencer Registers.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
The acquisition time for all the channels. Use XADCPS_SEQ_CH__* defined in xadcps_hw.h to interpret the Channel numbers. Bit masks of 1 are the channels for which acquisition cycles are extended and bit mask of 0 are the channels for which acquisition cycles are not extended.
Note:
None
u32 XAdcPs_GetSeqAvgEnables ( XAdcPs InstancePtr  ) 

This function returns the channels for which the averaging has been enabled in the ADC Channel Averaging Enables Sequencer Registers.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
The status of averaging (enabled/disabled) for all the channels. Use XADCPS_SEQ_CH__* defined in xadcps_hw.h to interpret the Channel numbers. Bit masks of 1 are the channels for which averaging is enabled and bit mask of 0 are the channels for averaging is disabled
Note:
None
u32 XAdcPs_GetSeqChEnables ( XAdcPs InstancePtr  ) 

This function gets the channel enable bits status from the ADC Channel Selection Sequencer Registers.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
Gets the channel enable bits. Use XADCPS_SEQ_CH__* defined in xadcps_hw.h to interpret the Channel numbers. Bit masks of 1 are the channels that are enabled and bit mask of 0 are the channels that are disabled.
None
Note:
None
u32 XAdcPs_GetSeqInputMode ( XAdcPs InstancePtr  ) 

This function gets the Analog input mode for all the channels from the ADC Channel Analog-Input Mode Sequencer Registers.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
The input mode for all the channels. Use XADCPS_SEQ_CH_* defined in xadcps_hw.h to interpret the Channel numbers. Bit masks of 1 are the channels for which input mode is differential and bit mask of 0 are the channels for which input mode is unipolar.
Note:
None.
u8 XAdcPs_GetSequencerMode ( XAdcPs InstancePtr  ) 

This function gets the channel sequencer mode from the Configuration Register 1.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Returns:
The channel sequencer mode :
  • XADCPS_SEQ_MODE_SAFE : Default safe mode
  • XADCPS_SEQ_MODE_ONEPASS : One pass through sequence
  • XADCPS_SEQ_MODE_CONTINPASS : Continuous channel sequencing
  • XADCPS_SEQ_MODE_SINGCHAN : Single channel/Sequencer off
  • XADCPS_SEQ_MODE_SIMUL_SAMPLING : Simulataneous sampling mode
  • XADCPS_SEQ_MODE_INDEPENDENT : Independent mode
Note:
None.
u32 XAdcPs_ReadInternalReg ( XAdcPs InstancePtr,
u32  RegOffset 
)

This function is used for reading from the XADC Registers using the Data FIFO.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
RegOffset is the offset of the XADC register to be read.
Returns:
Data read from the FIFO
Note:
None.
void XAdcPs_Reset ( XAdcPs InstancePtr  ) 

This function resets the XADC Hard Macro in the device.

Parameters:
InstancePtr is a pointer to the Xxadc instance.
Returns:
None.
Note:
None.
void XAdcPs_SetAdcClkDivisor ( XAdcPs InstancePtr,
u8  Divisor 
)

The function sets the frequency of the ADCCLK by configuring the DCLK to ADCCLK ratio in the Configuration Register #2

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Divisor is clock divisor used to derive ADCCLK from DCLK. Valid values of the divisor are

  • 0 to 255. Values 0, 1, 2 are all mapped to 2. Refer to the device specification for more details
Returns:
None.
Note:
- The ADCCLK is an internal clock used by the ADC and is synchronized to the DCLK clock. The ADCCLK is equal to DCLK divided by the user selection in the Configuration Register 2.
  • There is no Assert on the minimum value of the Divisor.
void XAdcPs_SetAlarmEnables ( XAdcPs InstancePtr,
u16  AlmEnableMask 
)

This function enables the alarm outputs for the specified alarms in the Configuration Register 1.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
AlmEnableMask is the bit-mask of the alarm outputs to be enabled in the Configuration Register 1. Bit positions of 1 will be enabled. Bit positions of 0 will be disabled. This mask is formed by OR'ing XADCPS_CFR1_ALM_*_MASK and XADCPS_CFR1_OT_MASK masks defined in xadcps_hw.h.
Returns:
None.
Note:
The implementation of the alarm enables in the Configuration register 1 is such that the alarms for bit positions of 1 will be disabled and alarms for bit positions of 0 will be enabled. The alarm outputs specified by the AlmEnableMask are negated before writing to the Configuration Register 1.
void XAdcPs_SetAlarmThreshold ( XAdcPs InstancePtr,
u8  AlarmThrReg,
u16  Value 
)

This functions sets the contents of the given Alarm Threshold Register.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
AlarmThrReg is the index of an Alarm Threshold Register to be set. Use XADCPS_ATR_* constants defined in xadcps.h to specify the index.
Value is the 16-bit threshold value to write into the register.
Returns:
None.
Note:
Use XAdcPs_SetOverTemp() to set the Over Temperature upper threshold value.
void XAdcPs_SetAvg ( XAdcPs InstancePtr,
u8  Average 
)

This function sets the number of samples of averaging that is to be done for all the channels in both the single channel mode and sequence mode of operations.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Average is the number of samples of averaging programmed to the Configuration Register 0. Use the XADCPS_AVG_* definitions defined in xadcps.h file :

  • XADCPS_AVG_0_SAMPLES for no averaging
  • XADCPS_AVG_16_SAMPLES for 16 samples of averaging
  • XADCPS_AVG_64_SAMPLES for 64 samples of averaging
  • XADCPS_AVG_256_SAMPLES for 256 samples of averaging
Returns:
None.
Note:
None.
void XAdcPs_SetCalibEnables ( XAdcPs InstancePtr,
u16  Calibration 
)

This function enables the specified calibration in the Configuration Register 1 :

  • XADCPS_CFR1_CAL_ADC_OFFSET_MASK : Calibration 0 -ADC offset correction
  • XADCPS_CFR1_CAL_ADC_GAIN_OFFSET_MASK : Calibration 1 -ADC gain and offset correction
  • XADCPS_CFR1_CAL_PS_OFFSET_MASK : Calibration 2 -Power Supply sensor offset correction
  • XADCPS_CFR1_CAL_PS_GAIN_OFFSET_MASK : Calibration 3 -Power Supply sensor gain and offset correction
  • XADCPS_CFR1_CAL_DISABLE_MASK : No Calibration
Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Calibration is the Calibration to be applied. Use XADCPS_CFR1_CAL*_* bits defined in xadcps_hw.h. Multiple calibrations can be enabled at a time by oring the XADCPS_CFR1_CAL_ADC_* and XADCPS_CFR1_CAL_PS_* bits. Calibration can be disabled by specifying XADCPS_CFR1_CAL_DISABLE_MASK;
Returns:
None.
Note:
None.
void XAdcPs_SetConfigRegister ( XAdcPs InstancePtr,
u32  Data 
)

The functions sets the contents of the Config Register.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Data is the 32 bit data to be written to the Register.
Returns:
None.
Note:
None.
void XAdcPs_SetMiscCtrlRegister ( XAdcPs InstancePtr,
u32  Data 
)

The functions sets the contents of the Miscellaneous Control register.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Data is the 32 bit data to be written to the Register.
Returns:
None.
Note:
None.
void XAdcPs_SetMuxMode ( XAdcPs InstancePtr,
int  MuxMode,
u8  Channel 
)

This function sets the External Mux mode.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
MuxMode specifies whether External Mux is used

  • FALSE specifies NO external MUX
  • TRUE specifies External Mux is used
Channel specifies the channel to be used for the external Mux. Please read the Device Spec for which channels are valid for which mode.
Returns:
None.
Note:
There is no Assert in this function for checking the channel number if the external Mux is used. The user should provide a valid channel number.
void XAdcPs_SetPowerdownMode ( XAdcPs InstancePtr,
u32  Mode 
)

This function sets the Power Down mode.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Mode specifies the Power Down Mode

  • XADCPS_PD_MODE_NONE specifies NO Power Down (Both ADC A and ADC B are enabled)
  • XADCPS_PD_MODE_ADCB specfies the Power Down of ADC B
  • XADCPS_PD_MODE_XADC specifies the Power Down of both ADC A and ADC B.
Returns:
None.
Note:
None.
int XAdcPs_SetSeqAcqTime ( XAdcPs InstancePtr,
u32  AcqCyclesChMask 
)

This function sets the number of Acquisition cycles in the ADC Channel Acquisition Time Sequencer Registers. The sequencer must be disabled before writing to these regsiters.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
AcqCyclesChMask is the bit mask of all the channels for which the number of acquisition cycles is to be extended. Use XADCPS_SEQ_CH__* defined in xadcps_hw.h to specify the Channel numbers. Acquisition cycles will be extended to 10 ADCCLK cycles for bit masks of 1 and will be the default 4 ADCCLK cycles for bit masks of 0. The AcqCyclesChMask is a 32 bit mask that is written to the two 16 bit ADC Channel Acquisition Time Sequencer Registers.
Returns:
  • XST_SUCCESS if the given values were written successfully to the Channel Sequencer Registers.
  • XST_FAILURE if the channel sequencer is enabled.
Note:
None.
int XAdcPs_SetSeqAvgEnables ( XAdcPs InstancePtr,
u32  AvgEnableChMask 
)

This function enables the averaging for the specified channels in the ADC Channel Averaging Enable Sequencer Registers. The sequencer must be disabled before writing to these regsiters.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
AvgEnableChMask is the bit mask of all the channels for which averaging is to be enabled. Use XADCPS_SEQ_CH__* defined in xadcps_hw.h to specify the Channel numbers. Averaging will be enabled for bit masks of 1 and disabled for bit mask of 0. The AvgEnableChMask is a 32 bit mask that is written to the two 16 bit ADC Channel Averaging Enable Sequencer Registers.
Returns:
  • XST_SUCCESS if the given values were written successfully to the ADC Channel Averaging Enables Sequencer Registers.
  • XST_FAILURE if the channel sequencer is enabled.
Note:
None
int XAdcPs_SetSeqChEnables ( XAdcPs InstancePtr,
u32  ChEnableMask 
)

This function enables the specified channels in the ADC Channel Selection Sequencer Registers. The sequencer must be disabled before writing to these regsiters.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
ChEnableMask is the bit mask of all the channels to be enabled. Use XADCPS_SEQ_CH__* defined in xadcps_hw.h to specify the Channel numbers. Bit masks of 1 will be enabled and bit mask of 0 will be disabled. The ChEnableMask is a 32 bit mask that is written to the two 16 bit ADC Channel Selection Sequencer Registers.
Returns:
  • XST_SUCCESS if the given values were written successfully to the ADC Channel Selection Sequencer Registers.
  • XST_FAILURE if the channel sequencer is enabled.
Note:
None
int XAdcPs_SetSeqInputMode ( XAdcPs InstancePtr,
u32  InputModeChMask 
)

This function sets the Analog input mode for the specified channels in the ADC Channel Analog-Input Mode Sequencer Registers. The sequencer must be disabled before writing to these regsiters.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
InputModeChMask is the bit mask of all the channels for which the input mode is differential mode. Use XADCPS_SEQ_CH__* defined in xadcps_hw.h to specify the channel numbers. Differential input mode will be set for bit masks of 1 and unipolar input mode for bit masks of 0. The InputModeChMask is a 32 bit mask that is written to the two 16 bit ADC Channel Analog-Input Mode Sequencer Registers.
Returns:
  • XST_SUCCESS if the given values were written successfully to the ADC Channel Analog-Input Mode Sequencer Registers.
  • XST_FAILURE if the channel sequencer is enabled.
Note:
None
void XAdcPs_SetSequencerEvent ( XAdcPs InstancePtr,
int  IsEventMode 
)

The function enables the Event mode or Continuous mode in the sequencer mode.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
IsEventMode is a boolean parameter that specifies continuous sampling (specify FALSE) or event driven sampling mode (specify TRUE) for the given channel.
Returns:
None.
Note:
None.
void XAdcPs_SetSequencerMode ( XAdcPs InstancePtr,
u8  SequencerMode 
)

This function sets the specified Channel Sequencer Mode in the Configuration Register 1 :

  • Default safe mode (XADCPS_SEQ_MODE_SAFE)
  • One pass through sequence (XADCPS_SEQ_MODE_ONEPASS)
  • Continuous channel sequencing (XADCPS_SEQ_MODE_CONTINPASS)
  • Single Channel/Sequencer off (XADCPS_SEQ_MODE_SINGCHAN)
  • Simulataneous sampling mode (XADCPS_SEQ_MODE_SIMUL_SAMPLING)
  • Independent mode (XADCPS_SEQ_MODE_INDEPENDENT)
Parameters:
InstancePtr is a pointer to the XAdcPs instance.
SequencerMode is the sequencer mode to be set. Use XADCPS_SEQ_MODE_* bits defined in xadcps.h.
Returns:
None.
Note:
Only one of the modes can be enabled at a time. Please read the Spec of the XADC for further information about the sequencer modes.
int XAdcPs_SetSingleChParams ( XAdcPs InstancePtr,
u8  Channel,
int  IncreaseAcqCycles,
int  IsEventMode,
int  IsDifferentialMode 
)

The function sets the given parameters in the Configuration Register 0 in the single channel mode.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
Channel is the channel number for the singel channel mode. The valid channels are 0 to 6, 8, and 13 to 31. If the external Mux is used then this specifies the channel oonnected to the external Mux. Please read the Device Spec to know which channels are valid.
IncreaseAcqCycles is a boolean parameter which specifies whether the Acquisition time for the external channels has to be increased to 10 ADCCLK cycles (specify TRUE) or remain at the default 4 ADCCLK cycles (specify FALSE). This parameter is only valid for the external channels.
IsDifferentialMode is a boolean parameter which specifies unipolar(specify FALSE) or differential mode (specify TRUE) for the analog inputs. The input mode is only valid for the external channels.
Returns:
  • XST_SUCCESS if the given values were written successfully to the Configuration Register 0.
  • XST_FAILURE if the channel sequencer is enabled or the input parameters are not valid for the selected channel.
Note:
  • The number of samples for the averaging for all the channels is set by using the function XAdcPs_SetAvg.
  • The calibration of the device is done by doing a ADC conversion on the calibration channel(channel 8). The input parameters IncreaseAcqCycles, IsDifferentialMode and IsEventMode are not valid for this channel
void XAdcPs_WriteInternalReg ( XAdcPs InstancePtr,
u32  RegOffset,
u32  Data 
)

This function is used for writing to XADC Registers using the command FIFO.

Parameters:
InstancePtr is a pointer to the XAdcPs instance.
RegOffset is the offset of the XADC register to be written.
Data is the data to be written.
Returns:
None.
Note:
None.