This commit is contained in:
hathach 2018-09-28 11:02:46 +07:00
parent 6dd4003da3
commit d4e616ff56
1 changed files with 4 additions and 4 deletions

View File

@ -42,16 +42,16 @@
#define FLASH_PAGE_SIZE 4096
#define NO_CACHE 0xffffffff
#define FLASH_CACHE_INVALID_ADDR 0xffffffff
static uint32_t _fl_addr = NO_CACHE;
static uint32_t _fl_addr = FLASH_CACHE_INVALID_ADDR;
static uint8_t _fl_buf[FLASH_PAGE_SIZE] __attribute__((aligned(4)));
static bool _first_flush = true;
void flash_flush(void)
{
if ( _fl_addr == NO_CACHE ) return;
if ( _fl_addr == FLASH_CACHE_INVALID_ADDR ) return;
if ( _first_flush )
{
@ -69,7 +69,7 @@ void flash_flush(void)
nrf_nvmc_write_words(_fl_addr, (uint32_t *) _fl_buf, FLASH_PAGE_SIZE / sizeof(uint32_t));
}
_fl_addr = NO_CACHE;
_fl_addr = FLASH_CACHE_INVALID_ADDR;
}
void flash_write (uint32_t dst, const void *src, int len)