xilplmi
Vitis Drivers API Documentation
xplmi_glitchdetector.c File Reference

Overview

This is the file which contains glitch detector code.

This contains APIs for configuring glitch detector, enable/disable the glitch detector and to read the status of glitch detector. These APIs support both client and server mode for glitch detector0 and glitch detector1.

MODIFICATION HISTORY:
Ver   Who  Date        Changes
----- ---- ---------- --------------------------------------------------------------------------
1.00  pre  06/09/2024 Initial release
      pre  07/17/2024 Used register node to access PMC analog registers and fixed
                      misrac warnings
      pre  10/19/2024 Added support for PL microblaze
Note

Macros

#define XPLMI_REFVOL_3LSBITS_MASK   0x07
 Mask to extract 3 least significant bits from reference voltage. More...
 
#define XPLMI_DEPTH_3LSBITS_MASK   0x07
 Mask to extract 3 least significant bits from depth. More...
 
#define XPLMI_REFVOL_MSBIT_MASK   0x08
 Mask to extract most significant bit from reference voltage. More...
 
#define XPLMI_DEPTH_2MSBITS_MASK   0x18
 Mask to extract 2 most significant bits from depth. More...
 
#define XPLMI_REFVOL_MSBIT_SHIFT   (16U)
 Shift value to place most significant bit of reference voltage. More...
 
#define XPLMI_REFVOL_3LSBITS_SHIFT   (12U)
 Shift value to place 3 least significant bits of reference voltage. More...
 
#define XPLMI_DEPTH_2MSBITS_SHIFT   (1U)
 Shift value to place 2 most significant bits of depth. More...
 
#define XPLMI_DEPTH_3LSBITS_SHIFT   (16U)
 Shift value to place 3 least significant bits of depth. More...
 
#define XPLMI_WIDTH_BITS_SHIFT   (8U)
 Shift value to place bits of width. More...
 
#define XPLMI_WORD_LEN   (4U)
 Word size in bytes. More...
 
#define XPLMI_GD1_STATUS_POS   (16U)
 Bit position of glitch detector1 status. More...
 

Functions

int XPlmi_WriteReg32 (u32 Offset, u32 Data)
 Writes value to register. More...
 
int XPlmi_ReadReg32 (u32 Offset, u32 *Data)
 Reads register value. More...
 
int XPlmi_ConfigureGlitchDetector (u8 Depth, u8 Width, u8 RefVoltage, u8 UserRegVal, u8 GlitchDetectorNum)
 This function configures desired glitch detector. More...
 
int XPlmi_ChangeGlitchDetectorState (u8 GlitchDetectorNum, eStatus EnableStatus)
 This function enables/disables the desired glitch detector. More...
 
int XPlmi_GlitchDetectorStatus (u8 GlitchDetectorNum, u8 *GlitchDetStatus)
 This function reads the status of desired glitch detector. More...
 

Macro Definition Documentation

#define XPLMI_DEPTH_2MSBITS_MASK   0x18

Mask to extract 2 most significant bits from depth.

#define XPLMI_DEPTH_2MSBITS_SHIFT   (1U)

Shift value to place 2 most significant bits of depth.

#define XPLMI_DEPTH_3LSBITS_MASK   0x07

Mask to extract 3 least significant bits from depth.

#define XPLMI_DEPTH_3LSBITS_SHIFT   (16U)

Shift value to place 3 least significant bits of depth.

#define XPLMI_GD1_STATUS_POS   (16U)

Bit position of glitch detector1 status.

#define XPLMI_REFVOL_3LSBITS_MASK   0x07

Mask to extract 3 least significant bits from reference voltage.

#define XPLMI_REFVOL_3LSBITS_SHIFT   (12U)

Shift value to place 3 least significant bits of reference voltage.

#define XPLMI_REFVOL_MSBIT_MASK   0x08

Mask to extract most significant bit from reference voltage.

#define XPLMI_REFVOL_MSBIT_SHIFT   (16U)

Shift value to place most significant bit of reference voltage.

#define XPLMI_WIDTH_BITS_SHIFT   (8U)

Shift value to place bits of width.

Function Documentation

int XPlmi_ChangeGlitchDetectorState ( u8  GlitchDetectorNum,
eStatus  EnableStatus 
)

This function enables/disables the desired glitch detector.

Parameters
GlitchDetectorNumis the number of glitch detector to be enabled/disabled
EnableStatusindicates action i.e., enable/disable
Returns
  • XST_SUCCESS on success.
  • error code on failure.
int XPlmi_ConfigureGlitchDetector ( u8  Depth,
u8  Width,
u8  RefVoltage,
u8  UserRegVal,
u8  GlitchDetectorNum 
)

This function configures desired glitch detector.

Parameters
Depthis the minimum voltage glitch detection depth
Widthis the minimum glitch detector width
RefVoltageis the reference voltage for the glitch detector comparators
UserRegValindicates to select the register values instead of the eFUSE values to configure the glitch detector
GlitchDetectorNumis the number of glitch detector to be configured
Returns
  • XST_SUCCESS on success.
  • error code on failure.
int XPlmi_GlitchDetectorStatus ( u8  GlitchDetectorNum,
u8 *  GlitchDetStatus 
)

This function reads the status of desired glitch detector.

Parameters
GlitchDetectorNumis the number of glitch detector whose status is to be read
GlitchDetStatusholds the status
Returns
Status of glitch detector
int XPlmi_ReadReg32 ( u32  Offset,
u32 *  Data 
)

Reads register value.

Parameters
OffsetOffset of the register.
DataValue to be read.
Returns
XST_SUCCESS on success error code on failure
int XPlmi_WriteReg32 ( u32  Offset,
u32  Data 
)

Writes value to register.

Parameters
OffsetOffset of the register
DataValue to be written in register
Returns
XST_SUCCESS on success error code on failure