sysmonpsv
Vitis Drivers API Documentation
xsysmonpsv_common.c File Reference

Functions

int XSysMonPsv_TempOffset (XSysMonPsv_TempType Type)
 This function gives the register offset for the different type. More...
 
int XSysMonPsv_TempThreshOffset (XSysMonPsv_TempEvt Event, XSysMonPsv_EventDir Dir, u32 *Offset)
 This function gives the temperature threshold (upper or lower) offset. More...
 
u32 XSysMonPsv_SupplyOffset (XSysMonPsv *InstancePtr, int Supply)
 This function gives the supply offset. More...
 
u32 XSysMonPsv_SupplyThreshOffset (XSysMonPsv *InstancePtr, int Supply, XSysMonPsv_EventDir Dir)
 This function gives the supply threshold (upper or lower) offset. More...
 
void XSysMonPsv_Q8P7ToCelsius (u32 RawData, int *Val, int *Val2)
 This function converts Q8P7 To Celsius. More...
 
void XSysMonPsv_CelsiusToQ8P7 (u32 *RawData, int Val, int Val2)
 This function converts Celsius To Q8P7. More...
 
void XSysMonPsv_SupplyRawToProcessed (int RawData, int *Val, int *Val2)
 This function converts raw data to processed. More...
 
void XSysMonPsv_SupplyProcessedToRaw (int Val, int Val2, u32 RegVal, u32 *RawData)
 This function converts processed data to raw. More...
 
u32 XSysMonPsv_IsAlarmPresent (XSysMonPsv *InstancePtr, XSysMonPsv_Supply Supply)
 This function is to be used to check if the supply value has exceeded the set threshold values. More...
 
u32 XSysMonPsv_ClearAlarm (XSysMonPsv *InstancePtr, XSysMonPsv_Supply Supply)
 This function is to be used to clear alarm status. More...
 
int XSysMonPsv_InterruptEnable (XSysMonPsv *InstancePtr, u32 Mask, u8 IntrNum)
 This function enables the specified interrupts in the device. More...
 
int XSysMonPsv_InterruptDisable (XSysMonPsv *InstancePtr, u32 Mask, u8 IntrNum)
 This function disables the specified interrupts in the device. More...
 
int XSysMonPsv_InterruptGetStatus (XSysMonPsv *InstancePtr, u32 *IntrStatus)
 This function returns the interrupt status read from Interrupt Status Register(ISR). More...
 
void XSysMonPsv_InterruptClear (XSysMonPsv *InstancePtr, u32 Mask)
 This function clears the specified interrupts in the Interrupt Status Register (ISR). More...
 
void XSysMonPsv_UnlockRegspace (XSysMonPsv *InstancePtr)
 This function unlocks the register space of InstancePtr hardware. More...
 

Function Documentation

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

This function converts Celsius To Q8P7.

Parameters
RawDatais Raw Temperature Data.
Valis the numerator for covnersion to deg C.
Val2is the denominator for conversion to deg C in Q8.7 format.
Returns
None.
u32 XSysMonPsv_ClearAlarm ( XSysMonPsv InstancePtr,
XSysMonPsv_Supply  Supply 
)

This function is to be used to clear alarm status.

Parameters
InstancePtris a pointer to the driver instance.
Supplyis an 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 
)

This function clears the specified interrupts in the Interrupt Status Register (ISR).

Parameters
InstancePtris a pointer to the struct InstancePtr.
Maskis the 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 
)

This function disables the specified interrupts in the device.

Parameters
InstancePtris a pointer to the driver instance.
Maskis the 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.
IntrNumis the 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 
)

This function enables the specified interrupts in the device.

Parameters
InstancePtris a pointer to the driver instance.
Maskis the 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.
IntrNumis the 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 
)

This function 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
InstancePtris a pointer to the driver instance.
A32-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 
)

This function is to be used to check if the supply value has exceeded the set threshold values.

Parameters
InstancePtris a pointer to the driver instance.
Supplyis an 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, and XSysMonPsv_ReadReg32().

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

This function converts Q8P7 To Celsius.

Parameters
RawDatais Raw temperature Data.
Valis value in Q8P7 format.
Val2is constant 128.
Returns
None.

References twoscomp.

Referenced by XSysMonPsv_ReadTempProcessed(), and XSysMonPsv_ReadTempProcessedSat().

u32 XSysMonPsv_SupplyOffset ( XSysMonPsv InstancePtr,
int  Supply 
)

This function gives the supply offset.

Parameters
InstancePtris a pointer to the XSysMonPsv instance.
Supplyis an 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 
)

This function converts processed data to raw.

Parameters
Valis numerator for conversion to volts.
Val2is denominator for conversion to volts.
RegValis Register Value.
RawDatais 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 
)

This function converts raw data to processed.

Parameters
RawDatais raw voltage data.
Valis numerator for conversion to volts.
Val2is 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 
)

This function gives the supply threshold (upper or lower) offset.

Parameters
InstancePtris a pointer to the XSysMonPsv instance.
Supplyis an enum which indicates the desired supply.
Diris Falling or rising direction.
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)

This function gives the register offset for the different type.

Parameters
Typeis 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 
)

This function gives the temperature threshold (upper or lower) offset.

Parameters
Eventis Temp or OT event type.
Diris falling or rising direction
Offsetis the 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)

This function unlocks the register space of InstancePtr hardware.

Parameters
InstancePtris a pointer to the driver instance.
Returns
None.

References XSYSMONPSV_LOCK_CODE, XSYSMONPSV_PCSR_LOCK, and XSysMonPsv_WriteReg32().