Go to the source code of this file.
SPI Flash driver API definitions.
This file provides data structures and APIs for controlling the SPI Flash peripheral on the EfxSapphireSoC platform.
Definition in file spiFlash.h.
Data Structures | |
| struct | spiFlash_instance_t |
| SPI Flash instance structure. More... | |
Macros | |
ID & Discovery | |
Standard SPI Flash Identification Commands.
| |
| #define | CMD_READ_JEDEC_ID 0x9F |
| Standard Read JEDEC ID (Manuf + Type + Cap) **/. | |
| #define | CMD_READ_DEVICE_ID 0xAB |
| Standard Read device ID (legacy) **/. | |
Status Register Commands | |
Standard SPI Flash Status Register Commands.
| |
| #define | CMD_READ_STATUS_REG_1 0x05 |
| Standard Read Status Register 1 (WIP, WEL, BP) **/. | |
| #define | CMD_READ_STATUS_REG_2 0x35 |
| Read Status Register 2 (*QE for Winbond) **/. | |
| #define | CMD_READ_STATUS_REG_3 0x15 |
| Read Status Register 3 (*Winbond) **/. | |
| #define | CMD_WRITE_STATUS_REG_1 0x01 |
| Standard Write SR1 (Macronix/ISSI/Standard) **/. | |
| #define | CMD_WRITE_STATUS_REG_2 0x31 |
| Write SR2 (*Winbond Specific Quirk) **/. | |
| #define | CMD_WRITE_STATUS_REG_3 0x11 |
| Write SR3 **/. | |
Standard Write Commands | |
Standard SPI Flash Standard Commands.
| |
| #define | CMD_PAGE_PROGRAM 0x02 |
| Standard Write Page (256 Bytes) **/. | |
| #define | CMD_QUAD_PAGE_PROGRAM 0x32 |
| Standard Write Page (256 Bytes) **/. | |
| #define | CMD_WRITE_ENABLE 0x06 |
| Standard Set WEL Bit **/. | |
| #define | CMD_WRITE_DISABLE 0x04 |
| Standard Clear WEL Bit **/. | |
Standard Read Commands | |
Standard SPI Flash Read Commands.
| |
| #define | CMD_READ_DATA 0x03 |
| Standard Read (up to 33MHz) **/. | |
| #define | CMD_FAST_READ 0x0B |
| Standard Read at higher speed **/. | |
| #define | CMD_DUAL_OUTPUT_READ 0x3B |
| Standard Double throughput in read mode.**/. | |
| #define | CMD_QUAD_OUTPUT_READ 0x6B |
| Standard Quad throughput in read mode.**/. | |
Standard Misc Commands | |
Standard SPI Flash Standard Commands.
| |
| #define | CMD_RELEASE_DEEP_POWER_DOWN 0xAB |
| Standard Release flash from deep power down. */. | |
| #define | CMD_ENABLE_RESET 0x66 |
| Standard Reset Enable **/. | |
| #define | CMD_RESET_DEVICE 0x99 |
| Standard Trigger Reset **/. | |
| #define | CMD_GLOBAL_LOCK 0x7E |
| Standard Global Block Lock **/. | |
| #define | CMD_GLOBAL_UNLOCK 0x98 |
| Standard Global Block Unlock **/. | |
| #define | CMD_ENABLE_QUAD_GD 0x38 |
| To enable Quad Mode, need to write to this register for (*GigaDevice Quirk) **/. | |
Standard 4-Byte Addressing Commands | |
Standard SPI Flash 4-Byte Addressing Commands.
| |
| #define | CMD_ENTER_4B 0xB7 |
| Standard Enter 4-Byte Mode (Stateful) **/. | |
| #define | CMD_EXIT_4B 0xE9 |
| Standard Exit 4-Byte Mode (Standard) **/. | |
| #define | CMD_EXIT_4B_ISSI 0x29 |
| Exit 4-Byte Mode (*ISSI Quirk) **/. | |
| #define | CMD_DUAL_OUTPUT_READ_4B 0x3C |
| Standard Double throughput in read mode, 4-byte Mode.**/. | |
| #define | CMD_QUAD_OUTPUT_READ_4B 0x6C |
| Standard Quad throughput in read mode, 4-byte Mode.**/. | |
| #define | CMD_READ_4B 0x13 |
| Standard Read Data with 32-bit Address **/. | |
| #define | CMD_PROGRAM_4B 0x12 |
| Standard Page Program with 32-bit Address **/. | |
| #define | CMD_SECTOR_ERASE 0x20 |
| Standard Erase 4KB Sector **/. | |
| #define | CMD_ERASE_4K_4B 0x21 |
| Standard Sector Erase with 32-bit Address **/. | |
| #define | CMD_ERASE_64K_4B 0xDC |
| Standard Block Erase with 32-bit Address **/. | |
Misc Macros | |
Standard SPI Flash Miscellaneous Macros. | |
| #define | QE_BIT6 0x40 |
| This Macro specifically for Macronix & ISIS Flash to enable Quad Mode **/. | |
| #define | QE_BIT1 0x02 |
| This Macro specifically for Windbond Flash to enable Quad Mode **/. | |
| #define | WEL_BIT 0x02 |
| Write Enable Latch Bit in Status Reg **/. | |
Enumerations | |
Configuration Enums | |
Enums used for driver initialization. | |
| enum | spiFlash_status_t { SPI_FLASH_OK = 0 , SPI_FLASH_ERR = 1 , SPI_FLASH_SKIP = 2 } |
| SPI Flash transfer mode configuration. More... | |
Functions | |
SPI Flash (Public API -Initialization) | |
Used to initialize SPI Flash. | |
| void | spiFlash_wake (spiFlash_instance_t *flash) |
| Select spi and wake up SPI Flash. | |
| void | spiFlash_init_controller (spiFlash_instance_t *flash) |
| Initialize SPI setting. | |
| spiFlash_status_t | spiFlash_probe (spiFlash_instance_t *flash, const spiFlash_info_t *user_flash) |
| The main wrapper for initialize SPI Flash. | |
SPI Flash (Public API - Identification) | |
Used to identify SPI Flash. | |
| u8 | spiFlash_read_id (spiFlash_instance_t *flash) |
| Select and Read Device ID from spiFlash. | |
| u32 | spiFlash_jedec_id (spiFlash_instance_t *flash) |
| Select and read JEDEC ID from spiFlash. | |
| spiFlash_status_t | spiFlash_verify (spiFlash_instance_t *flash, const spiFlash_info_t *user_flash) |
| Verify spiFlash. | |
SPI Flash (Public API - Read/Write Operation) | |
Used for read/write SPI Flash. | |
| u8 | spiFlash_readStatusReg (spiFlash_instance_t *flash) |
| Read Status Register. | |
| void | spiFlash_writeStatusReg (spiFlash_instance_t *flash, u8 data) |
| Write Status Register. | |
| u8 | spiFlash_write (spiFlash_instance_t *flash, u32 flashAddress, u8 *src, u32 len) |
| Write N byte to Flash using standard write mode. | |
| u8 | spiFlash_write_quad (spiFlash_instance_t *flash, u32 flashAddress, u8 *src, u32 len) |
| Write N byte to Flash using quad write mode. | |
| void | spiFlash_read (spiFlash_instance_t *flash, u32 flashAddress, u8 *buffer, u32 len) |
| Read N byte from Flash using standard read mode. | |
| void | spiFlash_read_quad (spiFlash_instance_t *flash, u32 flashAddress, u8 *buffer, u32 len) |
| Read N byte from Flash using quad read mode. | |
| void | spiFlash_f2m (spiFlash_instance_t *flash, u32 flashAddress, uintptr_t memoryAddress, u32 size) |
| This function read data from FlashAddress and copy to memoryAddress of specific size with single data line. | |
| void | spiFlash_dual_f2m (spiFlash_instance_t *flash, u32 flashAddress, uintptr_t memoryAddress, u32 size) |
| This function read data from FlashAddress and copy to memoryAddress of specific size with dual data line. | |
| void | spiFlash_quad_f2m (spiFlash_instance_t *flash, u32 flashAddress, uintptr_t memoryAddress, u32 size) |
| This function read data from FlashAddress and copy to memoryAddress of specific size with quad data line. | |
SPI Flash (Public API - Configuration) | |
Used to configure SPI Flash setting. | |
| spiFlash_status_t | spiFlash_waitBusy (spiFlash_instance_t *flash) |
| Wait for spiFlash to be free. | |
| u8 | spiFlash_exit4ByteAddr (spiFlash_instance_t *flash) |
| Exit 4-byte addressing. | |
| void | spiFlash_globalLock (spiFlash_instance_t *flash) |
| Globally locks the SPI flash. | |
| void | spiFlash_writeEnable (spiFlash_instance_t *flash) |
| Set Write Enable Latch. | |
| void | spiFlash_globalUnlock (spiFlash_instance_t *flash) |
| Globally unlocks the SPI flash. | |
| void | spiFlash_enable_quad_access (spiFlash_instance_t *flash) |
| Set Write Enable Latch and set Quad Enable bit to enable Quad SPI. | |
| void | spiFlash_sectorErase (spiFlash_instance_t *flash, u32 flashAddress) |
| Erases a sector of the SPI flash given an address. | |