int libmem_read(uint8_t *dest,
                const uint8_t *src,
                size_t size);

libmem_read reads a block of data using a LIBMEM driver.

dest — A pointer to the address to write the block of data.

src — A pointer to the address to copy the block of data from.

size — The size of the block of data to copy in bytes.

libmem_read returns — The LIBMEM status result.

This function locates the LIBMEM driver for the address pointed to by src and then calls the LIBMEM driver's read extended function if it has been implemented. If the read function has not been implemented then the memory will be read directly using memcpy. The intention for this function is to allow you to use the LIBMEM library for memory that doesn't appear on the address bus by providing a virtual address range for the device.

Note that if the LIBMEM driver's read function is used, the address range being read cannot span multiple LIBMEM drivers.


uint8_t buffer[64];
int res;

res = libmem_read(buffer, (uint8_t *)0x10000000, sizeof(buffer));

  printf("libmem_read : success\n");
  printf("libmem_read : failed (%d)\n", res);