sysmonpsu: xsysmonpsu.c File Reference

| sysmonpsu Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xsysmonpsu.c File Reference

## Functions
s32 | XSysMonPsu_CfgInitialize (XSysMonPsu *InstancePtr, XSysMonPsu_Config *ConfigPtr, u32 EffectiveAddr)
| This function initializes XSysMonPsu device/instance. More...
void | XSysMonPsu_Reset (XSysMonPsu *InstancePtr)
| This function resets the SystemMonitor. More...
u32 | XSysMonPsu_GetStatus (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| This function reads the contents of the Status Register. More...
void | XSysMonPsu_StartAdcConversion (XSysMonPsu *InstancePtr)
| This function starts the ADC conversion in the Single Channel event driven sampling mode. More...
u16 | XSysMonPsu_GetAdcData (XSysMonPsu *InstancePtr, u8 Channel, u32 Block)
| Get the ADC converted data for the specified channel. More...
u16 | XSysMonPsu_GetCalibCoefficient (XSysMonPsu *InstancePtr, u8 CoeffType, u32 SysmonBlk)
| This function gets the calibration coefficient data for the specified parameter. More...
u16 | XSysMonPsu_GetMinMaxMeasurement (XSysMonPsu *InstancePtr, u8 MeasurementType, u32 SysmonBlk)
| This function reads the Minimum/Maximum measurement for one of the XSM_MIN_* or XSM_MAX_* constants defined in xsysmonpsu.h. More...
void | XSysMonPsu_SetAvg (XSysMonPsu *InstancePtr, u8 Average, u32 SysmonBlk)
| 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. More...
u8 | XSysMonPsu_GetAvg (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| This function returns the number of samples of averaging configured for all the channels in the Configuration Register 0. More...
s32 | XSysMonPsu_SetSingleChParams (XSysMonPsu *InstancePtr, u8 Channel, u32 IncreaseAcqCycles, u32 IsEventMode, u32 IsDifferentialMode, u32 SysmonBlk)
| The function sets the given parameters in the Configuration Register 0 in the single channel mode. More...
void | XSysMonPsu_SetAlarmEnables (XSysMonPsu *InstancePtr, u32 AlmEnableMask, u32 SysmonBlk)
| This function enables the alarm outputs for the specified alarms in the Configuration Registers 1: More...
u32 | XSysMonPsu_GetAlarmEnables (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| This function gets the status of the alarm output enables in the Configuration Register 1. More...
void | XSysMonPsu_SetSequencerMode (XSysMonPsu *InstancePtr, u8 SequencerMode, u32 SysmonBlk)
| This function sets the specified Channel Sequencer Mode in the Configuration Register 1 : More...
u8 | XSysMonPsu_GetSequencerMode (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| This function gets the channel sequencer mode from the Configuration Register 1. More...
void | XSysMonPsu_SetSequencerEvent (XSysMonPsu *InstancePtr, u32 IsEventMode, u32 SysmonBlk)
| The function enables the Event mode or Continuous mode in the sequencer mode. More...
s32 | XSysMonPsu_GetSequencerEvent (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| The function returns the mode of the sequencer. More...
void | XSysMonPsu_SetExtenalMux (XSysMonPsu *InstancePtr, u8 Channel, u32 SysmonBlk)
| The function enables the external mux and connects a channel to the mux. More...
u32 | XSysMonPsu_GetExtenalMux (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| The function returns the external mux channel. More...
void | XSysMonPsu_SetAdcClkDivisor (XSysMonPsu *InstancePtr, u8 Divisor, u32 SysmonBlk)
| The function sets the frequency of the ADCCLK by configuring the DCLK to ADCCLK ratio in the Configuration Register #2. More...
u8 | XSysMonPsu_GetAdcClkDivisor (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| The function gets the ADCCLK divisor from the Configuration Register 2. More...
u8 | XSysMonPsu_UpdateAdcClkDivisor (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| The function update the ADCCLK divisor to the Configuration Register 2. More...
s32 | XSysMonPsu_SetSeqChEnables (XSysMonPsu *InstancePtr, u64 ChEnableMask, u32 SysmonBlk)
| This function enables the specified channels in the ADC Channel Selection Sequencer Registers. More...
u64 | XSysMonPsu_GetSeqChEnables (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| This function gets the channel enable bits status from the ADC Channel Selection Sequencer Registers. More...
s32 | XSysMonPsu_SetSeqAvgEnables (XSysMonPsu *InstancePtr, u64 AvgEnableChMask, u32 SysmonBlk)
| This function enables the averaging for the specified channels in the ADC Channel Averaging Enable Sequencer Registers. More...
u64 | XSysMonPsu_GetSeqAvgEnables (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| This function returns the channels for which the averaging has been enabled in the ADC Channel Averaging Enables Sequencer Registers. More...
s32 | XSysMonPsu_SetSeqInputMode (XSysMonPsu *InstancePtr, u64 InputModeChMask, u32 SysmonBlk)
| This function sets the Analog input mode for the specified channels in the ADC Channel Analog-Input Mode Sequencer Registers. More...
u64 | XSysMonPsu_GetSeqInputMode (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| This function gets the Analog input mode for all the channels from the ADC Channel Analog-Input Mode Sequencer Registers. More...
s32 | XSysMonPsu_SetSeqAcqTime (XSysMonPsu *InstancePtr, u64 AcqCyclesChMask, u32 SysmonBlk)
| This function sets the number of Acquisition cycles in the ADC Channel Acquisition Time Sequencer Registers. More...
u64 | XSysMonPsu_GetSeqAcqTime (XSysMonPsu *InstancePtr, u32 SysmonBlk)
| This function gets the status of acquisition time from the ADC Channel Acquisition Time Sequencer Registers. More...
void | XSysMonPsu_SetAlarmThreshold (XSysMonPsu *InstancePtr, u8 AlarmThrReg, u16 Value, u32 SysmonBlk)
| This functions sets the contents of the given Alarm Threshold Register. More...
u16 | XSysMonPsu_GetAlarmThreshold (XSysMonPsu *InstancePtr, u8 AlarmThrReg, u32 SysmonBlk)
| This function returns the contents of the specified Alarm Threshold Register. More...
void | XSysMonPsu_SetPSAutoConversion (XSysMonPsu *InstancePtr)
| This function sets the conversion to be automatic for PS SysMon. More...
u32 | XSysMonPsu_GetMonitorStatus (XSysMonPsu *InstancePtr)
| This function gets the AMS monitor status. More...
void | XSysMonPsu_InitInstance (XSysMonPsu *InstancePtr, XSysMonPsu_Config *ConfigPtr)
| This function initializes XSysMonPsu device/instance. More...

## Function Documentation

s32 XSysMonPsu_CfgInitialize | ( | XSysMonPsu * | InstancePtr,
|  | XSysMonPsu_Config * | ConfigPtr,
|  | u32 | EffectiveAddr
| ) |  |

This function initializes XSysMonPsu device/instance.

This function must be called prior to using the System Monitor device.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  ConfigPtr | points to the XSysMonPsu 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 XSysMonPsu_LookupConfig() API which returns the Configuration structure pointer which is passed as a parameter to the XSysMonPsu_CfgInitialize() API.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu_Config::DeviceId, XSysMonPsu_Config::InputClockMHz, XSysMonPsu::IsPlAccessibleByPs, XSysMonPsu::IsReady, XSysMonPsu_IntrClear(), XSysMonPsu_IntrGetStatus(), XSYSMONPSU_PL_SYSMON_CSTS_OFFSET, XSYSMONPSU_PS_SYSMON_CSTS_OFFSET, XSysmonPsu_ReadReg, XSysMonPsu_Reset(), and XSysMonPsu_UpdateAdcClkDivisor().

Referenced by SysMonPsuAMSExample(), SysMonPsuIntrExample(), SysMonPsuPolledPrintfExample(), and SysMonPsuSingleChannelIntrExample().

u8 XSysMonPsu_GetAdcClkDivisor | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XSysMon instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_CFG_REG2_OFFSET, and XSysmonPsu_ReadReg.

u16 XSysMonPsu_GetAdcData | ( | XSysMonPsu * | InstancePtr,
|  | u8 | Channel,
|  | u32 | Block
| ) |  |

Get the ADC converted data for the specified channel.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  Channel | is the channel number. Use the XSM_CH_* defined in the file xsysmonpsu.h. The valid channels for PS / PL SysMon are 0 - 6, 8 - 10 and 13 - 37. For AMS, 38 - 53 channels are valid.
  Block | is the value that tells whether it is for PS Sysmon block or PL Sysmon block or the AMS controller register region.

Returns
  A 16-bit value representing the ADC converted data for the specified channel. The System Monitor 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
  Please make sure that the proper channel number is passed.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_CH_AUX_MAX, XSM_CH_GAINERR_CALIB, XSM_CH_RESERVE1, XSM_CH_SUPPLY3, XSM_CH_SUPPLY4, XSM_CH_SUPPLY7, XSM_CH_SUPPLY_CALIB, XSM_CH_TEMP_REMTE, XSM_CH_VCC_PSLL0, and XSysmonPsu_ReadReg.

Referenced by SysMonPsuAMSExample(), SysMonPsuIntrExample(), SysMonPsuPolledPrintfExample(), and SysMonPsuSingleChannelIntrExample().

u32 XSysMonPsu_GetAlarmEnables | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  This is the bit-mask of the enabled alarm outputs in the Configuration Register 1. Use the masks XSYSMONPSU_CFG_REG1_ALRM_*_MASK masks defined in xsysmonpsu.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. Upper 16 bits of return value are valid only if the channel selected is PS.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_CFG_REG1_OFFSET, and XSysmonPsu_ReadReg.

u16 XSysMonPsu_GetAlarmThreshold | ( | XSysMonPsu * | InstancePtr,
|  | u8 | AlarmThrReg,
|  | u32 | SysmonBlk
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  AlarmThrReg | is the index of an Alarm Threshold Register to be read. Use XSM_ATR_* constants defined in xsysmonpsu.h to specify the index.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  A 16-bit value representing the contents of the selected Alarm Threshold Register.

Note
  None.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_ATR_SUP7_LOWER, XSM_ATR_TEMP_RMTE_LOWER, XSM_ATR_TEMP_RMTE_UPPER, XSYSMONPSU_ALRM_TEMP_UPR_OFFSET, and XSysmonPsu_ReadReg.

Referenced by SysMonPsuIntrExample(), and XSysMonPsu_SelfTest().

u8 XSysMonPsu_GetAvg | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

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 XSysMonPsu instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_CFG_REG0_OFFSET, and XSysmonPsu_ReadReg.

u16 XSysMonPsu_GetCalibCoefficient | ( | XSysMonPsu * | InstancePtr,
|  | u8 | CoeffType,
|  | u32 | SysmonBlk
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  CoeffType | specifies the calibration coefficient to be read. Use XSM_CALIB_* constants defined in xsysmonpsu.h to specify the calibration coefficient to be read.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  A 16-bit value representing the calibration coefficient. The System Monitor 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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_CALIB_GAIN_ERROR_COEFF, XSYSMONPSU_CAL_SUP_OFF_OFFSET, and XSysmonPsu_ReadReg.

u32 XSysMonPsu_GetExtenalMux | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

The function returns the external mux channel.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  Returns the channel number used to connect to the external Mux. The valid channels are 0 to 6, 8 to 16, and 31 to 36..

Note
  None.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_CFG_REG0_OFFSET, and XSysmonPsu_ReadReg.

u16 XSysMonPsu_GetMinMaxMeasurement | ( | XSysMonPsu * | InstancePtr,
|  | u8 | MeasurementType,
|  | u32 | SysmonBlk
| ) |  |

This function reads the Minimum/Maximum measurement for one of the XSM_MIN_* or XSM_MAX_* constants defined in xsysmonpsu.h.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  MeasurementType | specifies the parameter for which the Minimum/Maximum measurement has to be read. Use XSM_MAX_* and XSM_MIN_* constants defined in xsysmonpsu.h to specify the data to be read.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  A 16-bit value representing the maximum/minimum measurement for specified parameter. The System Monitor device guarantees a 10 bit resolution for the ADC converted data and data is the 10 MSB bits of 16 bit data read from the device.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_MAX_SUPPLY6, XSM_MAX_SUPPLY7, XSM_MAX_TEMP_REMOTE, XSM_MIN_SUPPLY4, XSM_MIN_SUPPLY6, XSM_MIN_SUPPLY7, XSM_MIN_TEMP_REMOTE, and XSysmonPsu_ReadReg.

Referenced by SysMonPsuIntrExample(), and SysMonPsuPolledPrintfExample().

u32 XSysMonPsu_GetMonitorStatus | ( | XSysMonPsu * | InstancePtr | ) |

This function gets the AMS monitor status.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.

Returns
  Returns the monitor status. See XSYSMONPSU_MON_STS_*_MASK definations present in xsysmonpsu_hw.h for knowing the status.

Note
  None

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_MON_STS_OFFSET, and XSysmonPsu_ReadReg.

u64 XSysMonPsu_GetSeqAcqTime | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  The acquisition time for all the channels. Use XSYSMONPSU_SEQ_ACQ* defined in xsysmonpsu_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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSysmonPsu_ReadReg, XSYSMONPSU_SEQ_ACQ0_OFFSET, XSYSMONPSU_SEQ_ACQ1_OFFSET, and XSYSMONPSU_SEQ_ACQ2_OFFSET.

u64 XSysMonPsu_GetSeqAvgEnables | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

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 XSysMonPsu instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  The status of averaging (enabled/disabled) for all the channels. Use XSYSMONPSU_SEQ_AVERAGE* defined in xsysmonpsu_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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSysmonPsu_ReadReg, XSYSMONPSU_SEQ_AVERAGE0_OFFSET, and XSYSMONPSU_SEQ_AVERAGE1_OFFSET.

u64 XSysMonPsu_GetSeqChEnables | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  Gets the channel enable bits. Use XSYSMONPSU_SEQ_CH* defined in xsysmonpsu_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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSysmonPsu_ReadReg, XSYSMONPSU_SEQ_CH0_OFFSET, and XSYSMONPSU_SEQ_CH1_OFFSET.

u64 XSysMonPsu_GetSeqInputMode | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

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 XSysMonPsu instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  The input mode for all the channels. Use XSYSMONPSU_SEQ_INPUT_MDE* defined in xsysmonpsu_hw.h to interpret the Channel numbers. Bit masks of 1 are the channels for which input mode is differential/Bipolar and bit mask of 0 are the channels for which input mode is unipolar.

Note
  None.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSysmonPsu_ReadReg, XSYSMONPSU_SEQ_INPUT_MDE0_OFFSET, and XSYSMONPSU_SEQ_INPUT_MDE1_OFFSET.

s32 XSysMonPsu_GetSequencerEvent | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

The function returns the mode of the sequencer.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  Returns the Sequencer mode. XSYSMONPSU_EVENT_MODE for Event mode and XSYSMONPSU_CONTINUOUS_MODE for continuous mode.

Note
  None.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_CFG_REG0_OFFSET, and XSysmonPsu_ReadReg.

u8 XSysMonPsu_GetSequencerMode | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  The channel sequencer mode :
  - XSM_SEQ_MODE_SAFE : Default safe mode
  - XSM_SEQ_MODE_ONEPASS : One pass through sequence
  - XSM_SEQ_MODE_CONTINPASS : Continuous channel sequencing
  - XSM_SEQ_MODE_SINGCHAN : Single channel/Sequencer off
  - XSM_SEQ_MODE_OLYMPUS : Olympus sampling mode

Note
  None.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_CFG_REG1_OFFSET, and XSysmonPsu_ReadReg.

Referenced by XSysMonPsu_SetSeqAcqTime(), XSysMonPsu_SetSeqAvgEnables(), XSysMonPsu_SetSeqChEnables(), XSysMonPsu_SetSeqInputMode(), and XSysMonPsu_SetSingleChParams().

u32 XSysMonPsu_GetStatus | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

This function reads the contents of the Status Register.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  A 32-bit value representing the contents of the Status Register. Use the XSYSMONPSU_MON_STS_* constants defined in xsysmonpsu_hw.h to interpret the returned value.

Note
  None.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_MON_STS_OFFSET, and XSysmonPsu_ReadReg.

void XSysMonPsu_InitInstance | ( | XSysMonPsu * | InstancePtr,
|  | XSysMonPsu_Config * | ConfigPtr
| ) |  |

This function initializes XSysMonPsu device/instance.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  ConfigPtr | points to the XSysMonPsu device configuration structure.

Returns
  None

Note
  The user needs to first call the XSysMonPsu_LookupConfig() API which returns the Configuration structure pointer, this pointer is then passed as a parameter to the XSysMonPsu_InitInstance() API. Note that this function just initializes the instance and doesn't configure the System Monitor device.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu_Config::DeviceId, and XSysMonPsu::IsReady.

void XSysMonPsu_Reset | ( | XSysMonPsu * | InstancePtr | ) |

This function resets the SystemMonitor.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.

Returns
  None.

Note
  Upon reset, all Maximum and Minimum status registers will be reset to their default values. Currently running and any averaging will restart. Refer to the device data sheet for the device status and register values after the reset.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysmonPsu_ReadReg, XSYSMONPSU_VP_VN_OFFSET, and XSysmonPsu_WriteReg.

Referenced by XSysMonPsu_CfgInitialize(), and XSysMonPsu_SelfTest().

void XSysMonPsu_SetAdcClkDivisor | ( | XSysMonPsu * | InstancePtr,
|  | u8 | Divisor,
|  | u32 | SysmonBlk
| ) |  |

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 XSysMonPsu instance.
  Divisor | is clock divisor used to derive ADCCLK from DCLK. Valid values of the divisor are PS: 0 means divide by 8. 1,2 means divide by 2. 3 to 255 means divide by that value. PL: 0,1,2 means divide by 2. 3 to 255 means divide by that value. Refer to the device specification for more details.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_CFG_REG2_OFFSET, XSysmonPsu_ReadReg, and XSysmonPsu_WriteReg.

void XSysMonPsu_SetAlarmEnables | ( | XSysMonPsu * | InstancePtr,
|  | u32 | AlmEnableMask,
|  | u32 | SysmonBlk
| ) |  |

This function enables the alarm outputs for the specified alarms in the Configuration Registers 1:

        - OT for Over Temperature (XSYSMONPSU_CFR_REG1_ALRM_OT_MASK)
        - ALM0 for On board Temperature (XSYSMONPSU_CFR_REG1_ALRM_TEMP_MASK)
        - ALM1 for SUPPLY1 (XSYSMONPSU_CFR_REG1_ALRM_SUPPLY1_MASK)
        - ALM2 for SUPPLY2 (XSYSMONPSU_CFR_REG1_ALRM_SUPPLY2_MASK)
                - ALM3 for SUPPLY3 (XSYSMONPSU_CFR_REG1_ALRM_SUPPLY3_MASK)
                - ALM4 for SUPPLY4 (XSYSMONPSU_CFR_REG1_ALRM__SUPPLY4_MASK)
        - ALM5 for SUPPLY5 (XSYSMONPSU_CFR_REG1_ALRM_SUPPLY5_MASK)
                - ALM6 for SUPPLY6 (XSYSMONPSU_CFR_REG1_ALRM_SUPPLY6_MASK)

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  AlmEnableMask | is the bit-mask of the alarm outputs to be enabled in the Configuration Registers 1 and 3. Bit positions of 1 will be enabled. Bit positions of 0 will be disabled. This mask is formed by OR'ing XSYSMONPSU_CFR_REG1_ALRM_*_MASK masks defined in xsysmonpsu.h, but XSM_CFR_ALM_SUPPLY8_MASK to XSM_CFR_ALM_SUPPLY13_MASK are applicable only for PS.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  None.

Note
  The implementation of the alarm enables in the Configuration register 1 is such that the alarms for bit positions of 0 will be enabled and alarms for bit positions of 1 will be disabled. The alarm outputs specified by the AlmEnableMask are negated before writing to the Configuration Register 1 because it was Disable register bits. Upper 16 bits of AlmEnableMask are applicable only for PS.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_CFG_REG1_OFFSET, XSysmonPsu_ReadReg, and XSysmonPsu_WriteReg.

Referenced by SysMonPsuIntrExample(), SysMonPsuPolledPrintfExample(), and SysMonPsuSingleChannelIntrExample().

void XSysMonPsu_SetAlarmThreshold | ( | XSysMonPsu * | InstancePtr,
|  | u8 | AlarmThrReg,
|  | u16 | Value,
|  | u32 | SysmonBlk
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  AlarmThrReg | is the index of an Alarm Threshold Register to be set. Use XSM_ATR_* constants defined in xsysmonpsu.h to specify the index.
  Value | is the 16-bit threshold value to write into the register.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  None.

Note
  None.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_ATR_SUP7_LOWER, XSM_ATR_TEMP_RMTE_LOWER, XSM_ATR_TEMP_RMTE_UPPER, XSYSMONPSU_ALRM_TEMP_UPR_OFFSET, and XSysmonPsu_WriteReg.

Referenced by SysMonPsuIntrExample(), SysMonPsuSingleChannelIntrExample(), and XSysMonPsu_SelfTest().

void XSysMonPsu_SetAvg | ( | XSysMonPsu * | InstancePtr,
|  | u8 | Average,
|  | u32 | SysmonBlk
| ) |  |

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 XSysMonPsu instance.
  Average | is the number of samples of averaging programmed to the Configuration Register 0. Use the XSM_AVG_* definitions defined in xsysmonpsu.h file : XSM_AVG_0_SAMPLES for no averaging XSM_AVG_16_SAMPLES for 16 samples of averaging XSM_AVG_64_SAMPLES for 64 samples of averaging XSM_AVG_256_SAMPLES for 256 samples of averaging
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  None.

Note
  None.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_AVG_256_SAMPLES, XSYSMONPSU_CFG_REG0_OFFSET, XSysmonPsu_ReadReg, and XSysmonPsu_WriteReg.

Referenced by SysMonPsuIntrExample(), and SysMonPsuPolledPrintfExample().

void XSysMonPsu_SetExtenalMux | ( | XSysMonPsu * | InstancePtr,
|  | u8 | Channel,
|  | u32 | SysmonBlk
| ) |  |

The function enables the external mux and connects a channel to the mux.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  Channel | is the channel number used to connect to the external Mux. The valid channels are 0 to 5 and 16 to 31.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

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
  None.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_CH_AUX_MAX, XSM_CH_AUX_MIN, XSM_CH_VREFN, XSYSMONPSU_CFG_REG0_OFFSET, XSysmonPsu_ReadReg, and XSysmonPsu_WriteReg.

void XSysMonPsu_SetPSAutoConversion | ( | XSysMonPsu * | InstancePtr | ) |

This function sets the conversion to be automatic for PS SysMon.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.

Returns
  None

Note
  In the auto-trigger mode, sample rate is of 1 Million samples.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_PS_SYSMON_CSTS_OFFSET, XSysmonPsu_ReadReg, and XSysmonPsu_WriteReg.

s32 XSysMonPsu_SetSeqAcqTime | ( | XSysMonPsu * | InstancePtr,
|  | u64 | AcqCyclesChMask,
|  | u32 | SysmonBlk
| ) |  |

This function sets the number of Acquisition cycles in the ADC Channel Acquisition Time Sequencer Registers.

The sequencer must be in the Safe Mode before writing to these registers.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  AcqCyclesChMask | is the bit mask of all the channels for which the number of acquisition cycles is to be extended. Use XSYSMONPSU_SEQ_ACQ* defined in xsysmonpsu_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 64 bit mask that is written to the three 16 bit ADC Channel Acquisition Time Sequencer Registers.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_SEQ_MODE_SAFE, XSysMonPsu_GetSequencerMode(), XSYSMONPSU_SEQ_ACQ0_OFFSET, XSYSMONPSU_SEQ_ACQ1_OFFSET, XSYSMONPSU_SEQ_ACQ2_OFFSET, and XSysmonPsu_WriteReg.

Referenced by SysMonPsuIntrExample(), and SysMonPsuPolledPrintfExample().

s32 XSysMonPsu_SetSeqAvgEnables | ( | XSysMonPsu * | InstancePtr,
|  | u64 | AvgEnableChMask,
|  | u32 | SysmonBlk
| ) |  |

This function enables the averaging for the specified channels in the ADC Channel Averaging Enable Sequencer Registers.

The sequencer must be in the Safe Mode before writing to these registers.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  AvgEnableChMask | is the bit mask of all the channels for which averaging is to be enabled. Use XSYSMONPSU_SEQ_AVERAGE* defined in xsysmonpsu_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 64 bit mask that is written to the three 16 bit ADC Channel Averaging Enable Sequencer Registers.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_SEQ_MODE_SAFE, XSysMonPsu_GetSequencerMode(), XSYSMONPSU_SEQ_AVERAGE0_OFFSET, XSYSMONPSU_SEQ_AVERAGE1_OFFSET, and XSysmonPsu_WriteReg.

Referenced by SysMonPsuIntrExample(), and SysMonPsuPolledPrintfExample().

s32 XSysMonPsu_SetSeqChEnables | ( | XSysMonPsu * | InstancePtr,
|  | u64 | ChEnableMask,
|  | u32 | SysmonBlk
| ) |  |

This function enables the specified channels in the ADC Channel Selection Sequencer Registers.

The sequencer must be in the Safe Mode before writing to these registers.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  ChEnableMask | is the bit mask of all the channels to be enabled. Use XSYSMONPSU_SEQ_CH* defined in xsysmon_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 64 bit mask that is written to the three 16 bit ADC Channel Selection Sequencer Registers.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_SEQ_MODE_SAFE, XSysMonPsu_GetSequencerMode(), XSYSMONPSU_SEQ_CH0_OFFSET, XSYSMONPSU_SEQ_CH1_OFFSET, and XSysmonPsu_WriteReg.

Referenced by SysMonPsuIntrExample(), and SysMonPsuPolledPrintfExample().

s32 XSysMonPsu_SetSeqInputMode | ( | XSysMonPsu * | InstancePtr,
|  | u64 | InputModeChMask,
|  | u32 | SysmonBlk
| ) |  |

This function sets the Analog input mode for the specified channels in the ADC Channel Analog-Input Mode Sequencer Registers.

The sequencer must be in the Safe Mode before writing to these registers.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  InputModeChMask | is the bit mask of all the channels for which the input mode is differential mode. Use XSYSMONPSU_SEQ_INPUT_MDE* defined in xsysmonpsu_hw.h to specify the channel numbers. Differential or Bipolar input mode will be set for bit masks of 1 and unipolar input mode for bit masks of 0. The InputModeChMask is a 64 bit mask that is written to the three 16 bit ADC Channel Analog-Input Mode Sequencer Registers.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_SEQ_MODE_SAFE, XSysMonPsu_GetSequencerMode(), XSYSMONPSU_SEQ_INPUT_MDE0_OFFSET, XSYSMONPSU_SEQ_INPUT_MDE1_OFFSET, and XSysmonPsu_WriteReg.

Referenced by SysMonPsuIntrExample(), and SysMonPsuPolledPrintfExample().

void XSysMonPsu_SetSequencerEvent | ( | XSysMonPsu * | InstancePtr,
|  | u32 | IsEventMode,
|  | u32 | SysmonBlk
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  IsEventMode | is a boolean parameter that specifies continuous sampling (specify FALSE) or event driven sampling mode (specify TRUE) for the channel.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  None.

Note
  None.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_CFG_REG0_OFFSET, XSysmonPsu_ReadReg, and XSysmonPsu_WriteReg.

void XSysMonPsu_SetSequencerMode | ( | XSysMonPsu * | InstancePtr,
|  | u8 | SequencerMode,
|  | u32 | SysmonBlk
| ) |  |

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

        - Default safe mode (XSM_SEQ_MODE_SAFE)
        - One pass through sequence (XSM_SEQ_MODE_ONEPASS)
        - Continuous channel sequencing (XSM_SEQ_MODE_CONTINPASS)
        - Single Channel/Sequencer off (XSM_SEQ_MODE_SINGCHAN)
        - Olympus sampling mode (XSM_SEQ_MODE_OYLMPUS)

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  SequencerMode | is the sequencer mode to be set. Use XSM_SEQ_MODE_* bits defined in xsysmonpsu.h.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  None.

Note
  Only one of the modes can be enabled at a time.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_SEQ_MODE_OYLMPUS, XSM_SEQ_MODE_SINGCHAN, XSYSMONPSU_CFG_REG1_OFFSET, XSysmonPsu_ReadReg, and XSysmonPsu_WriteReg.

Referenced by SysMonPsuAMSExample(), SysMonPsuIntrExample(), SysMonPsuPolledPrintfExample(), and SysMonPsuSingleChannelIntrExample().

s32 XSysMonPsu_SetSingleChParams | ( | XSysMonPsu * | InstancePtr,
|  | u8 | Channel,
|  | u32 | IncreaseAcqCycles,
|  | u32 | IsEventMode,
|  | u32 | IsDifferentialMode,
|  | u32 | SysmonBlk
| ) |  |

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

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.
  Channel | is the channel number for conversion. The valid channels are 0 - 6, 8 - 10, 13 - 37.
  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.
  IsEventMode | is a boolean parameter that specifies continuous sampling (specify FALSE) or event driven sampling mode (specify TRUE) for the given channel.
  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.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

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 XSysMonPsu_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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSM_CH_AUX_MAX, XSM_CH_AUX_MIN, XSM_CH_GAINERR_CALIB, XSM_CH_RESERVE1, XSM_CH_SUPPLY3, XSM_CH_SUPPLY4, XSM_CH_SUPPLY_CALIB, XSM_CH_TEMP_REMTE, XSM_CH_VCC_PSLL0, XSM_CH_VPVN, XSM_SEQ_MODE_SINGCHAN, XSYSMONPSU_CFG_REG0_OFFSET, XSysMonPsu_GetSequencerMode(), XSysmonPsu_ReadReg, and XSysmonPsu_WriteReg.

Referenced by SysMonPsuAMSExample(), and SysMonPsuSingleChannelIntrExample().

void XSysMonPsu_StartAdcConversion | ( | XSysMonPsu * | InstancePtr | ) |

This function starts the ADC conversion in the Single Channel event driven sampling mode.

The EOC bit in Status Register will be set once the conversion is finished. Refer to the device specification for more details.

Parameters

  InstancePtr | is a pointer to the XSysMonPsu instance.

Returns
  None.

Note
  The default state of the CONVST bit is a logic 0. The conversion is started when the CONVST bit is set to 1 from 0. This bit is self-clearing so that the next conversion can be started by setting this bit.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu::IsReady, XSYSMONPSU_PS_SYSMON_CSTS_OFFSET, XSysmonPsu_ReadReg, and XSysmonPsu_WriteReg.

u8 XSysMonPsu_UpdateAdcClkDivisor | ( | XSysMonPsu * | InstancePtr,
|  | u32 | SysmonBlk
| ) |  |

The function update the ADCCLK divisor to the Configuration Register 2.

Parameters

  InstancePtr | is a pointer to the XSysMon instance.
  SysmonBlk | is the value that tells whether it is for PS Sysmon block or PL Sysmon block register region.

Returns
  The divisor update 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.

References XSysMonPsu_Config::BaseAddress, XSysMonPsu::Config, XSysMonPsu_Config::InputClockMHz, XSYSMONPSU_CFG_REG2_OFFSET, XSysmonPsu_ReadReg, and XSysmonPsu_WriteReg.

Referenced by XSysMonPsu_CfgInitialize().