![]() |
xilskey
Vitis Drivers API Documentation
|
MODIFICATION HISTORY:
Ver Who Date Changes
1.00a rpoolla 04/26/13 First release 2.00 hk 22/01/14 Corrected PL voltage checks to VCCINT and VCCAUX. CR#768077 2.1 kvn 04/01/15 Fixed warnings. CR#716453. 3.00 vns 31/07/15 Added efuse functionality for Ultrascale. 4.0 vns 10/01/15 Modified conditional compilation to support ZynqMp platform also. Added new API Xsk_Ceil Modified Xilskey_CrcCalculation() API for providing support for efuse ZynqMp also. 6.0 vns 07/07/16 Modified XilSKey_Timer_Intialise API to initialize TimerTicks to 10us. As Hardware module only takes care of programming time(5us), through software we only need to control hardware module. Modified sysmon read to 16 bit resolution as sysmon driver has modified conversion formulae to 16 bit resolution. vns 07/18/16 Initialized sysmonpsu driver and added XilSKey_ZynqMP_EfusePs_ReadSysmonVol and XilSKey_ZynqMP_EfusePs_ReadSysmonTemp functions 6.6 vns 06/06/18 Added doxygen tags 6.7 arc 01/05/19 Fixed MISRA-C violations. vns 02/09/19 Fixed buffer overflow access in XilSKey_Efuse_ConvertStringToHexLE() arc 25/02/19 Added asserts for pointer parameter for NULL verification Fixed Length parameter as length in bits for XilSKey_Efuse_ConvertStringToHexBE and added length validations arc 03/13/19 Added assert to validate lengths in XilSKey_Efuse_ValidateKey() arc 03/15/19 Modified initial default status value as XST_FAILURE 6.7 psl 03/21/19 Fixed MISRA-C violation. vns 03/23/19 Fixed CRC calculation for Ultra plus arc 04/04/19 Fixed CPP warnings. 6.8 psl 06/07/19 Added doxygen tags. psl 06/25/19 Fixed Coverity warnings. psl 06/28/19 Added doxygen tags. psl 07/29/19 Fixed MISRA-C violation. vns 08/29/19 Initialized Status variables mmd 07/31/19 Avoided reconfiguration of sysmon, if it is in use 6.9 kpt 02/16/20 Fixed coverity warnings 02/27/20 Replaced XSYSMON_DEVICE_ID with XSYSMON_PSU_DEVICE_ID vns 03/18/20 Fixed Armcc compilation errors 7.0 am 10/04/20 Resolved MISRA C violations 7.1 am 11/26/20 Resolved Coverity warnings kpt 03/17/21 Corrected error code when VCCINT levels are out of range in XilSKey_ZynqMp_EfusePs_Temp_Vol_Checks 7.2 am 07/13/21 Fixed doxygen warnings 7.5 ng 07/13/23 added SDT support
Functions | |
| u32 | XilSKey_EfusePs_XAdcInit (void) |
| This function is used to initialize the XADC driver. More... | |
| void | XilSKey_EfusePs_XAdcReadTemperatureAndVoltage (XSKEfusePs_XAdc *XAdcInstancePtr) |
| This function reads current value of the temperature from sysmon. More... | |
| u32 | XilSKey_ZynqMp_EfusePs_Temp_Vol_Checks (void) |
| This function checks temperature and voltage ranges of ZynqMP to access PS eFUSE. More... | |
| void | XilSKey_Efuse_StartTimer (void) |
| Initializes the global timer & starts it. More... | |
| u64 | XilSKey_Efuse_GetTime (void) |
| Returns the timer ticks from start of timer to till now. More... | |
| void | XilSKey_Efuse_SetTimeOut (volatile u64 *t, u64 us) |
| Calculates the timer ticks to wait to set the time out. More... | |
| u8 | XilSKey_Efuse_IsTimerExpired (u64 t) |
| Checks whether the timer has been expired or not. More... | |
| u32 | XilSKey_Efuse_ConvertStringToHexBE (const char *Str, u8 *Buf, u32 Len) |
| Converts the string into the equivalent Hex buffer. More... | |
| u32 | XilSKey_Efuse_ConvertStringToHexLE (const char *Str, u8 *Buf, u32 Len) |
| Converts the string into the equivalent Hex buffer. More... | |
| void | XilSKey_EfusePs_ConvertBytesBeToLe (const u8 *Be, u8 *Le, u32 Len) |
| This function is used to convert the Big Endian Byte data to Little Endian Byte data For ex: 1234567890abcdef -> 78563412efcdab90. More... | |
| void | XilSKey_Efuse_ConvertBitsToBytes (const u8 *Bits, u8 *Bytes, u32 Len) |
| Convert the Bits to Bytes in Little Endian format Ex: 0x5C -> {0, 0, 1, 1, 1, 0, 1, 0}. More... | |
| void | XilSKey_EfusePs_ConvertBytesToBits (const u8 *Bytes, u8 *Bits, u32 Len) |
| Convert the Bytes to Bits in little endian format 0th byte is LSB, 7th byte is MSB Ex: {0, 0, 1, 1, 1, 0, 1, 0} -> 0x5C. More... | |
| u32 | XilSKey_Efuse_ValidateKey (const char *Key, u32 Len) |
| Validate the key for proper characters & proper length. More... | |
| u32 | XilSKey_Efuse_IsValidChar (const char *c) |
| Checks whether the passed character is a valid hash key character. More... | |
| u32 | XilSKey_Timer_Intialise (void) |
| This API initializes the Timer based on platform. More... | |
| u32 | XilSKey_CrcCalculation (const u8 *Key) |
| This function Calculates CRC value based on hexadecimal string passed. More... | |
| u32 | XilSKey_RowCrcCalculation (u32 PrevCRC, u32 Data, u32 Addr) |
| Calculates CRC value for each row of AES key. More... | |
| u32 | XilSKey_Efuse_ReverseHex (u32 Input) |
| This API reverse the value. More... | |
| u32 | XilSkey_CrcCalculation_AesKey (const u8 *Key) |
| Calculates CRC value of the provided key. More... | |
Variables | |
| u32 | TimerTicksfor1000ns |
| Global Variable for 10 micro secs for microblaze. More... | |
| void XilSKey_Efuse_ConvertBitsToBytes | ( | const u8 * | Bits, |
| u8 * | Bytes, | ||
| u32 | Len | ||
| ) |
Convert the Bits to Bytes in Little Endian format Ex: 0x5C -> {0, 0, 1, 1, 1, 0, 1, 0}.
| Bits | Input Buffer. |
| Bytes | is Output buffer. |
| Len | of the input buffer in bits |
Make sure the bytes array is 0'ed first.
Convert 8 Bit One Byte to 1 Bit 8 Bytes
Convert from LSB -> MSB - Little Endian
If len is not Byte aligned
Referenced by XilSKey_ZynqMp_EfusePs_Write(), XilSKey_ZynqMp_EfusePs_WritePufAux(), XilSKey_ZynqMp_EfusePs_WritePufChash(), and XilSKey_ZynqMp_EfusePs_WritePufHelprData().
| u32 XilSKey_Efuse_ConvertStringToHexBE | ( | const char * | Str, |
| u8 * | Buf, | ||
| u32 | Len | ||
| ) |
Converts the string into the equivalent Hex buffer.
Function used to convert the string to Hex in Little Endian format.
Ex: "abc123" -> {0xab, 0xc1, 0x23}
| Str | is a Input String. Will support the lower and upper case values. Value should be between 0-9, a-f and A-F |
| Buf | is Output buffer. |
| Len | of the input string in bits and it should have even values |
TDD Test Cases: —Initialization— Len is odd Len is zero Str is NULL Buf is NULL —Functionality— Str input with only numbers Str input with All values in A-F Str input with All values in a-f Str input with values in a-f, 0-9, A-F Str input with values in a-z, 0-9, A-Z Boundary Cases Memory Bounds of buffer checking
Check the parameters
Len has to be multiple of 2
Convert char to nibble
Convert char to nibble
Merge upper and lower nibble to Hex
Error converting Lower nibble
Error converting Upper nibble
Converted upper and lower nibbles
References XSK_EFUSEPS_ERROR_INVALID_PARAM, XSK_EFUSEPS_ERROR_PARAMETER_NULL, and XSK_EFUSEPS_ERROR_STRING_INVALID.
Referenced by XilSKey_Bbram_InitData(), XilSKey_CrcCalculation(), and XilSKey_EfusePs_InitData().
| u32 XilSKey_Efuse_ConvertStringToHexLE | ( | const char * | Str, |
| u8 * | Buf, | ||
| u32 | Len | ||
| ) |
Converts the string into the equivalent Hex buffer.
Function used to convert the string to Hex in Little Endian format.
Ex: "abc123" -> {0x23, 0xc1, 0xab}
| Str | is a Input String. Will support the lower and upper case values. Value should be between 0-9, a-f and A-F |
| Buf | is Output buffer. |
| Len | of the input string in bits and it should have even values |
TDD Test Cases: —Initialization— Len is odd Len is zero Str is NULL Buf is NULL —Functionality— Str input with only numbers Str input with All values in A-F Str input with All values in a-f Str input with values in a-f, 0-9, A-F Str input with values in a-z, 0-9, A-Z Boundary Cases Memory Bounds of buffer checking
Check the parameters
Len has to be multiple of 2
Convert char to nibble
Convert char to nibble
Merge upper and lower nibble to Hex
Error converting Lower nibble
Error converting Upper nibble
Converted upper and lower nibbles
References XSK_EFUSEPS_ERROR_INVALID_PARAM, XSK_EFUSEPS_ERROR_PARAMETER_NULL, and XSK_EFUSEPS_ERROR_STRING_INVALID.
Referenced by main(), and XilSKey_EfusePl_InitData().
| u64 XilSKey_Efuse_GetTime | ( | void | ) |
Returns the timer ticks from start of timer to till now.
t - Timer ticks lapsed till now.
Referenced by XilSKey_Efuse_IsTimerExpired(), and XilSKey_Efuse_SetTimeOut().
| u8 XilSKey_Efuse_IsTimerExpired | ( | u64 | t | ) |
Checks whether the timer has been expired or not.
| t | - timeout value in us |
t_end - Returns the global timer value in case of timer expired
References XilSKey_Efuse_GetTime().
Referenced by Bbram_Init(), JtagWrite(), JtagWrite_Ultrascale(), and XilSKey_EfusePs_WriteEfuseBit().
| u32 XilSKey_Efuse_IsValidChar | ( | const char * | c | ) |
Checks whether the passed character is a valid hash key character.
| c | - Character to check proper value |
Referenced by XilSKey_Efuse_ValidateKey().
| u32 XilSKey_Efuse_ReverseHex | ( | u32 | Input | ) |
This API reverse the value.
| Input | is a 32 bit variable |
Referenced by JtagRead_Status_Ultrascale().
| void XilSKey_Efuse_SetTimeOut | ( | volatile u64 * | t, |
| u64 | us | ||
| ) |
Calculates the timer ticks to wait to set the time out.
| t | - timer ticks to wait to set the timeout |
| us | - Timeout period in us |
us: time to wait in microseconds. Convert to clock ticks and add to current time.
References XilSKey_Efuse_GetTime().
Referenced by Bbram_Init(), JtagWrite(), and XilSKey_EfusePs_WriteEfuseBit().
| void XilSKey_Efuse_StartTimer | ( | void | ) |
Initializes the global timer & starts it.
Calculates the timer ticks for 1us.
None
Referenced by JtagWrite_Ultrascale(), and XilSKey_EfusePs_Write().
| u32 XilSKey_Efuse_ValidateKey | ( | const char * | Key, |
| u32 | Len | ||
| ) |
Validate the key for proper characters & proper length.
Function used to validate the AES & RSA key provided as input.
| Key | - Hash Key |
| Len | - Valid length of key |
Make sure the key has valid length
Make sure the key has valid characters
References XilSKey_Efuse_IsValidChar(), XSK_EFUSEPL_ERROR_KEY_VALIDATION, XSK_EFUSEPL_ERROR_NONE, XSK_EFUSEPL_ERROR_NOT_VALID_KEY_CHAR, and XSK_EFUSEPL_ERROR_NOT_VALID_KEY_LENGTH.
Referenced by XilSKey_EfusePl_InitData(), and XilSKey_EfusePs_InitData().
| void XilSKey_EfusePs_ConvertBytesBeToLe | ( | const u8 * | Be, |
| u8 * | Le, | ||
| u32 | Len | ||
| ) |
This function is used to convert the Big Endian Byte data to Little Endian Byte data For ex: 1234567890abcdef -> 78563412efcdab90.
| Be | Big endian data |
| Le | Little endian data |
| Len | Length of data to be converted and it should be in number of words (multiple of 4 bytes) |
TDD Test Cases:
Referenced by XilSKey_ZynqMp_EfusePs_ReadPpk0Hash(), XilSKey_ZynqMp_EfusePs_ReadPpk1Hash(), and XilSKey_ZynqMp_EfusePs_Write().
| void XilSKey_EfusePs_ConvertBytesToBits | ( | const u8 * | Bytes, |
| u8 * | Bits, | ||
| u32 | Len | ||
| ) |
Convert the Bytes to Bits in little endian format 0th byte is LSB, 7th byte is MSB Ex: {0, 0, 1, 1, 1, 0, 1, 0} -> 0x5C.
| Bytes | Input Buffer. |
| Bits | is Output buffer. |
| Len | of the input buffer. |
Make sure the bits array is 0 first.
Convert 1 Bit 8 Bytes to 8 Bit 1 Byte
Store from LSB -> MSB - Little Endian
If Len is not Byte aligned
| u32 XilSKey_EfusePs_XAdcInit | ( | void | ) |
This function is used to initialize the XADC driver.
TDD Cases:
References XSK_EFUSEPS_ERROR_XADC_CONFIG, XSK_EFUSEPS_ERROR_XADC_INITIALIZE, and XSK_EFUSEPS_ERROR_XADC_SELF_TEST.
Referenced by XilSKey_EfusePs_Read(), XilSKey_EfusePs_Write(), and XilSKey_ZynqMp_EfusePs_Init().
| void XilSKey_EfusePs_XAdcReadTemperatureAndVoltage | ( | XSKEfusePs_XAdc * | XAdcInstancePtr | ) |
This function reads current value of the temperature from sysmon.
| XAdcInstancePtr | Pointer to the XSKEfusePs_XAdc. |
| XAdcInstancePtr | Pointer to the XSKEfusePs_XAdc. User has to fill the VType to specify the type of voltage. Valid values for VType are
|
TDD Cases:
References Jtag_Read_Sysmon().
| u32 XilSKey_RowCrcCalculation | ( | u32 | PrevCRC, |
| u32 | Data, | ||
| u32 | Addr | ||
| ) |
Calculates CRC value for each row of AES key.
| PrevCRC | holds the prev row's CRC. |
| Data | holds the present row's key. |
| Addr | stores the current row number. |
Referenced by XilSKey_CrcCalculation(), and XilSkey_CrcCalculation_AesKey().
| u32 XilSKey_Timer_Intialise | ( | void | ) |
This API initializes the Timer based on platform.
References TimerTicksfor1000ns.
Referenced by XilSKey_EfusePs_Read(), and XilSKey_EfusePs_Write().
| u32 XilSKey_ZynqMp_EfusePs_Temp_Vol_Checks | ( | void | ) |
This function checks temperature and voltage ranges of ZynqMP to access PS eFUSE.
Check the temperature and voltage(VCC_AUX and VCC_PINT_LP)
References XSK_EFUSEPS_ERROR_READ_TMEPERATURE_OUT_OF_RANGE, XSK_EFUSEPS_ERROR_READ_VCCPAUX_VOLTAGE_OUT_OF_RANGE, and XSK_EFUSEPS_ERROR_READ_VCCPINT_VOLTAGE_OUT_OF_RANGE.
Referenced by XilSKey_ZynqMp_EfusePs_Write(), XilSKey_ZynqMp_EfusePs_WritePufAux(), XilSKey_ZynqMp_EfusePs_WritePufChash(), and XilSKey_ZynqMp_EfusePs_WritePufHelprData().
| u32 TimerTicksfor1000ns |
Global Variable for 10 micro secs for microblaze.
Referenced by JtagWrite_Ultrascale(), and XilSKey_Timer_Intialise().