lib/sw_services/xilnvm/examples/xilnvm_efuse_versal_client_example.c
static int XilNvm_EfuseInitPpkHash(XNvm_EfuseDataAddr *WriteEfuse,
	XNvm_EfusePpkHash *PpkHash)
{
	int Status = XST_FAILURE;

	PpkHash->PrgmPpk0Hash = XNVM_EFUSE_WRITE_PPK0_HASH;
	PpkHash->PrgmPpk1Hash = XNVM_EFUSE_WRITE_PPK1_HASH;
	PpkHash->PrgmPpk2Hash = XNVM_EFUSE_WRITE_PPK2_HASH;

	if (PpkHash->PrgmPpk0Hash == TRUE) {
		Status = XilNvm_ValidateHash((char *)XNVM_EFUSE_PPK0_HASH,
					XNVM_EFUSE_PPK_HASH_STRING_LEN);
		if(Status != XST_SUCCESS) {
			xil_printf("Ppk0Hash string validation failed\r\n");
			goto END;
		}
		Status = Xil_ConvertStringToHexBE((char *)XNVM_EFUSE_PPK0_HASH,
						(u8 *)PpkHash->Ppk0Hash,
			XNVM_EFUSE_PPK_HASH_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (PpkHash->PrgmPpk1Hash == TRUE) {
		Status = XilNvm_ValidateHash((char *)XNVM_EFUSE_PPK1_HASH,
					XNVM_EFUSE_PPK_HASH_STRING_LEN);
		if(Status != XST_SUCCESS) {
			xil_printf("Ppk1Hash string validation failed\r\n");
			goto END;
		}
		Status = Xil_ConvertStringToHexBE((char *)XNVM_EFUSE_PPK1_HASH,
					(u8 *)PpkHash->Ppk1Hash,
					XNVM_EFUSE_PPK_HASH_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (PpkHash->PrgmPpk2Hash == TRUE) {
		Status = XilNvm_ValidateHash((char *)XNVM_EFUSE_PPK2_HASH,
					XNVM_EFUSE_PPK_HASH_STRING_LEN);
		if(Status != XST_SUCCESS) {
			xil_printf("Ppk1Hash string validation failed\r\n");
			goto END;
		}
		Status = Xil_ConvertStringToHexBE((char *)XNVM_EFUSE_PPK2_HASH,
					(u8 *)PpkHash->Ppk2Hash,
					XNVM_EFUSE_PPK_HASH_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}

	if (Status == XST_SUCCESS) {
		Xil_DCacheFlushRange((UINTPTR)PpkHash,
			sizeof(XNvm_EfusePpkHash));
		WriteEfuse->PpkHashAddr = (UINTPTR)PpkHash;
	}

	Status = XST_SUCCESS;

END:
	return Status;
}
/****************************************************************************/
/**
 * This function is used to initialize the XNvm_EfusePpkHash structure with
 * user provided data and assign it to global struture XNvm_EfuseDataAddr to
 * program PPK0/PPK1/PPK2 hash eFuses
 *
 * typedef struct {
 *	u8 PrgmPpk0Hash;
 *	u8 PrgmPpk1Hash;
 *	u8 PrgmPpk2Hash;
 *	u32 Ppk0Hash[XNVM_EFUSE_PPK_HASH_LEN_IN_WORDS];
 *	u32 Ppk1Hash[XNVM_EFUSE_PPK_HASH_LEN_IN_WORDS];
 *	u32 Ppk2Hash[XNVM_EFUSE_PPK_HASH_LEN_IN_WORDS];
 * }XNvm_EfusePpkHash;
 *
 * @param	WriteEfuse	Pointer to XNvm_EfuseDataAddr structure.
 *
 * @param 	PpkHash		Pointer to XNvm_EfusePpkHash structure.
 *
 * @return
 *		- XST_SUCCESS - If initialization of XNvm_EfusePpkHash structure
 *				is successful
 *		- ErrorCode - On Failure
 *
 ******************************************************************************/
This function is used to initialize the XNvm_EfusePpkHash structure with
user provided data and assign it to global struture XNvm_EfuseDataAddr to
program PPK0/PPK1/PPK2 hash eFuses







@return
- XST_SUCCESS - If initialization of XNvm_EfusePpkHash structure
is successful
- ErrorCode - On Failure
This function is used to initialize the XNvm_EfusePpkHash structure with user provided data and assign it to global struture XNvm_EfuseDataAddr to program PPK0 / PPK1 / PPK2 hash eFuses @return - XST_SUCCESS - If initialization of XNvm_EfusePpkHash structure is successful - ErrorCode - On Failure
static int XilNvm_EfuseInitPpkHash(XNvm_EfuseDataAddr *WriteEfuse,
	XNvm_EfusePpkHash *PpkHash)
{
	int Status = XST_FAILURE;
	PpkHash->PrgmPpk0Hash = XNVM_EFUSE_WRITE_PPK0_HASH;
	PpkHash->PrgmPpk1Hash = XNVM_EFUSE_WRITE_PPK1_HASH;
	PpkHash->PrgmPpk2Hash = XNVM_EFUSE_WRITE_PPK2_HASH;
	if (PpkHash->PrgmPpk0Hash == TRUE) {
		Status = XilNvm_ValidateHash((char *)XNVM_EFUSE_PPK0_HASH,
					XNVM_EFUSE_PPK_HASH_STRING_LEN);
		if(Status != XST_SUCCESS) {
			xil_printf("Ppk0Hash string validation failed\r\n");
			goto END;
		}
		Status = Xil_ConvertStringToHexBE((char *)XNVM_EFUSE_PPK0_HASH,
						(u8 *)PpkHash->Ppk0Hash,
			XNVM_EFUSE_PPK_HASH_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (PpkHash->PrgmPpk1Hash == TRUE) {
		Status = XilNvm_ValidateHash((char *)XNVM_EFUSE_PPK1_HASH,
					XNVM_EFUSE_PPK_HASH_STRING_LEN);
		if(Status != XST_SUCCESS) {
			xil_printf("Ppk1Hash string validation failed\r\n");
			goto END;
		}
		Status = Xil_ConvertStringToHexBE((char *)XNVM_EFUSE_PPK1_HASH,
					(u8 *)PpkHash->Ppk1Hash,
					XNVM_EFUSE_PPK_HASH_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (PpkHash->PrgmPpk2Hash == TRUE) {
		Status = XilNvm_ValidateHash((char *)XNVM_EFUSE_PPK2_HASH,
					XNVM_EFUSE_PPK_HASH_STRING_LEN);
		if(Status != XST_SUCCESS) {
			xil_printf("Ppk1Hash string validation failed\r\n");
			goto END;
		}
		Status = Xil_ConvertStringToHexBE((char *)XNVM_EFUSE_PPK2_HASH,
					(u8 *)PpkHash->Ppk2Hash,
					XNVM_EFUSE_PPK_HASH_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (Status == XST_SUCCESS) {
		Xil_DCacheFlushRange((UINTPTR)PpkHash,
			sizeof(XNvm_EfusePpkHash));
		WriteEfuse->PpkHashAddr = (UINTPTR)PpkHash;
	}
	Status = XST_SUCCESS;
END:
	return Status;
}
static int XilNvm_EfuseInitPpkHash ( XNvm_EfuseDataAddr * WriteEfuse , XNvm_EfusePpkHash * PpkHash ) { int Status = XST_FAILURE ; PpkHash -> PrgmPpk0Hash = XNVM_EFUSE_WRITE_PPK0_HASH ; PpkHash -> PrgmPpk1Hash = XNVM_EFUSE_WRITE_PPK1_HASH ; PpkHash -> PrgmPpk2Hash = XNVM_EFUSE_WRITE_PPK2_HASH ; if ( PpkHash -> PrgmPpk0Hash == TRUE ) { Status = XilNvm_ValidateHash ( ( char * ) XNVM_EFUSE_PPK0_HASH , XNVM_EFUSE_PPK_HASH_STRING_LEN ) ; if ( Status != XST_SUCCESS ) { xil_printf ( " \r \n " ) ; goto END ; } Status = Xil_ConvertStringToHexBE ( ( char * ) XNVM_EFUSE_PPK0_HASH , ( u8 * ) PpkHash -> Ppk0Hash , XNVM_EFUSE_PPK_HASH_LEN_IN_BITS ) ; if ( Status != XST_SUCCESS ) { goto END ; } } if ( PpkHash -> PrgmPpk1Hash == TRUE ) { Status = XilNvm_ValidateHash ( ( char * ) XNVM_EFUSE_PPK1_HASH , XNVM_EFUSE_PPK_HASH_STRING_LEN ) ; if ( Status != XST_SUCCESS ) { xil_printf ( " \r \n " ) ; goto END ; } Status = Xil_ConvertStringToHexBE ( ( char * ) XNVM_EFUSE_PPK1_HASH , ( u8 * ) PpkHash -> Ppk1Hash , XNVM_EFUSE_PPK_HASH_LEN_IN_BITS ) ; if ( Status != XST_SUCCESS ) { goto END ; } } if ( PpkHash -> PrgmPpk2Hash == TRUE ) { Status = XilNvm_ValidateHash ( ( char * ) XNVM_EFUSE_PPK2_HASH , XNVM_EFUSE_PPK_HASH_STRING_LEN ) ; if ( Status != XST_SUCCESS ) { xil_printf ( " \r \n " ) ; goto END ; } Status = Xil_ConvertStringToHexBE ( ( char * ) XNVM_EFUSE_PPK2_HASH , ( u8 * ) PpkHash -> Ppk2Hash , XNVM_EFUSE_PPK_HASH_LEN_IN_BITS ) ; if ( Status != XST_SUCCESS ) { goto END ; } } if ( Status == XST_SUCCESS ) { Xil_DCacheFlushRange ( ( UINTPTR ) PpkHash , sizeof ( XNvm_EfusePpkHash ) ) ; WriteEfuse -> PpkHashAddr = ( UINTPTR ) PpkHash ; } Status = XST_SUCCESS ; END : return Status ; }
This function is used to initialize the XNvm_EfusePpkHash structure with
 user provided data and assign it to global struture XNvm_EfuseDataAddr to
 program PPK0/PPK1/PPK2 hash eFuses
This function is used to initialize the XNvm_EfusePpkHash structure with user provided data and assign it to global struture XNvm_EfuseDataAddr to program PPK0 / PPK1 / PPK2 hash eFuses