| sysmonpsv Vitis Drivers API Documentation

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

Functions
xsysmonpsv_common.c File Reference

## Functions
int | XSysMonPsv_TempOffset (XSysMonPsv_TempType Type)
| Provides the register offset for the different type. More...
int | XSysMonPsv_TempThreshOffset (XSysMonPsv_TempEvt Event, XSysMonPsv_EventDir Dir, u32 *Offset)
| Provides the temperature threshold (upper or lower) offset. More...
u32 | XSysMonPsv_SupplyOffset (XSysMonPsv *InstancePtr, int Supply)
| Provides the supply offset. More...
u32 | XSysMonPsv_SupplyThreshOffset (XSysMonPsv *InstancePtr, int Supply, XSysMonPsv_EventDir Dir)
| Provides the supply threshold (upper or lower) offset. More...
void | XSysMonPsv_Q8P7ToCelsius (u32 RawData, int *Val, int *Val2)
| Converts Q8P7 To Celsius. More...
void | XSysMonPsv_CelsiusToQ8P7 (u32 *RawData, int Val, int Val2)
| Converts Celsius To Q8P7. More...
void | XSysMonPsv_SupplyRawToProcessed (int RawData, int *Val, int *Val2)
| Converts raw data to processed. More...
void | XSysMonPsv_SupplyProcessedToRaw (int Val, int Val2, u32 RegVal, u32 *RawData)
| Converts processed data to raw. More...
u32 | XSysMonPsv_IsAlarmPresent (XSysMonPsv *InstancePtr, XSysMonPsv_Supply Supply)
| Checks if the supply value has exceeded the set threshold values. More...
u32 | XSysMonPsv_ClearAlarm (XSysMonPsv *InstancePtr, XSysMonPsv_Supply Supply)
| Clears alarm status. More...
int | XSysMonPsv_InterruptEnable (XSysMonPsv *InstancePtr, u32 Mask, u8 IntrNum)
| Enables the specified interrupts in the device. More...
int | XSysMonPsv_InterruptDisable (XSysMonPsv *InstancePtr, u32 Mask, u8 IntrNum)
| Disables the specified interrupts in the device. More...
int | XSysMonPsv_InterruptGetStatus (XSysMonPsv *InstancePtr, u32 *IntrStatus)
| Returns the interrupt status read from Interrupt Status Register(ISR). More...
void | XSysMonPsv_InterruptClear (XSysMonPsv *InstancePtr, u32 Mask)
| Clears the specified interrupts in the Interrupt Status Register(ISR). More...
void | XSysMonPsv_UnlockRegspace (XSysMonPsv *InstancePtr)
| Unlocks the register space of InstancePtr hardware. More...

## Function Documentation

void XSysMonPsv_CelsiusToQ8P7 | ( | u32 * | RawData,
|  | int | Val,
|  | int | Val2
| ) |  |

Converts Celsius To Q8P7.

Parameters

  RawData | Raw Temperature Data.
  Val | Numerator for covnersion to deg C.
  Val2 | Denominator for conversion to deg C in Q8.7 format.

Returns
  None.

u32 XSysMonPsv_ClearAlarm | ( | XSysMonPsv * | InstancePtr,
|  | XSysMonPsv_Supply | Supply
| ) |  |

Clears alarm status.

Parameters

  InstancePtr | Pointer to the driver instance.
  Supply | Enum which indicates the desired supply.

Returns
  True if new data available. False if new data isn't available. Invalid if the Supply hasn't been configured.

References XSysMonPsv::Config, XSysMonPsv_Config::Supply_List, XSYSMONPSV_ALARM_FLAG0, XSYSMONPSV_INVALID, XSYSMONPSV_INVALID_SUPPLY, XSysMonPsv_ReadReg32(), and XSysMonPsv_WriteReg32().

void XSysMonPsv_InterruptClear | ( | XSysMonPsv * | InstancePtr,
|  | u32 | Mask
| ) |  |

Clears the specified interrupts in the Interrupt Status Register(ISR).

Parameters

  InstancePtr | Pointer to the struct InstancePtr.
  Mask | 32 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.*

Returns
  None.

References XSYSMONPSV_ISR_OFFSET, and XSysMonPsv_WriteReg32().

int XSysMonPsv_InterruptDisable | ( | XSysMonPsv * | InstancePtr,
|  | u32 | Mask,
|  | u8 | IntrNum
| ) |  |

