ESP8266_RTOS_SDK v1.4.0

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Macros | Typedefs | Enumerations | Functions
SPI Driver APIs
Driver APIs

SPI Flash APIs. More...

## Data Structures
struct | SpiFlashChip

## Macros
#define | SPI_FLASH_SEC_SIZE 4096

## Typedefs
typedef SpiFlashOpResult(* | user_spi_flash_read) (SpiFlashChip *spi, uint32 src_addr, uint32 *des_addr, uint32 size)
| Registered function for spi_flash_set_read_func. More...

## Enumerations
enum | SpiFlashOpResult { SPI_FLASH_RESULT_OK, SPI_FLASH_RESULT_ERR, SPI_FLASH_RESULT_TIMEOUT }

## Functions
uint32 | spi_flash_get_id (void)
| Get ID info of SPI Flash. More...
SpiFlashOpResult | spi_flash_read_status (uint32 *status)
| Read state register of SPI Flash. More...
SpiFlashOpResult | spi_flash_write_status (uint32 status_value)
| Write state register of SPI Flash. More...
SpiFlashOpResult | spi_flash_erase_sector (uint16 sec)
| Erase the Flash sector. More...
SpiFlashOpResult | spi_flash_write (uint32 des_addr, uint32 *src_addr, uint32 size)
| Write data to Flash. More...
SpiFlashOpResult | spi_flash_read (uint32 src_addr, uint32 *des_addr, uint32 size)
| Read data from Flash. More...
void | spi_flash_set_read_func (user_spi_flash_read read)
| Register user-define SPI flash read API. More...

## Detailed Description

SPI Flash APIs.

## Macro Definition Documentation

#define SPI_FLASH_SEC_SIZE 4096

SPI Flash sector size

## Typedef Documentation

typedef SpiFlashOpResult(* user_spi_flash_read) (SpiFlashChip *spi, uint32 src_addr, uint32 *des_addr, uint32 size)

Registered function for spi_flash_set_read_func.

Attention
  used for sdk internal, don't need to care about params

Parameters

  SpiFlashChip | *spi : spi flash struct pointer.
  uint32 | src_addr : source address of the data.
  uint32 | *des_addr : destination address in Flash.
  uint32 | size : length of data

Returns
  SpiFlashOpResult

## Enumeration Type Documentation

enum SpiFlashOpResult

Enumerator
SPI_FLASH_RESULT_OK | SPI Flash operating OK
SPI_FLASH_RESULT_ERR | SPI Flash operating fail
SPI_FLASH_RESULT_TIMEOUT | SPI Flash operating time out

## Function Documentation

SpiFlashOpResult spi_flash_erase_sector | ( | uint16 | sec | ) |

Erase the Flash sector.

Parameters

  uint16 | sec : Sector number, the count starts at sector 0, 4KB per sector.

Returns
  SpiFlashOpResult

uint32 spi_flash_get_id | ( | void |  | ) |

Get ID info of SPI Flash.

Parameters

  null |

Returns
  SPI Flash ID

SpiFlashOpResult spi_flash_read | ( | uint32 | src_addr,
|  | uint32 * | des_addr,
|  | uint32 | size
| ) |  |

Read data from Flash.

Parameters

  uint32 | src_addr : source address of the data.
  uint32 | *des_addr : destination address in Flash.
  uint32 | size : length of data

Returns
  SpiFlashOpResult

SpiFlashOpResult spi_flash_read_status | ( | uint32 * | status | ) |

Read state register of SPI Flash.

Parameters

  uint32 | *status : the read value (pointer) of state register.

Returns
  SpiFlashOpResult

void spi_flash_set_read_func | ( | user_spi_flash_read | read | ) |

Register user-define SPI flash read API.

Attention
  This API can be only used in SPI overlap mode, please refer to ESP8266_RTOS_SDK .c

Parameters

  user_spi_flash_read | read : user-define SPI flash read API .

Returns
  none

SpiFlashOpResult spi_flash_write | ( | uint32 | des_addr,
|  | uint32 * | src_addr,
|  | uint32 | size
| ) |  |

Write data to Flash.

Parameters

  uint32 | des_addr : destination address in Flash.
  uint32 | *src_addr : source address of the data.
  uint32 | size : length of data

Returns
  SpiFlashOpResult

SpiFlashOpResult spi_flash_write_status | ( | uint32 | status_value | ) |

Write state register of SPI Flash.

Parameters

  uint32 | status_value : Write state register value.

Returns
  SpiFlashOpResult