Introduce struct mg_flash::{read_fn,init_fn}

This commit is contained in:
cpq committed 2026-12-03 10:47:45 +00:00
1 parent 9ac1106e74
commit 57e30ab2e9
18 files changed
+438 -293

No files matched your search

+4 -4
View File
@@ -7,13 +7,13 @@ struct mg_flash {
size_t size; // Flash size
size_t secsz; // Sector size
size_t align; // Write alignment
bool (*read_fn)(void *, void *, size_t); // Read function
bool (*write_fn)(void *, const void *, size_t); // Write function
bool (*swap_fn)(void); // Swap partitions
bool (*init_fn)(struct mg_flash *); // Optional, fills runtime attributes
};
extern struct mg_flash *mg_flash;
bool mg_lfs_init(size_t size);
bool mg_ota_flash_begin(size_t new_firmware_size, struct mg_flash *flash);
bool mg_ota_flash_write(const void *buf, size_t len, struct mg_flash *flash);
bool mg_ota_flash_end(struct mg_flash *flash);
// Reads memory-mapped (XIP) flash. Use as read_fn for such flash
bool mg_flash_read_xip(void *addr, void *buf, size_t len);