nRF Connect SDK Bare Metal API 2.0.99
Loading...
Searching...
No Matches

◆ bm_storage_erase()

int bm_storage_erase ( const struct bm_storage * storage,
uint32_t addr,
uint32_t len,
void * ctx )

#include <bm_storage.h>

Erase data from storage.

If bm_storage_info::is_erase_before_write is set, the erase address and length must be aligned to the backend's erase unit.

If bm_storage_info::is_erase_before_write is not set, the erase address and length must be aligned to the backend's program unit, or to the backend's wear unit if bm_storage_config::is_wear_aligned is set.

Parameters
[in]storageStorage instance to erase data in.
[in]addrOffset within the partition where to erase the data.
[in]lenLength of the data to be erased (in bytes).
[in]ctxUser-defined context sent to the event handler.
Return values
0on success.
-EFAULTThe storage instance storage is NULL.
-EPERMThe storage instance storage is not initialized.
-EINVALThe addr or len parameters are unaligned.
-ENOMEMOut of memory to perform the requested operation.
-EBUSYThe operation could not be accepted at this time.
-EIOAn internal error has occurred.