13PROGMEM_STRING_TABLE(StorageErrorStrings,
"none",
"I/O error",
"no media",
"read only",
"invalid address or size",
14 "timeout",
"unknown");
17 return StorageErrorStrings::get_log_str(-
static_cast<int>(error));
26 if (offset % align != 0 ||
len % align != 0)
39 if (count == 0 || block >= this->
geometry_.
block_count || count > this->geometry_.block_count - block)
95 ESP_LOGCONFIG(
tag,
" No media");
100 " Capacity: %" PRIu32
" KiB\n"
101 " Block size: %" PRIu32
"\n"
102 " Block count: %" PRIu32
"\n"
104 " Program size: %u\n"
void feed_wdt_if_watched()
Feed from code that may run off the loop task (a long download or image decode): on ESP32 only a task...
StorageError sync()
Return once all earlier writes are stored on the media.
virtual StorageError device_program(uint32_t block, uint32_t offset, const void *buf, uint32_t len)=0
StorageError trim(uint32_t block, uint32_t count)
Tell the device that the blocks no longer hold data it needs to keep.
StorageError check_access_(uint32_t block, uint32_t offset, uint32_t len, uint16_t align, bool write) const
virtual StorageError device_read(uint32_t block, uint32_t offset, void *buf, uint32_t len)=0
StorageError read(uint32_t block, uint32_t offset, void *buf, uint32_t len)
void dump_geometry_(const char *tag) const
virtual StorageError device_trim(uint32_t block, uint32_t count)
StorageError check_range_(uint32_t block, uint32_t count) const
uint64_t get_capacity() const
StorageError program(uint32_t block, uint32_t offset, const void *buf, uint32_t len)
virtual StorageError device_erase(uint32_t block, uint32_t count)
StorageError erase(uint32_t block, uint32_t count)
virtual StorageError device_sync()
@ STORAGE_ERROR_READ_ONLY
ESPHOME_LOG_TAG(TAG, "storage")
const LogString * storage_error_to_string(StorageError error)
PROGMEM_STRING_TABLE(StorageErrorStrings, "none", "I/O error", "no media", "read only", "invalid address or size", "timeout", "unknown")
Application App
Global storage of Application pointer - only one Application can exist.
The shape of a block device. A block_count of 0 means no media is present.