Legacy-Free Keyboard/Embedded Controller with SPI and LPC Docking Interface
// Declarations
DONE = FALSE;
MASS_ERASE_CMD = 0x20;
READ_ARRAY_CMD = 0xFF;
CLEAR_STATUS_CMD = 0xA0;
ERRORS = 0x00;
// Programming Loop Control Variable
// CSI Mass Erase Command Code Value
// CSI Read Array Command Code Value
// CSI Clear Status Command Code Value
// Variable for Status Register Errors
// Executable Code
WHILE (NOT DONE)
{
CSIWRITE(0x0000, MASS_ERASE_CMD);
// Send Mass Erase Command Code (Address = Don’t Care).
// No Argument Cycle Required.
WHILE (NO_ERRORS_&_BUSY(&ERRORS));
IF (ERRORS)
// Loop Until Errors Occur or BUSY Bit Deasserted.
// Take Remedial Steps
{
FIX_ERRORS(ERRORS);
CSIWRITE(0x0000, CLEAR_STATUS_CMD);
}
// Correct Problems (e.g. Protect Error).
// Clear Status Registe r (Address = Don’t Care).
// Try Again.
ELSE
// Restore Read Array Mode
{
CSIWRITE(0x0000, READ_ARRAY_CMD);
// Address = Don’t Care.
DONE = TRUE;
}
}
Figure 8.13 Mass Erase Example Pseudo-Code
Revision 1.1 (01-14-03)
106
SMSC LPC47N350
DATASHEET