Чего??? Все там реализовано. И работает.
#define PageErase 0x81
#define FlashIDMask 0x38
#define FlashID 0x18
#define _FlashReady (1<<7)
#define WaitFlashReady() do ; while( (FlashReadStatus() & (_FlashReady | FlashIDMask)) != (_FlashReady | FlashID));
void FlashErasePage (page Page)
{
FlashSendCommand( Page, 0, PageErase);
FlashDisable();
WaitFlashReady();
}
unsigned char FlashReadStatus( void )
{
FlashEnable();
WriteSPI(ReadStatus);
WaitSPIDone();
WriteSPI(0); //send dummy data and receive Status
WaitSPIDone();
FlashDisable();
return(ReadSPI());
}
void FlashSendCommand ( page Page, offset Offset, command Command)
{
unsigned char tmp;
FlashEnable();
WriteSPI(Command);
tmp = (Page << (FlashPageSize/256)) >> 8;
WaitSPIDone();
WriteSPI(tmp);
tmp = (Page << (FlashPageSize/256)) | ((Offset >> 8) & 0x03);
WaitSPIDone();
WriteSPI(tmp);
WaitSPIDone();
WriteSPI(Offset);
WaitSPIDone();
if(Command == MainPageRead)
{
WriteSPI(0); WaitSPIDone();
WriteSPI(0); WaitSPIDone();
WriteSPI(0); WaitSPIDone();
WriteSPI(0); WaitSPIDone();
}else
if((Command == Buffer1Read)||(Command == Buffer2Read))
{
WriteSPI(0); WaitSPIDone();
}
}