Disables the specified interrupts in the device.

Parameters

  InstancePtr | Pointer to the driver instance.
  Mask | 32 bit-mask of the interrupts to be enabled. Bit positions of 1 will be disabled. Bit positions of 0 will keep the previous setting. This mask is formed by OR'ing XSYSMONPSV_IDR_* bits defined in InstancePtr.h.
  IntrNum | Interrupt disable register to be used

Returns
  - XST_FAILURE if error
  - XST_SUCCESS if successful

References XSYSMONPSV_IDR0_OFFSET, XSYSMONPSV_PCSR_LOCK, and XSysMonPsv_WriteReg32().

int XSysMonPsv_InterruptEnable | ( | XSysMonPsv * | InstancePtr,
|  | u32 | Mask,
|  | u8 | IntrNum
| ) |  |

Enables the specified interrupts in the device.

Parameters

  InstancePtr | Pointer to the driver instance.
  Mask | 32 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 XSYSMON_IER_* bits defined in InstancePtr.h.
  IntrNum | Interrupt enable register to be used

Returns
  - XST_FAILURE if error
  - XST_SUCCESS if successful

References XSYSMONPSV_IER0_OFFSET, XSYSMONPSV_PCSR_LOCK, and XSysMonPsv_WriteReg32().

Referenced by XSysMonPsv_EnableVoltageEvents().

int XSysMonPsv_InterruptGetStatus | ( | XSysMonPsv * | InstancePtr,
|  | u32 * | IntrStatus
| ) |  |

Returns the interrupt status read from Interrupt Status Register(ISR).

Use the XSYSMONPSV_ISR* constants defined in InstancePtr.h to interpret the returned value.

Parameters

  InstancePtr | Pointer to the driver instance.
  IntrStatus | 32-bit value representing the contents of the Interrupt Status Register (ISR).

Returns
  - -XST_FAILURE when NULL Instance is passed
  - XST_SUCCESS if succeeds

References XSYSMONPSV_ISR_OFFSET, and XSysMonPsv_ReadReg32().

u32 XSysMonPsv_IsAlarmPresent | ( | XSysMonPsv * | InstancePtr,
|  | XSysMonPsv_Supply | Supply
| ) |  |

Checks if the supply value has exceeded the set threshold values.

Parameters

  InstancePtr | Pointer to the driver instance.
  Supply | Enum which indicates the desired supply.

Returns
  True if new data available. False if new data is not available. Invalid if the Supply has not been configured.

References XSysMonPsv::Config, XSysMonPsv_Config::Supply_List, XSYSMONPSV_ALARM_FLAG0, XSYSMONPSV_INVALID, XSYSMONPSV_INVALID_SUPPLY, and XSysMonPsv_ReadReg32().

void XSysMonPsv_Q8P7ToCelsius | ( | u32 | RawData,
|  | int * | Val,
|  | int * | Val2
| ) |  |

Converts Q8P7 To Celsius.

Parameters

  RawData | Raw temperature Data.
  Val | Value in Q8P7 format.
  Val2 | Constant 128.

Returns
  None.

References twoscomp.

Referenced by XSysMonPsv_ReadTempProcessed(), and XSysMonPsv_ReadTempProcessedSat().

u32 XSysMonPsv_SupplyOffset | ( | XSysMonPsv * | InstancePtr,
|  | int | Supply
| ) |  |

Provides the supply offset.

Parameters

  InstancePtr | Pointer to the XSysMonPsv instance.
  Supply | Enum which indicates the desired supply.

Returns
  Offset supply.

References XSysMonPsv::Config, XSysMonPsv_Config::Supply_List, and XSYSMONPSV_SUPPLY.

Referenced by XSysMonPsv_ReadSupplyProcessed(), and XSysMonPsv_ReadSupplyRaw().

void XSysMonPsv_SupplyProcessedToRaw | ( | int | Val,
|  | int | Val2,
|  | u32 | RegVal,
|  | u32 * | RawData
| ) |  |

Converts processed data to raw.

Parameters

  Val | Numerator for conversion to volts.
  Val2 | Denominator for conversion to volts.
  RegVal | Register Value.
  RawData | Converted Raw data.

Returns
  None.

