Description
Source
Call Graph
Start Line: 209
unsigned char AT26D_EraseChip(At26 *pAt26)
{
unsigned char status;
unsigned char error;
SANITY_CHECK(pAt26);
// Check that the flash is unprotected
status = AT26D_ReadStatus(pAt26);
if ((status & AT26_STATUS_SWP) != AT26_STATUS_SWP_PROTNONE) {
return AT26_ERROR_PROTECTED;
}
// Enable critical write operation
AT26D_EnableWrite(pAt26);
// Erase the chip
error = AT26_SendCommand(pAt26, AT26_CHIP_ERASE_2, 1, 0, 0, 0, 0, 0);
ASSERT(!error, "-F- AT26_ChipErase: Could not issue command.\n\r");
// Wait for transfer to finish
AT26D_Wait(pAt26);
// Poll the Serial flash status register until the operation is achieved
AT26D_WaitReady(pAt26);
return 0;
}