SPRADL4 January 2025 F29H850TU , F29H859TU-Q1
The EEPROM_64_Bit_Mode_Check_EOS() provides functionality for determining if the EEPROM unit is full and assigning the proper address, if required. If a full EEPROM unit is detected, the unit is flagged for erasure and the pointers are moved to the other, clean, unit.
First, the end address of EEPROM is retrieved according to the device being used and the configuration. The END_OF_SECTOR directive is set in the EEPROM_Config.h file.
uint8_t* End_Address = (uint8_t*) END_OF_SECTOR;Next, the EEPROM bank pointer is compared to the end address. If writing 64 new bits would go beyond the end address, the unit is full and needs to be erased. The active EEPROM unit is switched, new Write/Protection masks are configured, the Erase_Inactive_Unit flag is set, and the EEPROM EEPROM Bank Pointer is reset to the beginning of the newly active EEPROM unit.
if (Bank_Pointer > End_Address - WRITE_SIZE_BYTES)
{
EEPROM_ACTIVE_UNIT ^= 1;
Set_Protection_Masks();
Erase_Inactive_Unit = 1;
RESET_BANK_POINTER;
}