void flashc_set_all_gp_fuses (U64 value)
{
unsigned int error_status;
    switch (value)
    {
        case 0xFFFFFFFFFFFFFFFFULL:
            flashc_erase_all_gp_fuses (FALSE);
            break;
        case 0x0000000000000000ULL:
            flashc_write_all_gp_fuses (0x0000000000000000ULL);
            break;
        default:
            flashc_erase_all_gp_fuses (FALSE);
            error_status = flashc_error_status;
            flashc_write_all_gp_fuses (value);
            flashc_error_status |= error_status;
    }
}
Ejemplo n.º 2
0
bool flashc_erase_gp_fuse_byte(unsigned int gp_fuse_byte, bool check)
{
	unsigned int error_status;
	unsigned int current_gp_fuse_byte;

	uint64_t value = flashc_read_all_gp_fuses();
	flashc_erase_all_gp_fuses(false);
	error_status = flashc_error_status;

	for (current_gp_fuse_byte = 0; current_gp_fuse_byte < 8; current_gp_fuse_byte++, value >>= 8) {
		if (current_gp_fuse_byte != gp_fuse_byte) {
			flashc_write_gp_fuse_byte(current_gp_fuse_byte, value);
			error_status |= flashc_error_status;
		}
	}
	flashc_error_status = error_status;
	return (check) ? (flashc_read_gp_fuse_byte(gp_fuse_byte) == 0xFF) : true;
}