xilskey
Vitis Drivers API Documentation
xilskey_eps.c File Reference

Overview

This file contains the PS eFUSE API's to program/read the eFUSE array.

Note
None.

MODIFICATION HISTORY:

Ver Who Date Changes


1.00a rpoolla 04/26/13 First release 1.02a hk 10/28/13 Added API to read status register.PR# 735957 2.00 hk 23/01/14 Changed PS efuse error codes for voltage out of range. 2.1 sk 04/03/15 Initialized RSAKeyReadback with Zeros CR# 829723. 3.00 vns 31/07/15 Removed redundant code to initialise timer. 4.00 vns 09/10/15 Added DFT control bits programming fecility for eFuse PS on Zynq. PR#862778 Added Conditional compilation to support Zynq Mp also. 5.00 vns 27/01/16 Fixed array out of bounds error CR #931207 6.0 vns 29/06/16 Added Margin 2 read verification after programming every Zynq's eFUSE PS bit CR #953052. vns 07/17/16 Fixed CR# 954260, Modified XilSKey_EfusePs_Write API to program eFUSE protect bit after programming DFT bits 6.6 vns 06/06/18 Added doxygen tags 6.8 vns 08/29/19 Initialized Status variables 7.2 am 07/13/21 Fixed doxygen warnings

Functions

u32 XilSKey_EfusePs_Write (XilSKey_EPs *InstancePtr)
 This function is used to write to the PS eFUSE. More...
 
u32 XilSKey_EfusePs_Read (XilSKey_EPs *InstancePtr)
 This function is used to read the PS eFUSE. More...
 
void XilSKey_EfusePs_GenerateMatrixMap (void)
 This function is used to generate the matrix map of the G and H for hamming code (31,26). More...
 
void XilSKey_EfusePs_EccEncode (const u8 *InData, u8 *Ecc)
 This function is used to encode the incoming data byte. More...
 
u8 XilSKey_EfusePs_EccDecode (const u8 *Corrupt, u8 *Syndrome)
 This function is used to decode the incoming encoded byte. More...
 
u32 XilSKey_EfusePs_ControllerConfig (u8 CtrlMode, u32 RefClk, u8 ReadMode)
 This function is used to set the controller mode, read mode along with the read and program strobe width values based on the reference clock. More...
 
u8 XilSKey_EfusePs_IsAddressXilRestricted (u32 Addr)
 This function is used to check whether eFuse bit is xilinx reserved bit or not. More...
 
void XilSKey_EfusePs_ControllerSetReadWriteEnable (u32 ReadWriteEnable)
 This function is used to enable the read/write/program the eFUSE array. More...
 
u32 XilSKey_EfusePs_ReadEfuseBit (u32 Addr, u8 *Data)
 This function is used to read the eFuse bit value. More...
 
u32 XilSKey_EfusePs_WriteEfuseBit (u32 Addr)
 This function is used to program the eFuse bit value. More...
 
u32 XilSKey_EfusePs_ReadStatus (XilSKey_EPs *InstancePtr, u32 *StatusBits)
 This function is used to read the PS efuse status register. More...
 

Variables

u8 Matrix [31][5]
 PS eFUSE Matrix. More...
 
u8 ErrorCodeIndex [32]
 Error Code Array. More...
 

Function Documentation

u32 XilSKey_EfusePs_ControllerConfig ( u8  CtrlMode,
u32  RefClk,
u8  ReadMode 
)

This function is used to set the controller mode, read mode along with the read and program strobe width values based on the reference clock.

Parameters
CtrlModeis the mode of the controller
  • XSK_EFUSEPS_REDUNDANCY_MODE
  • XSK_EFUSEPS_SINGLE_MODE
RefClkis the CPU 1x reference clock frequency. Clock frequency can be between 20MHz to 100MHz specified in Hz
ReadModeis the read mode of the controller
  • XSK_EFUSEPS_READ_MODE_NORMAL
  • XSK_EFUSEPS_READ_MODE_MARGIN_1
  • XSK_EFUSEPS_READ_MODE_MARGIN_2
Returns
  • XST_SUCCESS no errors occurred.
  • an error when controller mode is not supported
  • an error when reference clock is not supported
  • an error when read mode is not supported

Test Cases: Check single mode in CFG Reg Check redundancy mode in CFG Reg Check strobe width values for write mode Check strobe width values for various read mode Check Normal Read mode setting in CFG Reg Check Margin 1 Read mode setting in CFG Reg Check Margin 2 Read mode setting in CFG Reg Boundary Conditions

Check the parameters Mode can be Single or Redundancy mode

Ref Clock should be between 20MHz - 60MHz

3 read modes are supported

Set the controller mode

Set the controller read mode

Program the Strobe width values for read and write 12us is required for write and 150ns is required for read PGM_STBW = ceiling(12us/ref_clk period) RD_STBW = ceiling(150ns/ref_clk period)

References XSK_EFUSEPS_CONFIG_REG, XSK_EFUSEPS_CONFIG_TSU_H_A, XSK_EFUSEPS_ERROR_CONTROLLER_MODE, XSK_EFUSEPS_ERROR_READ_MODE, XSK_EFUSEPS_ERROR_REF_CLOCK, XSK_EFUSEPS_PGM_STBW_REG, XSK_EFUSEPS_PRGM_STROBE_WIDTH, XSK_EFUSEPS_RD_STBW_REG, XSK_EFUSEPS_RD_STROBE_WIDTH, XSK_EFUSEPS_REFCLK_LOW_FREQ, and XSK_EFUSEPS_SINGLE_MODE.

