InPlay API
hal_flash.h
1 
12 #ifndef HAL_FLASH_H
13 #define HAL_FLASH_H
14 
15 #include <stdint.h>
16 
25 #define SPI_FLASH_PAGE_SIZE (256)
26 #define SPI_FLASH_SECTOR_SIZE (4096)
27 #define SPI_FLASH_BASE_ADDR (0x300000)
28 #define SPI_FLASH_SIZE (0x80000)
29 enum flash_error {
30  FLASH_ERR_OK,
31  FLASH_ERR_ERASE_FAIL,
32  FLASH_ERR_VERIFY_FAIL,
33  FLASH_ERR_INVALID_PARAM,
34  FLASH_ERR_BLE_CONFLICT,
35 };
36 
37 /*
38  * APIs
39  ****************************************************************************************
40  */
41 
54 int hal_spi_flash_sector_erase(uint32_t addr, uint32_t sector_nb);
55 
69 int hal_spi_flash_prog_page(uint32_t addr, uint8_t *data, uint32_t data_len);
70 
83 int hal_spi_flash_verify(uint32_t addr, uint8_t *data, uint32_t size);
84 
97 int hal_spi_flash_read(uint32_t addr, uint8_t *data, uint32_t size);
98 
111 int hal_spi_flash_read_page(uint32_t addr, uint8_t *data, uint32_t size);
112 
113 #if CFG_BRAM_RAM_APP_EN
114 
122 void hal_spi_flash_suspend(void);
123 #endif
124 #endif
int hal_spi_flash_sector_erase(uint32_t addr, uint32_t sector_nb)
Erase SPI Flash sector.
int hal_spi_flash_read(uint32_t addr, uint8_t *data, uint32_t size)
Flash read function.
int hal_spi_flash_prog_page(uint32_t addr, uint8_t *data, uint32_t data_len)
Programme SPI Flash page.
int hal_spi_flash_read_page(uint32_t addr, uint8_t *data, uint32_t size)
Flash read function.
int hal_spi_flash_verify(uint32_t addr, uint8_t *data, uint32_t size)
Verify SPI Flash data.