References XSYSMONPSV_LOW_SAT, XSYSMONPSV_LOW_SAT_SIGNED, XSYSMONPSV_LOW_SAT_SIGNED_VAL, XSYSMONPSV_LOW_SAT_VAL, XSYSMONPSV_SUPPLY_FMT_MASK, XSYSMONPSV_SUPPLY_FMT_SHIFT, XSYSMONPSV_SUPPLY_MODE_MASK, XSYSMONPSV_SUPPLY_MODE_SHIFT, XSYSMONPSV_UP_SAT, XSYSMONPSV_UP_SAT_SIGNED, XSYSMONPSV_UP_SAT_SIGNED_VAL, and XSYSMONPSV_UP_SAT_VAL.

void XSysMonPsv_SupplyRawToProcessed | ( | int | RawData,
|  | int * | Val,
|  | int * | Val2
| ) |  |

Converts raw data to processed.

Parameters

  RawData | Raw voltage data.
  Val | Numerator for conversion to volts.
  Val2 | Denominator for conversion to volts.

Returns
  None.

References XSYSMONPSV_SUPPLY_FMT_MASK, XSYSMONPSV_SUPPLY_FMT_SHIFT, XSYSMONPSV_SUPPLY_MANTISSA_MASK, XSYSMONPSV_SUPPLY_MANTISSA_SIGN, XSYSMONPSV_SUPPLY_MODE_MASK, and XSYSMONPSV_SUPPLY_MODE_SHIFT.

Referenced by XSysMonPsv_ReadSupplyProcessed().

u32 XSysMonPsv_SupplyThreshOffset | ( | XSysMonPsv * | InstancePtr,
|  | int | Supply,
|  | XSysMonPsv_EventDir | Dir
| ) |  |

Provides the supply threshold (upper or lower) offset.

Parameters

  InstancePtr | Pointer to the XSysMonPsv instance.
  Supply | Enum which indicates the desired supply.
  Dir | Type of the direction - falling or rising.

Returns
  Upper or lower threshold offset.

References XSysMonPsv::Config, XSysMonPsv_Config::Supply_List, XSYSMONPSV_EV_DIR_RISING, XSYSMONPSV_SUPPLY_TH_LOWER, and XSYSMONPSV_SUPPLY_TH_UPPER.

Referenced by XSysMonPsv_GetSupplyThresholdLower(), XSysMonPsv_GetSupplyThresholdUpper(), XSysMonPsv_SetSupplyThresholdLower(), and XSysMonPsv_SetSupplyThresholdUpper().

int XSysMonPsv_TempOffset | ( | XSysMonPsv_TempType | Type | ) |

Provides the register offset for the different type.

Parameters

  Type | Max or Min Temperature Type

Returns
  -XST_FAILURE when fails -Register offset

References XSYSMONPSV_DEVICE_TEMP_MAX, XSYSMONPSV_TEMP, XSYSMONPSV_TEMP_MAX, and XSYSMONPSV_TEMP_MIN.

Referenced by XSysMonPsv_ReadTempProcessed(), and XSysMonPsv_ReadTempRaw().

int XSysMonPsv_TempThreshOffset | ( | XSysMonPsv_TempEvt | Event,
|  | XSysMonPsv_EventDir | Dir,
|  | u32 * | Offset
| ) |  |

Provides the temperature threshold (upper or lower) offset.

Parameters

  Event | Temp or OT event type.
  Dir | Falling or rising direction
  Offset | Upper or lower threshold offset.

Returns
  - -XST_FAILURE when fails
  - XST_SUCCESS when correct params are used.

References XSYSMONPSV_DEVICE_TEMP_TH_FALLING, XSYSMONPSV_DEVICE_TEMP_TH_RISING, XSYSMONPSV_EV_DIR_RISING, XSYSMONPSV_OT_EVENT, XSYSMONPSV_OT_TEMP_TH_FALLING, XSYSMONPSV_OT_TEMP_TH_RISING, and XSYSMONPSV_TEMP_EVENT.

void XSysMonPsv_UnlockRegspace | ( | XSysMonPsv * | InstancePtr | ) |

Unlocks the register space of InstancePtr hardware.

Parameters

  InstancePtr | Pointer to the driver instance.

Returns
  None.

References XSYSMONPSV_LOCK_CODE, XSYSMONPSV_PCSR_LOCK, and XSysMonPsv_WriteReg32().