lib/sw_services/xilnvm/examples/xilnvm_efuse_versal_client_example.c
static int XilNvm_EfuseInitIVs(XNvm_EfuseDataAddr *WriteEfuse,
	XNvm_EfuseIvs *Ivs)
{
	int Status = XST_FAILURE;

	Ivs->PrgmMetaHeaderIv = XNVM_EFUSE_WRITE_METAHEADER_IV;
	Ivs->PrgmBlkObfusIv = XNVM_EFUSE_WRITE_BLACK_OBFUS_IV;
	Ivs->PrgmPlmIv = XNVM_EFUSE_WRITE_PLM_IV;
	Ivs->PrgmDataPartitionIv = XNVM_EFUSE_WRITE_DATA_PARTITION_IV;

	if (Ivs->PrgmMetaHeaderIv == TRUE) {
		Status = XilNvm_PrepareIvForWrite(XNVM_EFUSE_META_HEADER_IV,
						(u8 *)Ivs->MetaHeaderIv,
						XNVM_EFUSE_IV_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (Ivs->PrgmBlkObfusIv == TRUE) {
		Status = XilNvm_PrepareIvForWrite(XNVM_EFUSE_BLACK_OBFUS_IV,
						(u8 *)Ivs->BlkObfusIv,
						XNVM_EFUSE_IV_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (Ivs->PrgmPlmIv == TRUE) {
		Status = XilNvm_PrepareIvForWrite(XNVM_EFUSE_PLM_IV,
						(u8 *)Ivs->PlmIv,
						XNVM_EFUSE_IV_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (Ivs->PrgmDataPartitionIv == TRUE) {
		Status = XilNvm_PrepareIvForWrite(XNVM_EFUSE_DATA_PARTITION_IV,
						(u8 *)Ivs->DataPartitionIv,
						XNVM_EFUSE_IV_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (Status == XST_SUCCESS) {
		Xil_DCacheFlushRange((UINTPTR)Ivs, sizeof(XNvm_EfuseIvs));
		WriteEfuse->IvAddr = (UINTPTR)Ivs;
	}

	Status = XST_SUCCESS;

END:
	return Status;
}
/****************************************************************************/
/**
 * This function is used to initialize XNvm_EfuseIvs structure with user
 * provided data and assign the same to global structure XNvm_EfuseDataAddr to
 * program IV eFuses.
 *
 * typedef struct {
 *	u8 PrgmMetaHeaderIv;
 *	u8 PrgmBlkObfusIv;
 *	u8 PrgmPlmIv;
 *	u8 PrgmDataPartitionIv;
 *	u32 MetaHeaderIv[XNVM_EFUSE_IV_LEN_IN_WORDS];
 *	u32 BlkObfusIv[XNVM_EFUSE_IV_LEN_IN_WORDS];
 *	u32 PlmIv[XNVM_EFUSE_IV_LEN_IN_WORDS];
 *	u32 DataPartitionIv[XNVM_EFUSE_IV_LEN_IN_WORDS];
 * }XNvm_EfuseIvs;
 *
 * @param	WriteEfuse      Pointer to XNvm_EfuseDataAddr structure
 *
 * @param 	Ivs		Pointer to XNvm_EfuseIvs structure
 *
 * @return
 *		- XST_SUCCESS - If the initialization of XNvm_EfuseIvs structure
 *				is successful
 *		- Error Code - On Failure.
 *
 ******************************************************************************/
This function is used to initialize XNvm_EfuseIvs structure with user
provided data and assign the same to global structure XNvm_EfuseDataAddr to
program IV eFuses.





@param       Ivs             Pointer to XNvm_EfuseIvs structure

@return
- XST_SUCCESS - If the initialization of XNvm_EfuseIvs structure
is successful
- Error Code - On Failure.
This function is used to initialize XNvm_EfuseIvs structure with user provided data and assign the same to global structure XNvm_EfuseDataAddr to program IV eFuses . @param Ivs Pointer to XNvm_EfuseIvs structure @return - XST_SUCCESS - If the initialization of XNvm_EfuseIvs structure is successful - Error Code - On Failure .
static int XilNvm_EfuseInitIVs(XNvm_EfuseDataAddr *WriteEfuse,
	XNvm_EfuseIvs *Ivs)
{
	int Status = XST_FAILURE;
	Ivs->PrgmMetaHeaderIv = XNVM_EFUSE_WRITE_METAHEADER_IV;
	Ivs->PrgmBlkObfusIv = XNVM_EFUSE_WRITE_BLACK_OBFUS_IV;
	Ivs->PrgmPlmIv = XNVM_EFUSE_WRITE_PLM_IV;
	Ivs->PrgmDataPartitionIv = XNVM_EFUSE_WRITE_DATA_PARTITION_IV;
	if (Ivs->PrgmMetaHeaderIv == TRUE) {
		Status = XilNvm_PrepareIvForWrite(XNVM_EFUSE_META_HEADER_IV,
						(u8 *)Ivs->MetaHeaderIv,
						XNVM_EFUSE_IV_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (Ivs->PrgmBlkObfusIv == TRUE) {
		Status = XilNvm_PrepareIvForWrite(XNVM_EFUSE_BLACK_OBFUS_IV,
						(u8 *)Ivs->BlkObfusIv,
						XNVM_EFUSE_IV_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (Ivs->PrgmPlmIv == TRUE) {
		Status = XilNvm_PrepareIvForWrite(XNVM_EFUSE_PLM_IV,
						(u8 *)Ivs->PlmIv,
						XNVM_EFUSE_IV_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (Ivs->PrgmDataPartitionIv == TRUE) {
		Status = XilNvm_PrepareIvForWrite(XNVM_EFUSE_DATA_PARTITION_IV,
						(u8 *)Ivs->DataPartitionIv,
						XNVM_EFUSE_IV_LEN_IN_BITS);
		if (Status != XST_SUCCESS) {
			goto END;
		}
	}
	if (Status == XST_SUCCESS) {
		Xil_DCacheFlushRange((UINTPTR)Ivs, sizeof(XNvm_EfuseIvs));
		WriteEfuse->IvAddr = (UINTPTR)Ivs;
	}
	Status = XST_SUCCESS;
END:
	return Status;
}
static int XilNvm_EfuseInitIVs ( XNvm_EfuseDataAddr * WriteEfuse , XNvm_EfuseIvs * Ivs ) { int Status = XST_FAILURE ; Ivs -> PrgmMetaHeaderIv = XNVM_EFUSE_WRITE_METAHEADER_IV ; Ivs -> PrgmBlkObfusIv = XNVM_EFUSE_WRITE_BLACK_OBFUS_IV ; Ivs -> PrgmPlmIv = XNVM_EFUSE_WRITE_PLM_IV ; Ivs -> PrgmDataPartitionIv = XNVM_EFUSE_WRITE_DATA_PARTITION_IV ; if ( Ivs -> PrgmMetaHeaderIv == TRUE ) { Status = XilNvm_PrepareIvForWrite ( XNVM_EFUSE_META_HEADER_IV , ( u8 * ) Ivs -> MetaHeaderIv , XNVM_EFUSE_IV_LEN_IN_BITS ) ; if ( Status != XST_SUCCESS ) { goto END ; } } if ( Ivs -> PrgmBlkObfusIv == TRUE ) { Status = XilNvm_PrepareIvForWrite ( XNVM_EFUSE_BLACK_OBFUS_IV , ( u8 * ) Ivs -> BlkObfusIv , XNVM_EFUSE_IV_LEN_IN_BITS ) ; if ( Status != XST_SUCCESS ) { goto END ; } } if ( Ivs -> PrgmPlmIv == TRUE ) { Status = XilNvm_PrepareIvForWrite ( XNVM_EFUSE_PLM_IV , ( u8 * ) Ivs -> PlmIv , XNVM_EFUSE_IV_LEN_IN_BITS ) ; if ( Status != XST_SUCCESS ) { goto END ; } } if ( Ivs -> PrgmDataPartitionIv == TRUE ) { Status = XilNvm_PrepareIvForWrite ( XNVM_EFUSE_DATA_PARTITION_IV , ( u8 * ) Ivs -> DataPartitionIv , XNVM_EFUSE_IV_LEN_IN_BITS ) ; if ( Status != XST_SUCCESS ) { goto END ; } } if ( Status == XST_SUCCESS ) { Xil_DCacheFlushRange ( ( UINTPTR ) Ivs , sizeof ( XNvm_EfuseIvs ) ) ; WriteEfuse -> IvAddr = ( UINTPTR ) Ivs ; } Status = XST_SUCCESS ; END : return Status ; }
This function is used to initialize XNvm_EfuseIvs structure with user
 provided data and assign the same to global structure XNvm_EfuseDataAddr to
 program IV eFuses.
This function is used to initialize XNvm_EfuseIvs structure with user provided data and assign the same to global structure XNvm_EfuseDataAddr to program IV eFuses .