This commit is contained in:
hathach committed 2019-10-10 18:51:39 +07:00
1 parent b9d586b56c
commit d8099f484d
5 files changed
+43 -31

No files matched your search

@@ -41,7 +41,7 @@ static inline uint32_t page_offset_of (uint32_t addr)
return addr & (FLASH_CACHE_SIZE - 1);
}
uint32_t flash_cache_write (flash_cache_t* fc, uint32_t dst, void const * src, uint32_t len)
int flash_cache_write (flash_cache_t* fc, uint32_t dst, void const * src, uint32_t len)
{
uint8_t const * src8 = (uint8_t const *) src;
uint32_t remain = len;
@@ -95,7 +95,7 @@ void flash_cache_flush (flash_cache_t* fc)
fc->cache_addr = FLASH_CACHE_INVALID_ADDR;
}
void flash_cache_read (flash_cache_t* fc, void* dst, uint32_t addr, uint32_t count)
int flash_cache_read (flash_cache_t* fc, void* dst, uint32_t addr, uint32_t count)
{
// there is no check for overflow / wraparound for dst + count, addr + count.
// this might be a useful thing to add for at least debug builds.
@@ -198,4 +198,6 @@ void flash_cache_read (flash_cache_t* fc, void* dst, uint32_t addr, uint32_t cou
// not using the cache, so just forward to read from flash
fc->read(dst, addr, count);
}
return (int) count;
}