|
| fs_EraseSector| Summary | |
#include <file_config.h>
int fs_EraseSector (
U32 adr); /* address of sector to erase */
| | Description | | The fs_EraseSector function is a user-provided routine that erases the flash sector specified by adr address. The fs_EraseSector function is part of RL-FlashFS. The prototype is defined in file_config.h. You can customize the function in fs_flashprg.c. | | Return Value | | The fs_EraseSector function returns a value of 0 if successful or a value of 1 if unsuccessful. | | See Also | | fs_Init, fs_ProgramPage | | Example | |
int fs_EraseSector (U32 adr) {
// Start Erase Sector Command
M16(base_adr + 0xAAA) = 0xAA;
M16(base_adr + 0x554) = 0x55;
M16(base_adr + 0xAAA) = 0x80;
M16(base_adr + 0xAAA) = 0xAA;
M16(base_adr + 0x554) = 0x55;
M16(adr) = 0x30;
// Wait for Sector Erase Timeout
do {
fsr.v = M16(adr);
} while (fsr.b.q3 == 0);
// Wait until Erase completed
return (Polling(adr));
}
|
|
|