osd_memaccess class¶
Access a memory in the system (high-level API).
Usage¶
#include <osd/osd.h>
#include <osd/memaccess.h>
Public Interface¶
Functions
-
osd_result
osd_memaccess_new(struct osd_memaccess_ctx ** ctx, struct osd_log_ctx * log_ctx, const char * host_controller_address)¶ Create a new context object
-
osd_result
osd_memaccess_connect(struct osd_memaccess_ctx * ctx)¶ Connect to the host controller
- Return
- OSD_OK on success, any other value indicates an error
- See
- osd_hostmod_disconnect()
- Parameters
ctx: the osd_hostmod_ctx context object
-
osd_result
osd_memaccess_disconnect(struct osd_memaccess_ctx * ctx)¶ Shut down all communication with the device
- Return
- OSD_OK on success, any other value indicates an error
- See
- osd_hostmod_run()
- Parameters
ctx: the osd_hostmod context object
-
bool
osd_memaccess_is_connected(struct osd_memaccess_ctx * ctx)¶ Is the connection to the device active?
- Return
- 1 if connected, 0 if not connected
- See
- osd_hostmod_connect()
- See
- osd_hostmod_disconnect()
- Parameters
ctx: the osd_hostmod context object
-
void
osd_memaccess_free(struct osd_memaccess_ctx ** ctx_p)¶ Free the context object
-
osd_result
osd_memaccess_cpus_start(struct osd_memaccess_ctx * ctx, unsigned int subnet_addr)¶ (Re-)Start all CPUs in the subnet
- Return
- OSD_OK on success, any other value indicates an error
- See
- osd_memaccess_cpus_stop()
- Parameters
ctx: the context objectsubnet_addr: the subnet to start all CPUs in
-
osd_result
osd_memaccess_cpus_stop(struct osd_memaccess_ctx * ctx, unsigned int subnet_addr)¶ Stop all CPUs in the given subnet to avoid interfering with the memory access
- Return
- OSD_OK on success, any other value indicates an error
- See
- osd_memaccess_cpus_start()
- Parameters
ctx: the context objectsubnet_addr: the subnet to stop all CPUs in
-
osd_result
osd_memaccess_find_memories(struct osd_memaccess_ctx * ctx, unsigned int subnet_addr, struct osd_mem_desc ** memories, size_t * num_memories)¶ Get all memories in a subnet
- Return
- OSD_OK if the operation was successful OSD_ERROR_PARTIAL_RESULT not all memories could be enumerated any other value indicates an erorr
- Parameters
ctx: the context objectsubnet_addr: the subnet to find memories in[out] the: memories found in the subnet[out] the: number of entries in thememoriesarray
-
osd_result
osd_memaccess_loadelf(struct osd_memaccess_ctx * ctx, const struct osd_mem_desc * mem_desc, const char * elf_file_path, bool verify)¶ Load an ELF file into a memory
- Parameters
ctx: the context objectmem_desc: the memory to load the data intoelf_file_path: file system path to the ELF file to be loadedverify: verify the write operation by reading the file back and and compare the data.OSD_OK: if successful, any other value indicates an error