SPI flash API cleanup, add async erase capability. (#23894)
This commit is contained in:
parent
641a1ce568
commit
7bc3eef8cc
5 changed files with 182 additions and 77 deletions
|
@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "flash.h"
|
||||
|
||||
/* All the following default configurations are based on MX25L4006E Nor FLASH. */
|
||||
|
||||
/*
|
||||
|
@ -105,32 +107,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
The page count of the FLASH, calculated by total FLASH size and page size.
|
||||
*/
|
||||
#define EXTERNAL_FLASH_PAGE_COUNT ((EXTERNAL_FLASH_SIZE) / (EXTERNAL_FLASH_PAGE_SIZE))
|
||||
|
||||
typedef int16_t flash_status_t;
|
||||
|
||||
#define FLASH_STATUS_SUCCESS (0)
|
||||
#define FLASH_STATUS_ERROR (-1)
|
||||
#define FLASH_STATUS_TIMEOUT (-2)
|
||||
#define FLASH_STATUS_BAD_ADDRESS (-3)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void flash_init(void);
|
||||
|
||||
flash_status_t flash_erase_chip(void);
|
||||
|
||||
flash_status_t flash_erase_block(uint32_t addr);
|
||||
|
||||
flash_status_t flash_erase_sector(uint32_t addr);
|
||||
|
||||
flash_status_t flash_read_block(uint32_t addr, void *buf, size_t len);
|
||||
|
||||
flash_status_t flash_write_block(uint32_t addr, const void *buf, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue