lib/sw_services/xilnvm/examples/xilnvm_efuse_versal_client_example.c
static int XilNvm_EfuseInitSecCtrl(XNvm_EfuseDataAddr *WriteEfuse,
	XNvm_EfuseSecCtrlBits *SecCtrlBits)
{
	int Status = XST_FAILURE;

	SecCtrlBits->AesDis = XNVM_EFUSE_AES_DIS;
	SecCtrlBits->JtagErrOutDis = XNVM_EFUSE_JTAG_ERROR_OUT_DIS;
	SecCtrlBits->JtagDis = XNVM_EFUSE_JTAG_DIS;
	SecCtrlBits->SecDbgDis = XNVM_EFUSE_AUTH_JTAG_DIS;
	SecCtrlBits->SecLockDbgDis = XNVM_EFUSE_AUTH_JTAG_LOCK_DIS;
	SecCtrlBits->BootEnvWrLk = XNVM_EFUSE_BOOT_ENV_WR_LK;
	SecCtrlBits->RegInitDis = XNVM_EFUSE_REG_INIT_DIS;
	SecCtrlBits->Ppk0WrLk = XNVM_EFUSE_PPK0_WR_LK;
	SecCtrlBits->Ppk1WrLk = XNVM_EFUSE_PPK1_WR_LK;
	SecCtrlBits->Ppk2WrLk = XNVM_EFUSE_PPK2_WR_LK;
	SecCtrlBits->AesCrcLk = XNVM_EFUSE_AES_CRC_LK;
	SecCtrlBits->AesWrLk = 	XNVM_EFUSE_AES_WR_LK;
	SecCtrlBits->UserKey0CrcLk = XNVM_EFUSE_USER_KEY_0_CRC_LK;
	SecCtrlBits->UserKey0WrLk = XNVM_EFUSE_USER_KEY_0_WR_LK;
	SecCtrlBits->UserKey1CrcLk = XNVM_EFUSE_USER_KEY_1_CRC_LK;
	SecCtrlBits->UserKey1WrLk = XNVM_EFUSE_USER_KEY_1_WR_LK;

	if ((SecCtrlBits->AesDis == TRUE) ||
		(SecCtrlBits->JtagErrOutDis == TRUE) ||
		(SecCtrlBits->JtagDis == TRUE) ||
		(SecCtrlBits->SecDbgDis == TRUE) ||
		(SecCtrlBits->SecLockDbgDis == TRUE) ||
		(SecCtrlBits->BootEnvWrLk == TRUE) ||
		(SecCtrlBits->Ppk0WrLk == TRUE) ||
		(SecCtrlBits->Ppk0WrLk == TRUE) ||
		(SecCtrlBits->Ppk2WrLk == TRUE) ||
		(SecCtrlBits->AesCrcLk == TRUE) ||
		(SecCtrlBits->AesWrLk == TRUE) ||
		(SecCtrlBits->UserKey0CrcLk == TRUE) ||
		(SecCtrlBits->UserKey0WrLk == TRUE) ||
		(SecCtrlBits->UserKey1CrcLk == TRUE) ||
		(SecCtrlBits->UserKey1WrLk == TRUE)) {
		Xil_DCacheFlushRange((UINTPTR)SecCtrlBits,
			sizeof(XNvm_EfuseSecCtrlBits));
		WriteEfuse->SecCtrlAddr = (UINTPTR)SecCtrlBits;
	}

	Status = XST_SUCCESS;

	return Status;
}
/******************************************************************************/
/**
 * This function is used to initialize the XNvm_EfuseSecCtrlBits structure with
 * user provided data and assign the same to global structure XNvm_EfuseDataAddr
 * to program SECURITY_CONTROL eFuses.
 *
 * typedef struct {
 *	u8 AesDis;
 *	u8 JtagErrOutDis;
 *	u8 JtagDis;
 *	u8 Ppk0WrLk;
 *	u8 Ppk1WrLk;
 *	u8 Ppk2WrLk;
 *	u8 AesCrcLk;
 *	u8 AesWrLk;
 *	u8 UserKey0CrcLk;
 *	u8 UserKey0WrLk;
 *	u8 UserKey1CrcLk;
 *	u8 UserKey1WrLk;
 *	u8 SecDbgDis;
 *	u8 SecLockDbgDis;
 *	u8 BootEnvWrLk;
 *	u8 RegInitDis;
 * }XNvm_EfuseSecCtrlBits;
 *
 * @param	WriteEfuse	Pointer to XNvm_EfuseDataAddr structure.
 *
 * @param 	SecCtrlBits	Pointer to XNvm_EfuseSecCtrlBits structure.
 *
 * @return
 *		- XST_SUCCESS - If the initialization of XNvm_EfuseSecCtrlBits
 *				structure is successful
 *		- ErrCode - On failure
 *
 ******************************************************************************/
