SPRADL4 January 2025 F29H850TU , F29H859TU-Q1
The EEPROM_UpdateBankStatus() function provides functionality for updating the EEPROM bank status. This function called from the EEPROM_Write_Page() function. The EEPROM bank status is first read to determine how to proceed.
uint8_t Current_Bank_Status = *(Bank_Pointer);If this status indicates the EEPROM bank is empty, the status is changed to Current and programmed.
Fill_Buffer(Bank_Status, status_buffer_len, CURRENT_BANK);
EEPROM_Write_Buffer(Bank_Pointer, Bank_Status);
Page_Counter = 0;
Page_Pointer = Bank_Pointer + WRITE_SIZE_BYTES*2;If the status is not empty, the next check is for a full EEPROM bank. In this case, the current EEPROM bank's status will be updated to show full and the next bank's status will be set to Current to allow programming of the next EEPROM bank. Lastly, the page pointer is updated to the first page of the new EEPROM bank.
Fill_Buffer(Bank_Status, status_buffer_len, CURRENT_BANK);
EEPROM_Write_Buffer(Bank_Pointer + WRITE_SIZE_BYTES, Bank_Status);
Bank_Pointer += Bank_Size;
if (Bank_Counter == NUM_EEPROM_BANKS - 1)
{
return;
}
Fill_Buffer(Bank_Status, status_buffer_len, CURRENT_BANK);
EEPROM_Write_Buffer(Bank_Pointer, Bank_Status);
Page_Counter = 0;
Page_Pointer = Bank_Pointer + WRITE_SIZE_BYTES*2;