refactor flash_cache a bit
This commit is contained in:
1 parent
9cb47251f0
commit
27efec949a
3 files changed
+14
-8
No files matched your search
@@ -45,13 +45,13 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool (*erase) (uint32_t addr);
|
||||
uint32_t (*program) (uint32_t dst, void const * src, uint32_t len);
|
||||
uint32_t (*read) (void* dst, uint32_t src, uint32_t len);
|
||||
bool (*verify) (uint32_t addr, void const * buf, uint32_t len);
|
||||
bool (*erase) (uint32_t addr);
|
||||
uint32_t (*program) (uint32_t dst, void const * src, uint32_t len);
|
||||
uint32_t (*read) (void* dst, uint32_t src, uint32_t len);
|
||||
bool (*verify) (uint32_t addr, void const * buf, uint32_t len);
|
||||
|
||||
uint32_t cache_addr;
|
||||
uint8_t cache_buf[FLASH_CACHE_SIZE] __attribute__((aligned(4)));
|
||||
uint32_t cache_addr;
|
||||
uint8_t* cache_buf;
|
||||
} flash_cache_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -58,12 +58,15 @@ static uint32_t fal_program (uint32_t dst, void const * src, uint32_t len);
|
||||
static uint32_t fal_read (void* dst, uint32_t src, uint32_t len);
|
||||
static bool fal_verify (uint32_t addr, void const * buf, uint32_t len);
|
||||
|
||||
uint8_t _cache_buffer[FLASH_CACHE_SIZE] __attribute__((aligned(4)));
|
||||
|
||||
static flash_cache_t _cache = {
|
||||
.erase = fal_erase,
|
||||
.program = fal_program,
|
||||
.read = fal_read,
|
||||
.verify = fal_verify,
|
||||
.cache_addr = FLASH_CACHE_INVALID_ADDR
|
||||
.cache_addr = FLASH_CACHE_INVALID_ADDR,
|
||||
.cache_buf = _cache_buffer
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
@@ -82,12 +82,15 @@ static uint32_t fal_qspi_program (uint32_t dst, void const * src, uint32_t len);
|
||||
static uint32_t fal_qspi_read (void* dst, uint32_t src, uint32_t len);
|
||||
static bool fal_qspi_verify (uint32_t addr, void const * buf, uint32_t len);
|
||||
|
||||
uint8_t _cache_buffer[FLASH_CACHE_SIZE] __attribute__((aligned(4)));
|
||||
|
||||
static flash_cache_t _cache = {
|
||||
.erase = fal_qspi_erase,
|
||||
.program = fal_qspi_program,
|
||||
.read = fal_qspi_read,
|
||||
.verify = fal_qspi_verify,
|
||||
.cache_addr = FLASH_CACHE_INVALID_ADDR
|
||||
.cache_addr = FLASH_CACHE_INVALID_ADDR,
|
||||
.cache_buf = _cache_buffer
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user