| Description | The function EraseChip erases the flash memory device. The function is defined in the Flash Driver. The prototype is defined in the file File_Config.h. Developers must customize the function. This function is optional. If the Flash device does not support global erase or only a proportion of the Flash memory space is used for storing files, the value for this function should be set to NULL in the driver control block. |
| Example |
/* Embedded Flash Device Driver Control Block */
EFS_DRV fl0_drv = {
Init,
UnInit,
ReadData,
ProgramPage,
EraseSector,
EraseChip
};
/* Global Erase of Flash Memory. */
static BOOL EraseChip (void) {
M16(base_adr + 0xAAA) = 0xAA;
M16(base_adr + 0x554) = 0x55;
M16(base_adr + 0xAAA) = ERASE;
M16(base_adr + 0xAAA) = 0xAA;
M16(base_adr + 0x554) = 0x55;
M16(base_adr + 0xAAA) = ERA_CHIP;
return (Q6Polling (base_adr)); /* Wait until Erase Completed */
}
/* Embedded Flash Device Driver Control Block */
EFS_DRV fl0_drv = {
Init,
UnInit,
ReadData,
ProgramPage,
EraseSector,
NULL /* no EraseChip function provided */
};
|