#include "xil_types.h"
#include "xil_assert.h"
#include "xstatus.h"
#include "xadcps_hw.h"
Classes | |
struct | XAdcPs_Config |
struct | XAdcPs |
Defines | |
#define | XADCPS_H |
#define | XAdcPs_IsEventSamplingModeSet(InstancePtr) |
#define | XAdcPs_IsExternalMuxModeSet(InstancePtr) |
#define | XAdcPs_RawToTemperature(AdcData) ((((float)(AdcData)/65536.0f)/0.00198421639f ) - 273.15f) |
#define | XAdcPs_RawToVoltage(AdcData) ((((float)(AdcData))* (3.0f))/65536.0f) |
#define | XAdcPs_TemperatureToRaw(Temperature) ((int)(((Temperature) + 273.15f)*65536.0f*0.00198421639f)) |
#define | XAdcPs_VoltageToRaw(Voltage) ((int)((Voltage)*65536.0f/3.0f)) |
#define | XAdcPs_WriteFifo(InstancePtr, Data) |
#define | XAdcPs_ReadFifo(InstancePtr) |
Indexes for the different channels. | |
#define | XADCPS_CH_TEMP 0x0 |
#define | XADCPS_CH_VCCINT 0x1 |
#define | XADCPS_CH_VCCAUX 0x2 |
#define | XADCPS_CH_VPVN 0x3 |
#define | XADCPS_CH_VREFP 0x4 |
#define | XADCPS_CH_VREFN 0x5 |
#define | XADCPS_CH_VBRAM 0x6 |
#define | XADCPS_CH_SUPPLY_CALIB 0x07 |
#define | XADCPS_CH_ADC_CALIB 0x08 |
#define | XADCPS_CH_GAINERR_CALIB 0x09 |
#define | XADCPS_CH_VCCPINT 0x0D |
#define | XADCPS_CH_VCCPAUX 0x0E |
#define | XADCPS_CH_VCCPDRO 0x0F |
#define | XADCPS_CH_AUX_MIN 16 |
#define | XADCPS_CH_AUX_MAX 31 |
Indexes for reading the Calibration Coefficient Data. | |
#define | XADCPS_CALIB_SUPPLY_COEFF 0 |
#define | XADCPS_CALIB_ADC_COEFF 1 |
#define | XADCPS_CALIB_GAIN_ERROR_COEFF 2 |
Indexes for reading the Minimum/Maximum Measurement Data. | |
#define | XADCPS_MAX_TEMP 0 |
#define | XADCPS_MAX_VCCINT 1 |
#define | XADCPS_MAX_VCCAUX 2 |
#define | XADCPS_MAX_VBRAM 3 |
#define | XADCPS_MIN_TEMP 4 |
#define | XADCPS_MIN_VCCINT 5 |
#define | XADCPS_MIN_VCCAUX 6 |
#define | XADCPS_MIN_VBRAM 7 |
#define | XADCPS_MAX_VCCPINT 8 |
#define | XADCPS_MAX_VCCPAUX 9 |
#define | XADCPS_MAX_VCCPDRO 0xA |
#define | XADCPS_MIN_VCCPINT 0xC |
#define | XADCPS_MIN_VCCPAUX 0xD |
#define | XADCPS_MIN_VCCPDRO 0xE |
Alarm Threshold(Limit) Register (ATR) indexes. | |
#define | XADCPS_ATR_TEMP_UPPER 0 |
#define | XADCPS_ATR_VCCINT_UPPER 1 |
#define | XADCPS_ATR_VCCAUX_UPPER 2 |
#define | XADCPS_ATR_OT_UPPER 3 |
#define | XADCPS_ATR_TEMP_LOWER 4 |
#define | XADCPS_ATR_VCCINT_LOWER 5 |
#define | XADCPS_ATR_VCCAUX_LOWER 6 |
#define | XADCPS_ATR_OT_LOWER 7 |
#define | XADCPS_ATR_VBRAM_UPPER_ 8 |
#define | XADCPS_ATR_VCCPINT_UPPER 9 |
#define | XADCPS_ATR_VCCPAUX_UPPER 0xA |
#define | XADCPS_ATR_VCCPDRO_UPPER 0xB |
#define | XADCPS_ATR_VBRAM_LOWER 0xC |
#define | XADCPS_ATR_VCCPINT_LOWER 0xD |
#define | XADCPS_ATR_VCCPAUX_LOWER 0xE |
#define | XADCPS_ATR_VCCPDRO_LOWER 0xF |
Averaging to be done for the channels. | |
#define | XADCPS_AVG_0_SAMPLES 0 |
#define | XADCPS_AVG_16_SAMPLES 1 |
#define | XADCPS_AVG_64_SAMPLES 2 |
#define | XADCPS_AVG_256_SAMPLES 3 |
Channel Sequencer Modes of operation | |
#define | XADCPS_SEQ_MODE_SAFE 0 |
#define | XADCPS_SEQ_MODE_ONEPASS 1 |
#define | XADCPS_SEQ_MODE_CONTINPASS 2 |
#define | XADCPS_SEQ_MODE_SINGCHAN 3 |
#define | XADCPS_SEQ_MODE_SIMUL_SAMPLING 4 |
#define | XADCPS_SEQ_MODE_INDEPENDENT 8 |
Power Down Modes | |
#define | XADCPS_PD_MODE_NONE 0 |
#define | XADCPS_PD_MODE_ADCB 1 |
#define | XADCPS_PD_MODE_XADC 2 |
Functions | |
XAdcPs_Config * | XAdcPs_LookupConfig (u16 DeviceId) |
int | XAdcPs_CfgInitialize (XAdcPs *InstancePtr, XAdcPs_Config *ConfigPtr, u32 EffectiveAddr) |
u32 | XAdcPs_GetStatus (XAdcPs *InstancePtr) |
u32 | XAdcPs_GetAlarmOutputStatus (XAdcPs *InstancePtr) |
void | XAdcPs_StartAdcConversion (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) |
int | XAdcPs_SelfTest (XAdcPs *InstancePtr) |
void | XAdcPs_IntrEnable (XAdcPs *InstancePtr, u32 Mask) |
void | XAdcPs_IntrDisable (XAdcPs *InstancePtr, u32 Mask) |
u32 | XAdcPs_IntrGetEnabled (XAdcPs *InstancePtr) |
u32 | XAdcPs_IntrGetStatus (XAdcPs *InstancePtr) |
void | XAdcPs_IntrClear (XAdcPs *InstancePtr, u32 Mask) |
#define XADCPS_ATR_OT_LOWER 7 |
Lower Over Temperature limit
#define XADCPS_ATR_OT_UPPER 3 |
VCCAUX high voltage limit register
#define XADCPS_ATR_TEMP_LOWER 4 |
Upper Over Temperature limit Reg
#define XADCPS_ATR_TEMP_UPPER 0 |
High user Temperature
#define XADCPS_ATR_VBRAM_LOWER 0xC |
VRBAM Lower Alarm Reg, 7 Series
#define XADCPS_ATR_VBRAM_UPPER_ 8 |
VRBAM Upper Alarm Reg, 7 Series
#define XADCPS_ATR_VCCAUX_LOWER 6 |
VCCAUX low voltage limit register
#define XADCPS_ATR_VCCAUX_UPPER 2 |
VCCAUX high voltage limit register
#define XADCPS_ATR_VCCINT_LOWER 5 |
VCCINT high voltage limit register
#define XADCPS_ATR_VCCINT_UPPER 1 |
VCCINT high voltage limit register
#define XADCPS_ATR_VCCPAUX_LOWER 0xE |
VCCPAUX Lower Alarm Reg , Zynq
#define XADCPS_ATR_VCCPAUX_UPPER 0xA |
VCCPAUX Upper Alarm Reg, Zynq
#define XADCPS_ATR_VCCPDRO_LOWER 0xF |
VCCPDRO Lower Alarm Reg , Zynq
#define XADCPS_ATR_VCCPDRO_UPPER 0xB |
VCCPDRO Upper Alarm Reg, Zynq
#define XADCPS_ATR_VCCPINT_LOWER 0xD |
VCCPINT Lower Alarm Reg , Zynq
#define XADCPS_ATR_VCCPINT_UPPER 9 |
VCCPINT Upper Alarm Reg, Zynq
#define XADCPS_AVG_0_SAMPLES 0 |
No Averaging
#define XADCPS_AVG_16_SAMPLES 1 |
Average 16 samples
#define XADCPS_AVG_256_SAMPLES 3 |
Average 256 samples
#define XADCPS_AVG_64_SAMPLES 2 |
Average 64 samples
#define XADCPS_CALIB_ADC_COEFF 1 |
ADC Offset Calib Coefficient
#define XADCPS_CALIB_GAIN_ERROR_COEFF 2 |
Gain Error Calib Coefficient
#define XADCPS_CALIB_SUPPLY_COEFF 0 |
Supply Offset Calib Coefficient
#define XADCPS_CH_ADC_CALIB 0x08 |
ADC Offset Channel Reg
#define XADCPS_CH_AUX_MAX 31 |
Channel number for Last Aux channel
#define XADCPS_CH_AUX_MIN 16 |
Channel number for 1st Aux Channel
#define XADCPS_CH_GAINERR_CALIB 0x09 |
Gain Error Channel Reg
#define XADCPS_CH_SUPPLY_CALIB 0x07 |
Supply Calib Data Reg
#define XADCPS_CH_TEMP 0x0 |
On Chip Temperature
#define XADCPS_CH_VBRAM 0x6 |
On-chip VBRAM Data Reg, 7 series
#define XADCPS_CH_VCCAUX 0x2 |
VCCAUX
#define XADCPS_CH_VCCINT 0x1 |
VCCINT
#define XADCPS_CH_VCCPAUX 0x0E |
On-chip PS VCCPAUX Channel , Zynq
#define XADCPS_CH_VCCPDRO 0x0F |
On-chip PS VCCPDRO Channel , Zynq
#define XADCPS_CH_VCCPINT 0x0D |
On-chip PS VCCPINT Channel , Zynq
#define XADCPS_CH_VPVN 0x3 |
VP/VN Dedicated analog inputs
#define XADCPS_CH_VREFN 0x5 |
VREFN
#define XADCPS_CH_VREFP 0x4 |
VREFP
#define XADCPS_H |
#define XAdcPs_IsEventSamplingModeSet | ( | InstancePtr | ) |
(((XAdcPs_ReadInternalReg(InstancePtr, \ XADCPS_CFR0_OFFSET) & XADCPS_CFR0_EC_MASK) ? \ TRUE : FALSE))
This macro checks if the XADC device is in Event Sampling mode.
InstancePtr | is a pointer to the XAdcPs instance. |
#define XAdcPs_IsExternalMuxModeSet | ( | InstancePtr | ) |
(((XAdcPs_ReadInternalReg(InstancePtr, \ XADCPS_CFR0_OFFSET) & XADCPS_CFR0_MUX_MASK) ? \ TRUE : FALSE))
This macro checks if the XADC device is in External Mux mode.
InstancePtr | is a pointer to the XAdcPs instance. |
#define XADCPS_MAX_TEMP 0 |
Maximum Temperature Data
#define XADCPS_MAX_VBRAM 3 |
Maximum VBRAM Data
#define XADCPS_MAX_VCCAUX 2 |
Maximum VCCAUX Data
#define XADCPS_MAX_VCCINT 1 |
Maximum VCCINT Data
#define XADCPS_MAX_VCCPAUX 9 |
Maximum VCCPAUX Register , Zynq
#define XADCPS_MAX_VCCPDRO 0xA |
Maximum VCCPDRO Register , Zynq
#define XADCPS_MAX_VCCPINT 8 |
Maximum VCCPINT Register , Zynq
#define XADCPS_MIN_TEMP 4 |
Minimum Temperature Data
#define XADCPS_MIN_VBRAM 7 |
Minimum VBRAM Data
#define XADCPS_MIN_VCCAUX 6 |
Minimum VCCAUX Data
#define XADCPS_MIN_VCCINT 5 |
Minimum VCCINT Data
#define XADCPS_MIN_VCCPAUX 0xD |
Minimum VCCPAUX Register , Zynq
#define XADCPS_MIN_VCCPDRO 0xE |
Minimum VCCPDRO Register , Zynq
#define XADCPS_MIN_VCCPINT 0xC |
Minimum VCCPINT Register , Zynq
#define XADCPS_PD_MODE_ADCB 1 |
Power Down ADC B
#define XADCPS_PD_MODE_NONE 0 |
No Power Down
#define XADCPS_PD_MODE_XADC 2 |
Power Down ADC A and ADC B
#define XAdcPs_RawToTemperature | ( | AdcData | ) | ((((float)(AdcData)/65536.0f)/0.00198421639f ) - 273.15f) |
This macro converts XADC Raw Data to Temperature(centigrades).
AdcData | is the Raw ADC Data from XADC. |
#define XAdcPs_RawToVoltage | ( | AdcData | ) | ((((float)(AdcData))* (3.0f))/65536.0f) |
This macro converts XADC/ADC Raw Data to Voltage(volts).
AdcData | is the XADC/ADC Raw Data. |
#define XAdcPs_ReadFifo | ( | InstancePtr | ) |
XAdcPs_ReadReg((InstancePtr)->Config.BaseAddress, \ XADCPS_RDFIFO_OFFSET);
This macro is used for reading from the XADC Registers using the data FIFO.
InstancePtr | is a pointer to the XAdcPs instance. |
#define XADCPS_SEQ_MODE_CONTINPASS 2 |
Continuous Cycling Sequencer
#define XADCPS_SEQ_MODE_INDEPENDENT 8 |
Independent mode
#define XADCPS_SEQ_MODE_ONEPASS 1 |
Onepass through Sequencer
#define XADCPS_SEQ_MODE_SAFE 0 |
Default Safe Mode
#define XADCPS_SEQ_MODE_SIMUL_SAMPLING 4 |
Simultaneous sampling
#define XADCPS_SEQ_MODE_SINGCHAN 3 |
Single channel -No Sequencing
#define XAdcPs_TemperatureToRaw | ( | Temperature | ) | ((int)(((Temperature) + 273.15f)*65536.0f*0.00198421639f)) |
This macro converts Temperature in centigrades to XADC/ADC Raw Data.
Temperature | is the Temperature in centigrades to be converted to XADC/ADC Raw Data. |
#define XAdcPs_VoltageToRaw | ( | Voltage | ) | ((int)((Voltage)*65536.0f/3.0f)) |
This macro converts Voltage in Volts to XADC/ADC Raw Data.
Voltage | is the Voltage in volts to be converted to XADC/ADC Raw Data. |
#define XAdcPs_WriteFifo | ( | InstancePtr, | |||
Data | ) |
XAdcPs_WriteReg((InstancePtr)->Config.BaseAddress, \ XADCPS_CMDFIFO_OFFSET, Data);
This macro is used for writing to the XADC Registers using the command FIFO.
InstancePtr | is a pointer to the XAdcPs instance. |
int XAdcPs_CfgInitialize | ( | XAdcPs * | InstancePtr, | |
XAdcPs_Config * | ConfigPtr, | |||
u32 | EffectiveAddr | |||
) |
Functions in xadcps.c
This function initializes a specific XAdcPs device/instance. This function must be called prior to using the XADC device.
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. |
void XAdcPs_DisableUserOverTemp | ( | XAdcPs * | InstancePtr | ) |
This function disables programming of the powerdown temperature for the OverTemp signal in the OT Powerdown register.
InstancePtr | is a pointer to the XAdcPs instance. |
void XAdcPs_EnableUserOverTemp | ( | XAdcPs * | InstancePtr | ) |
This function enables programming of the powerdown temperature for the OverTemp signal in the OT Powerdown register.
InstancePtr | is a pointer to the XAdcPs instance. |
u8 XAdcPs_GetAdcClkDivisor | ( | XAdcPs * | InstancePtr | ) |
The function gets the ADCCLK divisor from the Configuration Register 2.
InstancePtr | is a pointer to the XAdcPs instance. |
u16 XAdcPs_GetAdcData | ( | XAdcPs * | InstancePtr, | |
u8 | Channel | |||
) |
Get the ADC converted data for the specified channel.
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
|
u16 XAdcPs_GetAlarmEnables | ( | XAdcPs * | InstancePtr | ) |
This function gets the status of the alarm output enables in the Configuration Register 1.
InstancePtr | is a pointer to the XAdcPs instance. |
u32 XAdcPs_GetAlarmOutputStatus | ( | XAdcPs * | InstancePtr | ) |
u16 XAdcPs_GetAlarmThreshold | ( | XAdcPs * | InstancePtr, | |
u8 | AlarmThrReg | |||
) |
This function returns the contents of the specified Alarm Threshold Register.
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. |
u8 XAdcPs_GetAvg | ( | XAdcPs * | InstancePtr | ) |
This function returns the number of samples of averaging configured for all the channels in the Configuration Register 0.
InstancePtr | is a pointer to the XAdcPs instance. |
u16 XAdcPs_GetCalibCoefficient | ( | XAdcPs * | InstancePtr, | |
u8 | CoeffType | |||
) |
This function gets the calibration coefficient data for the specified parameter.
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. |
u16 XAdcPs_GetCalibEnables | ( | XAdcPs * | InstancePtr | ) |
This function reads the value of the calibration enables from the Configuration Register 1.
InstancePtr | is a pointer to the XAdcPs instance. |
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).
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. |
u32 XAdcPs_GetPowerdownMode | ( | XAdcPs * | InstancePtr | ) |
This function gets the Power Down mode.
InstancePtr | is a pointer to the XAdcPs instance. |
int XAdcPs_GetSamplingMode | ( | XAdcPs * | InstancePtr | ) |
This function returns the sampling mode.
InstancePtr | is a pointer to the XAdcPs instance. |
u32 XAdcPs_GetSeqAcqTime | ( | XAdcPs * | InstancePtr | ) |
This function gets the status of acquisition from the ADC Channel Acquisition Time Sequencer Registers.
InstancePtr | is a pointer to the XAdcPs instance. |
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.
InstancePtr | is a pointer to the XAdcPs instance. |
u32 XAdcPs_GetSeqChEnables | ( | XAdcPs * | InstancePtr | ) |
This function gets the channel enable bits status from the ADC Channel Selection Sequencer Registers.
InstancePtr | is a pointer to the XAdcPs instance. |
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.
InstancePtr | is a pointer to the XAdcPs instance. |
u8 XAdcPs_GetSequencerMode | ( | XAdcPs * | InstancePtr | ) |
This function gets the channel sequencer mode from the Configuration Register 1.
InstancePtr | is a pointer to the XAdcPs instance. |
u32 XAdcPs_GetStatus | ( | XAdcPs * | InstancePtr | ) |
void XAdcPs_IntrClear | ( | XAdcPs * | InstancePtr, | |
u32 | Mask | |||
) |
This function clears the specified interrupts in the Interrupt Status Register (IPISR).
InstancePtr | is a pointer to the XAdcPs instance. | |
Mask | is the bit-mask of the interrupts to be cleared. Bit positions of 1 will be cleared. Bit positions of 0 will not change the previous interrupt status. This mask is formed by OR'ing XADCPS_IPIXR_* bits which are defined in xadcps_hw.h. |
void XAdcPs_IntrDisable | ( | XAdcPs * | InstancePtr, | |
u32 | Mask | |||
) |
This function disables the specified interrupts in the device.
InstancePtr | is a pointer to the XAdcPs instance. | |
Mask | is the bit-mask of the interrupts to be disabled. Bit positions of 1 will be disabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XADCPS_INTX_* bits defined in xadcps_hw.h. |
void XAdcPs_IntrEnable | ( | XAdcPs * | InstancePtr, | |
u32 | Mask | |||
) |
Functions in xadcps_intr.c
This function enables the specified interrupts in the device.
InstancePtr | is a pointer to the XAdcPs instance. | |
Mask | is the bit-mask of the interrupts to be enabled. Bit positions of 1 will be enabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XADCPS_INTX_* bits defined in xadcps_hw.h. |
u32 XAdcPs_IntrGetEnabled | ( | XAdcPs * | InstancePtr | ) |
This function returns the enabled interrupts read from the Interrupt Mask Register (IPIER). Use the XADCPS_IPIXR_* constants defined in xadcps_hw.h to interpret the returned value.
InstancePtr | is a pointer to the XAdcPs instance. |
u32 XAdcPs_IntrGetStatus | ( | XAdcPs * | InstancePtr | ) |
This function returns the interrupt status read from Interrupt Status Register(IPISR). Use the XADCPS_IPIXR_* constants defined in xadcps_hw.h to interpret the returned value.
InstancePtr | is a pointer to the XAdcPs instance. |
XAdcPs_Config* XAdcPs_LookupConfig | ( | u16 | DeviceId | ) |
Functions in xadcps_sinit.c
This function looks up the device configuration based on the unique device ID. The table XAdcPs_ConfigTable contains the configuration info for each device in the system.
DeviceId | contains the ID of the device for which the device configuration pointer is to be returned. |
void XAdcPs_Reset | ( | XAdcPs * | InstancePtr | ) |
This function resets the XADC Hard Macro in the device.
InstancePtr | is a pointer to the Xxadc instance. |
int XAdcPs_SelfTest | ( | XAdcPs * | InstancePtr | ) |
Functions in xadcps_selftest.c
Run a self-test on the driver/device. The test
InstancePtr | is a pointer to the XAdcPs instance. |
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
InstancePtr | is a pointer to the XAdcPs instance. | |
Divisor | is clock divisor used to derive ADCCLK from DCLK. Valid values of the divisor are
|
void XAdcPs_SetAlarmEnables | ( | XAdcPs * | InstancePtr, | |
u16 | AlmEnableMask | |||
) |
This function enables the alarm outputs for the specified alarms in the Configuration Register 1.
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. |
void XAdcPs_SetAlarmThreshold | ( | XAdcPs * | InstancePtr, | |
u8 | AlarmThrReg, | |||
u16 | Value | |||
) |
This functions sets the contents of the given Alarm Threshold Register.
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. |
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.
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 :
|
void XAdcPs_SetCalibEnables | ( | XAdcPs * | InstancePtr, | |
u16 | Calibration | |||
) |
This function enables the specified calibration in the Configuration Register 1 :
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; |
void XAdcPs_SetMuxMode | ( | XAdcPs * | InstancePtr, | |
int | MuxMode, | |||
u8 | Channel | |||
) |
This function sets the External Mux mode.
InstancePtr | is a pointer to the XAdcPs instance. | |
MuxMode | specifies whether 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. |
void XAdcPs_SetPowerdownMode | ( | XAdcPs * | InstancePtr, | |
u32 | Mode | |||
) |
This function sets the Power Down mode.
InstancePtr | is a pointer to the XAdcPs instance. | |
Mode | specifies the Power Down Mode
|
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.
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. |
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.
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. |
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.
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. |
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.
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. |
void XAdcPs_SetSequencerEvent | ( | XAdcPs * | InstancePtr, | |
int | IsEventMode | |||
) |
The function enables the Event mode or Continuous mode in the sequencer mode.
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. |
void XAdcPs_SetSequencerMode | ( | XAdcPs * | InstancePtr, | |
u8 | SequencerMode | |||
) |
This function sets the specified Channel Sequencer Mode in the Configuration Register 1 :
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. |
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.
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. |
void XAdcPs_StartAdcConversion | ( | XAdcPs * | InstancePtr | ) |
Copyright © 1995-2014 Xilinx, Inc. All rights reserved.