47template<
unsigned ERASE_PAGE_SIZE>
50 HASSERT(addr >= fs_->cfg.phys_addr &&
51 (addr + size) <= (fs_->cfg.phys_addr + fs_->cfg.phys_size));
61template<
unsigned ERASE_PAGE_SIZE>
64 LOG(
INFO,
"Write %x sz %d", (
unsigned)addr, (
unsigned)size);
73template<
unsigned ERASE_PAGE_SIZE>
76 LOG(
INFO,
"Erasing %x sz %d", (
unsigned)addr, (
unsigned)size);
77 HASSERT(addr >= fs_->cfg.phys_addr &&
78 (addr + size) <= (fs_->cfg.phys_addr + fs_->cfg.phys_size));
79 HASSERT((size % ERASE_PAGE_SIZE) == 0);
83 LOG(
INFO,
"Erasing %x done", (
unsigned)addr);
static void read(uint32_t addr, void *buf, size_t len)
Reads data from the device.
static void write(uint32_t addr, const void *buf, uint32_t len)
Performs write to the device.
static void erase(uint32_t addr, size_t len)
Erases sector(s) of the device.
int32_t flash_read(uint32_t addr, uint32_t size, uint8_t *dst) override
SPIFFS callback to read flash, in context.
int32_t flash_erase(uint32_t addr, uint32_t size) override
SPIFFS callback to erase flash, in context.
int32_t flash_write(uint32_t addr, uint32_t size, uint8_t *src) override
SPIFFS callback to write flash, in context.
#define LOG(level, message...)
Conditionally write a message to the logging output.
static const int INFO
Loglevel that is printed by default, reporting some status information.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.