clean up flash
This commit is contained in:
1 parent
d8099f484d
commit
ec90ceb3d8
3 files changed
+12
-10
No files matched your search
@@ -48,7 +48,7 @@ static int _internal_flash_read (const struct lfs_config *c, lfs_block_t block,
|
||||
(void) c;
|
||||
|
||||
uint32_t addr = lba2addr(block) + off;
|
||||
flash_nrf5x_read(buffer, addr, size);
|
||||
VERIFY( flash_nrf5x_read(buffer, addr, size) > 0, -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ static int _internal_flash_prog (const struct lfs_config *c, lfs_block_t block,
|
||||
(void) c;
|
||||
|
||||
uint32_t addr = lba2addr(block) + off;
|
||||
flash_nrf5x_write(addr, buffer, size);
|
||||
VERIFY( flash_nrf5x_write(addr, buffer, size), -1)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void flash_cache_flush (flash_cache_t* fc)
|
||||
// skip erase & program if verify() exists, and memory matches
|
||||
if ( !(fc->verify && fc->verify(fc->cache_addr, fc->cache_buf, FLASH_CACHE_SIZE)) )
|
||||
{
|
||||
// indicator
|
||||
// indicator TODO allow to disable flash indicator
|
||||
ledOn(LED_BUILTIN);
|
||||
|
||||
fc->erase(fc->cache_addr);
|
||||
|
||||
@@ -59,13 +59,15 @@ static bool fal_verify (uint32_t addr, void const * buf, uint32_t len);
|
||||
|
||||
static 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,
|
||||
static flash_cache_t _cache =
|
||||
{
|
||||
.erase = fal_erase,
|
||||
.program = fal_program,
|
||||
.read = fal_read,
|
||||
.verify = fal_verify,
|
||||
|
||||
.cache_addr = FLASH_CACHE_INVALID_ADDR,
|
||||
.cache_buf = _cache_buffer
|
||||
.cache_buf = _cache_buffer
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
@@ -100,7 +102,7 @@ bool flash_nrf5x_erase(uint32_t addr)
|
||||
//--------------------------------------------------------------------+
|
||||
// HAL for caching
|
||||
//--------------------------------------------------------------------+
|
||||
bool fal_erase (uint32_t addr)
|
||||
static bool fal_erase (uint32_t addr)
|
||||
{
|
||||
// Init semaphore for first call
|
||||
if ( _sem == NULL )
|
||||
|
||||
Reference in new issue
Block a user