Referenced by XilSKey_EfusePs_Read(), and XilSKey_EfusePs_Write().

void XilSKey_EfusePs_ControllerSetReadWriteEnable ( u32  ReadWriteEnable)

This function is used to enable the read/write/program the eFUSE array.

Parameters
ReadWriteEnable0x1 - Enable programming 0x2 - Enable read 0x4 - Enable write
Returns

Test Cases

Reset the values Disable programming Disable reading Disable writing

References XSK_EFUSEPS_CONTROL_PS_EN, XSK_EFUSEPS_CONTROL_RD_DIS, XSK_EFUSEPS_CONTROL_REG, XSK_EFUSEPS_CONTROL_WR_DIS, and XSK_EFUSEPS_ENABLE_PROGRAMMING.

Referenced by XilSKey_EfusePs_Read(), and XilSKey_EfusePs_Write().

u8 XilSKey_EfusePs_EccDecode ( const u8 *  Corrupt,
u8 *  Syndrome 
)

This function is used to decode the incoming encoded byte.

Parameters
Corruptis the input encoded data. It has 26 bit data with 5 bit parity data
Syndromeis the output updated with the parity error information.
Returns
position of the error in the data byte

TDD Cases: Check the parameters Check the decode with out any error Check the decode with 1 bit error Check the decode with 2 bit error Check the decode for boundary cases Check for memory corruption

References ErrorCodeIndex, and Matrix.

void XilSKey_EfusePs_EccEncode ( const u8 *  InData,
u8 *  Ecc 
)

This function is used to encode the incoming data byte.

It uses hamming (31,26) algorithm. 26 bits are encoded to 31 bits

Parameters
InDatais 26 bit input data with each bit represented in one byte
Eccis the 31 bit encoded data with each bit represented in one byte
Returns
None

TDD Cases: Check the parameters Check the encoded data for different input data Check the input data for boundary cases Check for memory corruption

References Matrix.

void XilSKey_EfusePs_GenerateMatrixMap ( void  )

This function is used to generate the matrix map of the G and H for hamming code (31,26).

G is [31,5] and defined as [A|I], I is identity matrix of [5,5].

Returns
None

TDD Cases: Check the generated matrix Check the memory corruption of the generated matrix

References ErrorCodeIndex, and Matrix.

u8 XilSKey_EfusePs_IsAddressXilRestricted ( u32  Addr)

This function is used to check whether eFuse bit is xilinx reserved bit or not.

Parameters
Addris the address of the eFuse bit.
Returns
  • XST_SUCCESS if address corresponds to restricted eFuse bit.
  • XST_FAILURE is address corresponds to non-restricted eFuse bit.

Test Cases: with different address values Boundary values for addr

Check for xilinx test bits

Check for xilinx reserved bits

References XSK_EFUSEPS_APB_TRIM_BITS_START_ADDR, XSK_EFUSEPS_APB_TRIM_BITS_START_ADDR_2ND_HALF, XSK_EFUSEPS_APB_XILINX_RSVD_TEST_BIT_x20, and XSK_EFUSEPS_APB_XILINX_RSVD_TEST_BIT_x23F.

Referenced by XilSKey_EfusePs_ReadEfuseBit(), and XilSKey_EfusePs_WriteEfuseBit().

u32 XilSKey_EfusePs_ReadEfuseBit ( u32  Addr,
u8 *  Data 
)

This function is used to read the eFuse bit value.

Before using this function set the controller mode and read mode as required. Also, strobe width values are to be set properly based on the reference clock for successful reading

Parameters
Addris the address of the eFuse bit.
Datahas the read eFuse value stored in it.
Returns
  • XST_SUCCESS for successfully reading the value.
  • an error when addr is restricted

Test Cases Read in Single mode Read in redundancy mode Read for restricted address Boundary Checks for address

References XilSKey_EfusePs_IsAddressXilRestricted(), and XSK_EFUSEPS_ERROR_ADDRESS_XIL_RESTRICTED.

u32 XilSKey_EfusePs_WriteEfuseBit ( u32  Addr)

This function is used to program the eFuse bit value.

Before using this function set the controller mode and read mode as required. Also, strobe width values are to be set properly based on the reference clock for successful programming

Parameters
Addris the address of the eFuse bit.
Returns
  • XST_SUCCESS after successful writing.
  • an error when addr is restricted

Test Cases Write in Single mode Write in redundancy mode Write for restricted address Boundary Checks for address Strobe width are not proper (Check if it makes sense)

Check if Address is restricted

Send success when bit is already programmed

Providing 15us delay Timer takes 100ns as slice. 15us = 150 * 100ns

References XilSKey_Efuse_IsTimerExpired(), XilSKey_Efuse_SetTimeOut(), XilSKey_EfusePs_IsAddressXilRestricted(), and XSK_EFUSEPS_ERROR_ADDRESS_XIL_RESTRICTED.

Variable Documentation

u8 ErrorCodeIndex[32]