This function is used to initialize the XNvm_EfuseSecCtrlBits structure with
user provided data and assign the same to global structure XNvm_EfuseDataAddr
to program SECURITY_CONTROL eFuses.







@return
- XST_SUCCESS - If the initialization of XNvm_EfuseSecCtrlBits
structure is successful
- ErrCode - On failure
This function is used to initialize the XNvm_EfuseSecCtrlBits structure with user provided data and assign the same to global structure XNvm_EfuseDataAddr to program SECURITY_CONTROL eFuses . @return - XST_SUCCESS - If the initialization of XNvm_EfuseSecCtrlBits structure is successful - ErrCode - On failure
static int XilNvm_EfuseInitSecCtrl(XNvm_EfuseDataAddr *WriteEfuse,
	XNvm_EfuseSecCtrlBits *SecCtrlBits)
{
	int Status = XST_FAILURE;
	SecCtrlBits->AesDis = XNVM_EFUSE_AES_DIS;
	SecCtrlBits->JtagErrOutDis = XNVM_EFUSE_JTAG_ERROR_OUT_DIS;
	SecCtrlBits->JtagDis = XNVM_EFUSE_JTAG_DIS;
	SecCtrlBits->SecDbgDis = XNVM_EFUSE_AUTH_JTAG_DIS;
	SecCtrlBits->SecLockDbgDis = XNVM_EFUSE_AUTH_JTAG_LOCK_DIS;
	SecCtrlBits->BootEnvWrLk = XNVM_EFUSE_BOOT_ENV_WR_LK;
	SecCtrlBits->RegInitDis = XNVM_EFUSE_REG_INIT_DIS;
	SecCtrlBits->Ppk0WrLk = XNVM_EFUSE_PPK0_WR_LK;
	SecCtrlBits->Ppk1WrLk = XNVM_EFUSE_PPK1_WR_LK;
	SecCtrlBits->Ppk2WrLk = XNVM_EFUSE_PPK2_WR_LK;
	SecCtrlBits->AesCrcLk = XNVM_EFUSE_AES_CRC_LK;
	SecCtrlBits->AesWrLk = 	XNVM_EFUSE_AES_WR_LK;
	SecCtrlBits->UserKey0CrcLk = XNVM_EFUSE_USER_KEY_0_CRC_LK;
	SecCtrlBits->UserKey0WrLk = XNVM_EFUSE_USER_KEY_0_WR_LK;
	SecCtrlBits->UserKey1CrcLk = XNVM_EFUSE_USER_KEY_1_CRC_LK;
	SecCtrlBits->UserKey1WrLk = XNVM_EFUSE_USER_KEY_1_WR_LK;
	if ((SecCtrlBits->AesDis == TRUE) ||
		(SecCtrlBits->JtagErrOutDis == TRUE) ||
		(SecCtrlBits->JtagDis == TRUE) ||
		(SecCtrlBits->SecDbgDis == TRUE) ||
		(SecCtrlBits->SecLockDbgDis == TRUE) ||
		(SecCtrlBits->BootEnvWrLk == TRUE) ||
		(SecCtrlBits->Ppk0WrLk == TRUE) ||
		(SecCtrlBits->Ppk0WrLk == TRUE) ||
		(SecCtrlBits->Ppk2WrLk == TRUE) ||
		(SecCtrlBits->AesCrcLk == TRUE) ||
		(SecCtrlBits->AesWrLk == TRUE) ||
		(SecCtrlBits->UserKey0CrcLk == TRUE) ||
		(SecCtrlBits->UserKey0WrLk == TRUE) ||
		(SecCtrlBits->UserKey1CrcLk == TRUE) ||
		(SecCtrlBits->UserKey1WrLk == TRUE)) {
		Xil_DCacheFlushRange((UINTPTR)SecCtrlBits,
			sizeof(XNvm_EfuseSecCtrlBits));
		WriteEfuse->SecCtrlAddr = (UINTPTR)SecCtrlBits;
	}
	Status = XST_SUCCESS;
	return Status;
}
static int XilNvm_EfuseInitSecCtrl ( XNvm_EfuseDataAddr * WriteEfuse , XNvm_EfuseSecCtrlBits * SecCtrlBits ) { int Status = XST_FAILURE ; SecCtrlBits -> AesDis = XNVM_EFUSE_AES_DIS ; SecCtrlBits -> JtagErrOutDis = XNVM_EFUSE_JTAG_ERROR_OUT_DIS ; SecCtrlBits -> JtagDis = XNVM_EFUSE_JTAG_DIS ; SecCtrlBits -> SecDbgDis = XNVM_EFUSE_AUTH_JTAG_DIS ; SecCtrlBits -> SecLockDbgDis = XNVM_EFUSE_AUTH_JTAG_LOCK_DIS ; SecCtrlBits -> BootEnvWrLk = XNVM_EFUSE_BOOT_ENV_WR_LK ; SecCtrlBits -> RegInitDis = XNVM_EFUSE_REG_INIT_DIS ; SecCtrlBits -> Ppk0WrLk = XNVM_EFUSE_PPK0_WR_LK ; SecCtrlBits -> Ppk1WrLk = XNVM_EFUSE_PPK1_WR_LK ; SecCtrlBits -> Ppk2WrLk = XNVM_EFUSE_PPK2_WR_LK ; SecCtrlBits -> AesCrcLk = XNVM_EFUSE_AES_CRC_LK ; SecCtrlBits -> AesWrLk = XNVM_EFUSE_AES_WR_LK ; SecCtrlBits -> UserKey0CrcLk = XNVM_EFUSE_USER_KEY_0_CRC_LK ; SecCtrlBits -> UserKey0WrLk = XNVM_EFUSE_USER_KEY_0_WR_LK ; SecCtrlBits -> UserKey1CrcLk = XNVM_EFUSE_USER_KEY_1_CRC_LK ; SecCtrlBits -> UserKey1WrLk = XNVM_EFUSE_USER_KEY_1_WR_LK ; if ( ( SecCtrlBits -> AesDis == TRUE ) || ( SecCtrlBits -> JtagErrOutDis == TRUE ) || ( SecCtrlBits -> JtagDis == TRUE ) || ( SecCtrlBits -> SecDbgDis == TRUE ) || ( SecCtrlBits -> SecLockDbgDis == TRUE ) || ( SecCtrlBits -> BootEnvWrLk == TRUE ) || ( SecCtrlBits -> Ppk0WrLk == TRUE ) || ( SecCtrlBits -> Ppk0WrLk == TRUE ) || ( SecCtrlBits -> Ppk2WrLk == TRUE ) || ( SecCtrlBits -> AesCrcLk == TRUE ) || ( SecCtrlBits -> AesWrLk == TRUE ) || ( SecCtrlBits -> UserKey0CrcLk == TRUE ) || ( SecCtrlBits -> UserKey0WrLk == TRUE ) || ( SecCtrlBits -> UserKey1CrcLk == TRUE ) || ( SecCtrlBits -> UserKey1WrLk == TRUE ) ) { Xil_DCacheFlushRange ( ( UINTPTR ) SecCtrlBits , sizeof ( XNvm_EfuseSecCtrlBits ) ) ; WriteEfuse -> SecCtrlAddr = ( UINTPTR ) SecCtrlBits ; } Status = XST_SUCCESS ; return Status ; }
This function is used to initialize the XNvm_EfuseSecCtrlBits structure with
 user provided data and assign the same to global structure XNvm_EfuseDataAddr
 to program SECURITY_CONTROL eFuses.
This function is used to initialize the XNvm_EfuseSecCtrlBits structure with user provided data and assign the same to global structure XNvm_EfuseDataAddr to program SECURITY_CONTROL eFuses .