SPRADE8A November 2023 – April 2024 F29H850TU , F29H859TU-Q1 , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1
The EEPROM_Get_64_Bit_Data_Address() provides functionality for determining if the EEPROM unit is full and assigning the proper address, if required. If a full EEPROM unit is detected, EEPROM is erased using the EEPROM_Erase() function and the active EEPROM unit is switched.
First, the end address of EEPROM is set according to the device being used and the configuration. The END_OF_SECTOR directive is set in the EEPROM_Config.h file.
End_Address = (uint16 *)END_OF_SECTOR; // Set End_Address for sector
Next, the EEPROM bank pointer is compared to the end address. If writing four 16-bit words beginning at the current EEPROM bank pointer would go beyond the end address, this indicates the sector is full. At this point, 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-3) // Test if EEPROM is full
{
EEPROM_ACTIVE_UNIT ^= 1;
uint64 WE_Protection_AB_Mask = Configure_Protection_Masks(
FIRST_AND_LAST_SECTOR[EEPROM_ACTIVE_UNIT],
NUM_EEPROM_SECTORS);
WE_Protection_A_Mask = 0xFFFFFFFF ^ (uint32)WE_Protection_AB_Mask;
WE_Protection_B_Mask = 0x00000FFF ^ WE_Protection_AB_Mask >> 32;
Erase_Inactive_Unit = 1;
RESET_BANK_POINTER;
}