lib/sw_services/xilnvm/examples/xilnvm_efuse_versal_client_example.c
static int XilNvm_EfuseInitBootEnvCtrl(XNvm_EfuseDataAddr *WriteEfuse,
	XNvm_EfuseBootEnvCtrlBits *BootEnvCtrl)
{
	int Status = XST_FAILURE;

	BootEnvCtrl->SysmonTempEn = XNVM_EFUSE_SYSMON_TEMP_EN;
	BootEnvCtrl->SysmonVoltEn = XNVM_EFUSE_SYSMON_VOLT_EN;
	BootEnvCtrl->SysmonVoltSoc = XNVM_EFUSE_SYSMON_VOLT_SOC;
	BootEnvCtrl->PrgmSysmonTempHot = XNVM_EFUSE_SYSMON_TEMP_HOT;
	BootEnvCtrl->PrgmSysmonVoltPmc = XNVM_EFUSE_SYSMON_VOLT_PMC;
	BootEnvCtrl->PrgmSysmonVoltPslp = XNVM_EFUSE_SYSMON_VOLT_PSLP;
	BootEnvCtrl->PrgmSysmonTempCold = XNVM_EFUSE_SYSMON_TEMP_COLD;

	if (BootEnvCtrl->PrgmSysmonTempHot == TRUE) {
		if (XNVM_EFUSE_SYSMON_TEMP_HOT_FUSES >
			XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX) {
			xil_printf("Invalid i/p for"
				" XNVM_EFUSE_SYSMON_TEMP_HOT_FUSES\r\n");
			goto END;
		}
		BootEnvCtrl->SysmonTempHot = XNVM_EFUSE_SYSMON_TEMP_HOT_FUSES;
	}
	if (BootEnvCtrl->PrgmSysmonVoltPmc == TRUE) {
		if (XNVM_EFUSE_SYSMON_VOLT_PMC_FUSES >
			XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX) {
			xil_printf("Invalid i/p for"
				" XNVM_EFUSE_SYSMON_VOLT_PMC_FUSES\r\n");
			goto END;
		}
		BootEnvCtrl->SysmonVoltPmc = XNVM_EFUSE_SYSMON_VOLT_PMC_FUSES;
	}
	if (BootEnvCtrl->PrgmSysmonVoltPslp == TRUE) {
		if (XNVM_EFUSE_SYSMON_VOLT_PSLP_FUSE >
			XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX) {
			xil_printf("Invalid i/p for"
					 "XNVM_EFUSE_SYSMON_VOLT_PSLP_FUSE\r\n");
			goto END;
		}
		BootEnvCtrl->SysmonVoltPslp = XNVM_EFUSE_SYSMON_VOLT_PSLP_FUSE;
	}
	if (BootEnvCtrl->PrgmSysmonTempCold == TRUE) {
		if (XNVM_EFUSE_SYSMON_TEMP_COLD_FUSES >
			XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX) {
			xil_printf("Invalid i/p for"
					" XNVM_EFUSE_SYSMON_TEMP_COLD_FUSES\r\n");
			goto END;
		}
		BootEnvCtrl->SysmonTempCold = XNVM_EFUSE_SYSMON_TEMP_COLD_FUSES;
	}

	if ((BootEnvCtrl->SysmonTempEn == TRUE) ||
		(BootEnvCtrl->SysmonVoltEn == TRUE) ||
		(BootEnvCtrl->SysmonVoltSoc == TRUE) ||
		(BootEnvCtrl->PrgmSysmonTempHot == TRUE) ||
		(BootEnvCtrl->PrgmSysmonVoltPmc == TRUE) ||
		(BootEnvCtrl->PrgmSysmonVoltPslp == TRUE) ||
		(BootEnvCtrl->PrgmSysmonTempCold == TRUE)) {
		Xil_DCacheFlushRange((UINTPTR)BootEnvCtrl,
			sizeof(XNvm_EfuseBootEnvCtrlBits));
		WriteEfuse->BootEnvCtrlAddr = (UINTPTR)BootEnvCtrl;
	}

	Status = XST_SUCCESS;

END:
	return Status;
}
/******************************************************************************/
/**
 * This function is used to initialize XNvm_EfuseBootEnvCtrlBits structure with
 * user provided data and assign the same to global structure XNvm_EfuseDataAddr
 * to program XNvm_EfuseBootEnvCtrlBits eFuses.
 *
 * typedef struct {
 *	u8 PrgmSysmonTempHot;
 *	u8 PrgmSysmonVoltPmc;
 *	u8 PrgmSysmonVoltPslp;
 * 	u8 PrgmSysmonVoltSoc;
 *	u8 PrgmSysmonTempCold;
 *	u8 SysmonTempEn;
 *	u8 SysmonVoltEn;
 * 	u8 SysmonTempHot;
 *	u8 SysmonVoltPmc;
 *	u8 SysmonVoltPslp;
 *	u8 SysmonVoltSoc;
 *	u8 SysmonTempCold;
 * }XNvm_EfuseBootEnvCtrlBits;
 *
 * @param	WriteEfuse	Pointer to XNvm_EfuseDataAddr structure
 *
 * @param 	BootEnvCtrl	Pointer to XNvm_EfuseBootEnvCtrlBits structure
 *
 * @return
 *		- XST_SUCCESS - If the initialization XNvm_EfuseBootEnvCtrlBits
 *				structure is successful
 *		- Error Code - On Failure.
 *
 ******************************************************************************/
