121 int (*
read)(
const struct bm_storage *storage, uint32_t src,
void *dest, uint32_t len);
122 int (*
write)(
const struct bm_storage *storage, uint32_t dest,
const void *src, uint32_t len,
124 int (*
erase)(
const struct bm_storage *storage, uint32_t addr, uint32_t len,
void *ctx);
290 uint32_t len,
void *ctx);
355#include <bm/storage/bm_storage_backends.h>
void(* bm_storage_evt_handler_t)(struct bm_storage_evt *evt)
Storage event handler type.
Definition bm_storage.h:78
const struct bm_storage_info * bm_storage_nvm_info_get(const struct bm_storage *storage)
Retrieve NVM storage information.
int bm_storage_uninit(struct bm_storage *storage)
Uninitialize a storage instance.
bool bm_storage_is_busy(const struct bm_storage *storage)
Query the status of a storage instance.
bm_storage_evt_type
Event IDs.
Definition bm_storage.h:30
@ BM_STORAGE_EVT_WRITE_RESULT
Definition bm_storage.h:32
@ BM_STORAGE_EVT_ERASE_RESULT
Definition bm_storage.h:34
int bm_storage_write(const struct bm_storage *storage, uint32_t dest, const void *src, uint32_t len, void *ctx)
Write data to storage.
int bm_storage_erase(const struct bm_storage *storage, uint32_t addr, uint32_t len, void *ctx)
Erase data from storage.
void bm_storage_evt_dispatch(const struct bm_storage *storage, struct bm_storage_evt *evt)
Dispatch a storage event to the application's event handler.
int bm_storage_init(struct bm_storage *storage, const struct bm_storage_config *config)
Initialize a storage instance.
int bm_storage_read(const struct bm_storage *storage, uint32_t src, void *dest, uint32_t len)
Read data from storage.
int(* init)(struct bm_storage *storage, const struct bm_storage_config *config)
Definition bm_storage.h:119
bool(* is_busy)(const struct bm_storage *storage)
Definition bm_storage.h:125
int(* write)(const struct bm_storage *storage, uint32_t dest, const void *src, uint32_t len, void *ctx)
Definition bm_storage.h:122
int(* read)(const struct bm_storage *storage, uint32_t src, void *dest, uint32_t len)
Definition bm_storage.h:121
int(* erase)(const struct bm_storage *storage, uint32_t addr, uint32_t len, void *ctx)
Definition bm_storage.h:124
int(* uninit)(struct bm_storage *storage)
Definition bm_storage.h:120
Backend API.
Definition bm_storage.h:118
uint32_t size
The size of this instance's partition, in bytes.
Definition bm_storage.h:195
bm_storage_evt_handler_t evt_handler
The event handler function.
Definition bm_storage.h:183
bool is_wear_aligned
Enforce wear unit alignment on operations that cause wear.
Definition bm_storage.h:209
bool is_write_padded
Automatically pad write operations up to the alignment unit.
Definition bm_storage.h:216
const struct bm_storage_api * api
API implementation.
Definition bm_storage.h:187
struct bm_storage_config::@126 flags
Configuration flags.
uint32_t addr
The starting address of this instance's partition.
Definition bm_storage.h:191
Configuration for storage instance initialization.
Definition bm_storage.h:177
void * ctx
User-defined context.
Definition bm_storage.h:72
uint32_t addr
Address in memory where the operation was performed.
Definition bm_storage.h:58
enum bm_storage_evt_type id
Event identifier.
Definition bm_storage.h:44
size_t len
Length of the operation.
Definition bm_storage.h:68
const void * src
Pointer to the data written to memory.
Definition bm_storage.h:64
bool is_async
Whether the event was dispatched asynchronously.
Definition bm_storage.h:48
int result
Result of the operation.
Definition bm_storage.h:54
Storage event.
Definition bm_storage.h:40
uint32_t wear_unit
Size of the memory unit towards which wear is counted, in bytes.
Definition bm_storage.h:95
uint8_t erase_value
Value used to represent erased memory.
Definition bm_storage.h:99
uint32_t program_unit
Size of the smallest unit of memory that can be programmed, in bytes.
Definition bm_storage.h:87
uint32_t erase_unit
Size of the smallest unit of memory that can be erased, in bytes.
Definition bm_storage.h:91
bool is_erase_before_write
Whether the memory must be erased before it can be written to.
Definition bm_storage.h:103
Information about the non-volatile memory.
Definition bm_storage.h:83
struct bm_storage::@125 flags
Instance flags.
bm_storage_evt_handler_t evt_handler
The event handler function.
Definition bm_storage.h:146
const struct bm_storage_api * api
API implementation.
Definition bm_storage.h:137
bool is_initialized
The instance has been initialized.
Definition bm_storage.h:162
uint32_t addr
The starting address of this instance's partition.
Definition bm_storage.h:150
uint32_t size
The size of this instance's partition, in bytes.
Definition bm_storage.h:154
bool is_write_padded
Automatically pad write operations.
Definition bm_storage.h:170
const struct bm_storage_info * nvm_info
Information about the implementation-specific functionality and the non-volatile memory peripheral.
Definition bm_storage.h:142
bool is_wear_aligned
Enforce wear unit alignment on operations that cause wear.
Definition bm_storage.h:166
Storage instance.
Definition bm_storage.h:133