Synopsis
int libmem_erase(uint8_t *start,
                 size_t size,
                 uint8_t **erase_start,
                 size_t *erase_size);
Description

libmem_erase erases a block of memory using a LIBMEM driver.

start — A pointer to the start address of the memory range to erase.

size — The size of the memory range to erase in bytes.

erase_start — A pointer to a location in memory to store a pointer to the start of the memory range that has actually been erased or NULL if not required.

erase_size — A pointer to a location in memory to store the size in bytes of the memory range that has actually been erased or NULL if not required.

libmem_erase returns — The LIBMEM status result.

This function locates the LIBMEM driver for the address pointed to by start and then calls the LIBMEM driver's erase function.

Note that the address range being erased cannot span multiple LIBMEM drivers.

Example:

uint8_t *erase_start;
size_t erase_size;
int res;

res = libmem_erase((uint8_t *)0x10000000, 1024, &erase_start, &erase_size);

if (res == LIBMEM_STATUS_SUCCESS)
  printf("libmem_erase : success (erased %08X - 0x%08X)\n", erase_start, erase_start + erase_size - 1);
else
  printf("libmem_erase : failed (%d)\n", res);