7.3.3 Flash Memory Erasing (FDTErase.c)
(1) EraseInit
The user area is selected, the operating frequency is specified, and the erasing library is initialized. The operating
frequency specified with FDT is transmitted to the device with new bit rate selection. For initial setting of the library,
this operating frequency is used.
/*
////////////////////////
// EraseInit Function //
////////////////////////
*/
BYTE EraseInit(void)
{
InitPtr ERASE_INIT = (InitPtr)INIT_ADDR;
UserMatSelect();
FKEY = WRITE_ERASE_ENABLE;
return ((*ERASE_INIT)(Frequency));
}
(2) EraseStart
The block number for erasing is specified and the erasing library is called. The block number is received from the Flash
Development Toolkit. For details, refer to Source Files of the Sample Program.
/*
/////////////////////////
// EraseStart Function //
/////////////////////////
*/
BYTE EraseStart(BYTE blk_no)
{
ErasePtr ERASE_BLOCK = (ErasePtr)WRITE_ERASE_ADDR;
return ((*ERASE_BLOCK)(blk_no));
}
INIT_ADDR and WRITE_ERASE_ADDR are defined in KDevice.h as follows:
#define TRANS_RAM_ADDR 0xFF8000
#define INIT_ADDR (TRANS_RAM_ADDR+32)
#define WRITE_ERASE_ADDR (TRANS_RAM_ADDR+16)
91
Comentários a estes Manuais