xilnvm
Vitis Drivers API Documentation
XilNvm BBRAM Server APIs

Macros

#define REVERSE_POLYNOMIAL   (0x82F63B78U)
 Polynomial used for CRC calculation. More...
 

Functions

int XNvm_BbramLockUsrDataWrite (void)
 This function locks the user data written in BBRAM_8 that is making user data written in BBRAM as read only. More...
 
int XNvm_BbramWriteAesKey (const u8 *Key, u16 KeyLen)
 This function does programming of key provided into BBRAM and validates CRC of the key stored in BBRAM with CRC of input key. More...
 
int XNvm_BbramWriteUsrData (u32 GeneralPurposeData)
 Writes user provided 32-bit data to BBRAM. More...
 
u32 XNvm_BbramReadUsrData (void)
 This function reads 32-bit user data from BBRAM_8 register. More...
 
int XNvm_BbramZeroize (void)
 This function zeroizes the BBRAM. More...
 

Macro Definition Documentation

#define REVERSE_POLYNOMIAL   (0x82F63B78U)

Polynomial used for CRC calculation.

Referenced by XNvm_AesCrcCalc().

Function Documentation

int XNvm_BbramLockUsrDataWrite ( void  )

This function locks the user data written in BBRAM_8 that is making user data written in BBRAM as read only.

Returns
  • XST_SUCCESS Success in locking the BBRAM user data.
  • XNVM_BBRAM_ERROR_LOCK_USR_DATA_WRITE Failure to lock BBRAM user data.

Write to BBRAM Lock register and readback to confirm if lock is successful. Return the status of the lock, Success if the lock is done else error.

References XNVM_BBRAM_ERROR_LOCK_USR_DATA_WRITE, and XNVM_BBRAM_MSW_LOCK.

u32 XNvm_BbramReadUsrData ( void  )

This function reads 32-bit user data from BBRAM_8 register.

Returns
32-bit user data stored in BBRAM_8 register

Read the 32 bit user data from the BBRAM_8 register and return it

int XNvm_BbramWriteAesKey ( const u8 *  Key,
u16  KeyLen 
)

This function does programming of key provided into BBRAM and validates CRC of the key stored in BBRAM with CRC of input key.

Parameters
Key- Pointer to hex buffer which is pointing to key
KeyLen- XNVM_256_BITS_AES_KEY_LEN_IN_BYTES for 256-bit AES key
Returns
  • XST_SUCCESS Key is written to BBRAM.
  • XST_INVALID_PARAM Invalid parameter passed.
  • XNVM_BBRAM_ERROR_PGM_MODE_ENABLE_TIMEOUT Timeout during enabling programming mode.
  • XNVM_BBRAM_ERROR_PGM_MODE_DISABLE_TIMEOUT Timeout during disabling programming mode.
  • XNVM_BBRAM_ERROR_AES_CRC_DONE_TIMEOUT CRC validation check timed out.
  • XNVM_BBRAM_ERROR_AES_CRC_MISMATCH CRC mismatch.

Perform input parameter validation. Return appropriate error code if input parameters are invalid.

Assign the key address to local pointer.

Bring BBRAM to programming mode by writing Magic Word 0x757BDF0D to PGM_MODE register.

Write 256-bit AES Key to BBRAM registers BBRAM_0 to BBRAM_7.

Calculate CRC on input AES Key and write it to BBRAM_AES_CRC which triggers BBRAM CRC integrity check. Wait for AES_CRC_DONE bit to set in BBRAM_STATUS register with timeout of 1 second. If timed out return timeout error. If AES_CRC_PASS bit is set in BBRAM_STATUS register, return XST_SUCCESS else return CRC mismatch error.

Disable BBRAM programming mode by writing 0x00 to PGM_MODE register.

References XNvm_BbramZeroize().

int XNvm_BbramWriteUsrData ( u32  GeneralPurposeData)

Writes user provided 32-bit data to BBRAM.

Parameters
GeneralPurposeData- 32-bit user data to be written to BBRAM
Returns
  • XST_SUCCESS User data written to BBRAM
  • XNVM_BBRAM_INVALID_PARAM Invalid input parameter
  • XNVM_BBRAM_ERROR_USR_DATA_WRITE_LOCKED Failure since write is locked for the register
Note
Provisoning of general purpose data is allowed only if Symmetric/Asymeetric HWRoT boot is not enabled for Versal Gen 2 devices
int XNvm_BbramZeroize ( void  )

This function zeroizes the BBRAM.

Returns
  • XST_SUCCESS Success in Zeroization of BBRAM.
  • XNVM_BBRAM_ERROR_ZEROIZE_TIMEOUT If Timed out during BBRAM zeroization

Write 1 to BBRAM_CTRL register. Wait for BBRAM_ZEROIZED bit to set in BBRAM_STATUS register with timeout of 1 second. If timed out return timeout error. Return XST_SUCCESS.

References XNVM_BBRAM_BASE_ADDR, XNVM_BBRAM_CTRL_START_ZEROIZE, XNVM_BBRAM_ERROR_ZEROIZE_TIMEOUT, and XNVM_BBRAM_STATUS_REG.