espressif/spi_flash.h: Add comments and more appropriate argument types

This commit is contained in:
Angus Gratton 2016-02-26 16:10:08 +11:00
parent 07b21ace2c
commit a32d1099fa

View file

@ -21,11 +21,30 @@ typedef enum {
uint32_t sdk_spi_flash_get_id(void); uint32_t sdk_spi_flash_get_id(void);
sdk_SpiFlashOpResult sdk_spi_flash_read_status(uint32_t *status); sdk_SpiFlashOpResult sdk_spi_flash_read_status(uint32_t *status);
sdk_SpiFlashOpResult sdk_spi_flash_write_status(uint32_t status_value); sdk_SpiFlashOpResult sdk_spi_flash_write_status(uint32_t status_value);
sdk_SpiFlashOpResult sdk_spi_flash_erase_sector(uint16_t sec);
sdk_SpiFlashOpResult sdk_spi_flash_write(uint32_t des_addr, uint32_t *src_addr, uint32_t size);
sdk_SpiFlashOpResult sdk_spi_flash_read(uint32_t src_addr, uint32_t *des_addr, uint32_t size);
/* Erase SPI flash sector. Parameter is sector index.
Sectors are SPI_FLASH_SEC_SIZE (4096) bytes long.
*/
sdk_SpiFlashOpResult sdk_spi_flash_erase_sector(uint16_t sec);
/* Write data to flash.
des_addr is byte offset to write to. Should be 4-byte aligned.
src is pointer to a buffer to read bytes from.
size is length of buffer in bytes. Should be a multiple of 4.
*/
sdk_SpiFlashOpResult sdk_spi_flash_write(uint32_t des_addr, const void *src, uint32_t size);
/* Read data from flash.
src_addr is byte offset to read from. Should be 4-byte aligned.
des is pointer to a buffer to read bytes into.
size is number of bytes to read. Should be a multiple of 4.
*/
sdk_SpiFlashOpResult sdk_spi_flash_read(uint32_t src_addr, void *des, uint32_t size);
/* SDK uses this structure internally to account for flash size. /* SDK uses this structure internally to account for flash size.
chip_size field is initialised during startup from the flash size chip_size field is initialised during startup from the flash size