33 #define SF_MF_SPANSION 0x01
34 #define SF_MF_MICRON 0x20
36 #define SF_DEV_MICRON_N25QA 0xBA
37 #define SF_DEV_SPANSION_S25FL 0x02
39 #define E_SF_DEVNOTFOUND ( E_SFLASH + 1 )
40 #define E_SF_DEVNOTFOUND_DESCR "Device not supported or no device found"
42 #define E_SF_WRITEERASE ( E_SFLASH + 2 )
43 #define E_SF_WRITEERASE_DESCR "Flash write or erase error"
45 #define E_SF_PASSWORD ( E_SFLASH + 3 )
46 #define E_SF_PASSWORD_DESCR "Password failed"
49 #define SF_INFO_CAP_PASSWORD 0x1
50 #define SF_INFO_CAP_SECTOR_PROTECT 0x2
52 #define SF_INFO_STS_PASSWORD_PROTECT 0x1
54 #define SF_INFO_STS_LOCKED 0x2
102 bool sfRead(uint32_t address, uint8_t * data, uint32_t count);
117 bool sfProg(uint32_t address, uint8_t * data, uint32_t count);
132 bool sfProgXPage(uint32_t address, uint8_t * data, uint32_t count);
146 bool sfErase(uint32_t address);
bool sfQuadEnable(bool enable)
Quad enable,.
bool sfLockUnlock(SfPassword *password)
Unlocks or locks the flash with the specified password.
uint8_t SfPassword[8]
Serial Flash password.
bool sfInit()
Initializes the Serial Flash.
uint32_t flashSize
flash size in bytes
uint8_t mfId
Manufacturer ID.
uint8_t _status
Hardware status register value.
uint8_t cap
Device capabilities, see SF_INF_CAP_*.
SfInfo sfInfo
Flash info, only valid after successful initialization.
uint16_t pageSize
Page size in bytes.
uint32_t sectorSize
Sector size in bytes.
bool sfReset()
Resets the flash.
bool sfErase(uint32_t address)
Erase a sector in flash.
uint8_t sts
Device status, see SF_INFO_STS_*.
bool sfSetPasswordOTP(SfPassword *password)
Password protects specific sectors from being modified.
bool sfProtect(uint32_t address)
Protects a specific sector from being erased or programmed.
bool sfProgXPage(uint32_t address, uint8_t *data, uint32_t count)
Program cross pages.
This module is responsible for distributing error codes.
uint8_t devCap
Device capacity ID.
bool sfRead(uint32_t address, uint8_t *data, uint32_t count)
Read from a specific address in flash.
bool sfProg(uint32_t address, uint8_t *data, uint32_t count)
Program an page in flash.
void sfSpDiag()
Shows diagnostic state of Spansion Flash.
bool sfUnProtect()
Unprotects the entire flash array.