This function is used to initialize XNvm_EfuseBootEnvCtrlBits structure with
user provided data and assign the same to global structure XNvm_EfuseDataAddr
to program XNvm_EfuseBootEnvCtrlBits eFuses.







@return
- XST_SUCCESS - If the initialization XNvm_EfuseBootEnvCtrlBits
structure is successful
- Error Code - On Failure.
This function is used to initialize XNvm_EfuseBootEnvCtrlBits structure with user provided data and assign the same to global structure XNvm_EfuseDataAddr to program XNvm_EfuseBootEnvCtrlBits eFuses . @return - XST_SUCCESS - If the initialization XNvm_EfuseBootEnvCtrlBits structure is successful - Error Code - On Failure .
static int XilNvm_EfuseInitBootEnvCtrl(XNvm_EfuseDataAddr *WriteEfuse,
	XNvm_EfuseBootEnvCtrlBits *BootEnvCtrl)
{
	int Status = XST_FAILURE;
	BootEnvCtrl->SysmonTempEn = XNVM_EFUSE_SYSMON_TEMP_EN;
	BootEnvCtrl->SysmonVoltEn = XNVM_EFUSE_SYSMON_VOLT_EN;
	BootEnvCtrl->SysmonVoltSoc = XNVM_EFUSE_SYSMON_VOLT_SOC;
	BootEnvCtrl->PrgmSysmonTempHot = XNVM_EFUSE_SYSMON_TEMP_HOT;
	BootEnvCtrl->PrgmSysmonVoltPmc = XNVM_EFUSE_SYSMON_VOLT_PMC;
	BootEnvCtrl->PrgmSysmonVoltPslp = XNVM_EFUSE_SYSMON_VOLT_PSLP;
	BootEnvCtrl->PrgmSysmonTempCold = XNVM_EFUSE_SYSMON_TEMP_COLD;
	if (BootEnvCtrl->PrgmSysmonTempHot == TRUE) {
		if (XNVM_EFUSE_SYSMON_TEMP_HOT_FUSES >
			XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX) {
			xil_printf("Invalid i/p for"
				" XNVM_EFUSE_SYSMON_TEMP_HOT_FUSES\r\n");
			goto END;
		}
		BootEnvCtrl->SysmonTempHot = XNVM_EFUSE_SYSMON_TEMP_HOT_FUSES;
	}
	if (BootEnvCtrl->PrgmSysmonVoltPmc == TRUE) {
		if (XNVM_EFUSE_SYSMON_VOLT_PMC_FUSES >
			XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX) {
			xil_printf("Invalid i/p for"
				" XNVM_EFUSE_SYSMON_VOLT_PMC_FUSES\r\n");
			goto END;
		}
		BootEnvCtrl->SysmonVoltPmc = XNVM_EFUSE_SYSMON_VOLT_PMC_FUSES;
	}
	if (BootEnvCtrl->PrgmSysmonVoltPslp == TRUE) {
		if (XNVM_EFUSE_SYSMON_VOLT_PSLP_FUSE >
			XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX) {
			xil_printf("Invalid i/p for"
					 "XNVM_EFUSE_SYSMON_VOLT_PSLP_FUSE\r\n");
			goto END;
		}
		BootEnvCtrl->SysmonVoltPslp = XNVM_EFUSE_SYSMON_VOLT_PSLP_FUSE;
	}
	if (BootEnvCtrl->PrgmSysmonTempCold == TRUE) {
		if (XNVM_EFUSE_SYSMON_TEMP_COLD_FUSES >
			XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX) {
			xil_printf("Invalid i/p for"
					" XNVM_EFUSE_SYSMON_TEMP_COLD_FUSES\r\n");
			goto END;
		}
		BootEnvCtrl->SysmonTempCold = XNVM_EFUSE_SYSMON_TEMP_COLD_FUSES;
	}
	if ((BootEnvCtrl->SysmonTempEn == TRUE) ||
		(BootEnvCtrl->SysmonVoltEn == TRUE) ||
		(BootEnvCtrl->SysmonVoltSoc == TRUE) ||
		(BootEnvCtrl->PrgmSysmonTempHot == TRUE) ||
		(BootEnvCtrl->PrgmSysmonVoltPmc == TRUE) ||
		(BootEnvCtrl->PrgmSysmonVoltPslp == TRUE) ||
		(BootEnvCtrl->PrgmSysmonTempCold == TRUE)) {
		Xil_DCacheFlushRange((UINTPTR)BootEnvCtrl,
			sizeof(XNvm_EfuseBootEnvCtrlBits));
		WriteEfuse->BootEnvCtrlAddr = (UINTPTR)BootEnvCtrl;
	}
	Status = XST_SUCCESS;
END:
	return Status;
}
static int XilNvm_EfuseInitBootEnvCtrl ( XNvm_EfuseDataAddr * WriteEfuse , XNvm_EfuseBootEnvCtrlBits * BootEnvCtrl ) { int Status = XST_FAILURE ; BootEnvCtrl -> SysmonTempEn = XNVM_EFUSE_SYSMON_TEMP_EN ; BootEnvCtrl -> SysmonVoltEn = XNVM_EFUSE_SYSMON_VOLT_EN ; BootEnvCtrl -> SysmonVoltSoc = XNVM_EFUSE_SYSMON_VOLT_SOC ; BootEnvCtrl -> PrgmSysmonTempHot = XNVM_EFUSE_SYSMON_TEMP_HOT ; BootEnvCtrl -> PrgmSysmonVoltPmc = XNVM_EFUSE_SYSMON_VOLT_PMC ; BootEnvCtrl -> PrgmSysmonVoltPslp = XNVM_EFUSE_SYSMON_VOLT_PSLP ; BootEnvCtrl -> PrgmSysmonTempCold = XNVM_EFUSE_SYSMON_TEMP_COLD ; if ( BootEnvCtrl -> PrgmSysmonTempHot == TRUE ) { if ( XNVM_EFUSE_SYSMON_TEMP_HOT_FUSES > XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX ) { xil_printf ( " " " \r \n " ) ; goto END ; } BootEnvCtrl -> SysmonTempHot = XNVM_EFUSE_SYSMON_TEMP_HOT_FUSES ; } if ( BootEnvCtrl -> PrgmSysmonVoltPmc == TRUE ) { if ( XNVM_EFUSE_SYSMON_VOLT_PMC_FUSES > XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX ) { xil_printf ( " " " \r \n " ) ; goto END ; } BootEnvCtrl -> SysmonVoltPmc = XNVM_EFUSE_SYSMON_VOLT_PMC_FUSES ; } if ( BootEnvCtrl -> PrgmSysmonVoltPslp == TRUE ) { if ( XNVM_EFUSE_SYSMON_VOLT_PSLP_FUSE > XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX ) { xil_printf ( " " " \r \n " ) ; goto END ; } BootEnvCtrl -> SysmonVoltPslp = XNVM_EFUSE_SYSMON_VOLT_PSLP_FUSE ; } if ( BootEnvCtrl -> PrgmSysmonTempCold == TRUE ) { if ( XNVM_EFUSE_SYSMON_TEMP_COLD_FUSES > XNVM_EFUSE_TEMP_VOLT_LIMIT_MAX ) { xil_printf ( " " " \r \n " ) ; goto END ; } BootEnvCtrl -> SysmonTempCold = XNVM_EFUSE_SYSMON_TEMP_COLD_FUSES ; } if ( ( BootEnvCtrl -> SysmonTempEn == TRUE ) || ( BootEnvCtrl -> SysmonVoltEn == TRUE ) || ( BootEnvCtrl -> SysmonVoltSoc == TRUE ) || ( BootEnvCtrl -> PrgmSysmonTempHot == TRUE ) || ( BootEnvCtrl -> PrgmSysmonVoltPmc == TRUE ) || ( BootEnvCtrl -> PrgmSysmonVoltPslp == TRUE ) || ( BootEnvCtrl -> PrgmSysmonTempCold == TRUE ) ) { Xil_DCacheFlushRange ( ( UINTPTR ) BootEnvCtrl , sizeof ( XNvm_EfuseBootEnvCtrlBits ) ) ; WriteEfuse -> BootEnvCtrlAddr = ( UINTPTR ) BootEnvCtrl ; } Status = XST_SUCCESS ; END : return Status ; }
This function is used to initialize XNvm_EfuseBootEnvCtrlBits structure with
 user provided data and assign the same to global structure XNvm_EfuseDataAddr
 to program XNvm_EfuseBootEnvCtrlBits eFuses.
This function is used to initialize XNvm_EfuseBootEnvCtrlBits structure with user provided data and assign the same to global structure XNvm_EfuseDataAddr to program XNvm_EfuseBootEnvCtrlBits eFuses .