osd_cl_mam class¶
A client for the Memory Access Module (MAM).
cl_mam
is the counterpart to the Memory Access Module (MAM): it implements the MAM protocol to read and write data from and to memories.
Usage¶
#include <osd/osd.h>
#include <osd/cl_mam.h>
Public Interface¶
Functions
-
osd_result
osd_cl_mam_get_mem_desc
(struct osd_hostmod_ctx * hostmod_ctx, unsigned int mam_di_addr, struct osd_mem_desc * mem_desc)¶ Obtain information about the memory connected to a MAM module
- Return
- OSD_OK on success, any other value indicates an error
- Parameters
hostmod_ctx
: the host module handling the communicationmam_di_addr
: DI address of the MAM module to get describe[out] mem_desc
: pre-allocated memory descriptor for the result
-
osd_result
osd_cl_mam_write
(const struct osd_mem_desc * mem_desc, struct osd_hostmod_ctx * hostmod_ctx, const void * data, size_t nbyte, uint64_t start_addr)¶ Write data to the memory attached to a Memory Access Module (MAM)
The data does not need to be word-aligned. Writes across memory region boundaries are not allowed. This function blocks until the write is acknowledged by the memory.
- Return
- OSD_OK if the write was successful any other value indicates an error
- See
- osd_cl_mam_read()
- Parameters
mem_desc
: descriptor of the target memoryhostmod_ctx
: the host module handling the communicationdata
: the data to be writtennbyte
: the number of bytes to writestart_addr
: first byte address to write data to. All subsequent words are written to consecutive addresses.
-
osd_result
osd_cl_mam_read
(const struct osd_mem_desc * mem_desc, struct osd_hostmod_ctx * hostmod_ctx, void * data, size_t nbyte, uint64_t start_addr)¶ Read data from a memory attached to a Memory Access Module (MAM)
The data does not need to be word-aligned. Reads across memory region boundaries are not allowed. This function blocks until the write is acknowledged by the memory.
- Return
- OSD_OK if the read was successful any other value indicates an error
- See
- osd_cl_mam_write()
- Parameters
mem_desc
: descriptor of the target memoryhostmod_ctx
: the host module handling the communicationdata
: the returned read data. Must be preallocated and large enough for nbyte bytes of data.nbyte
: the number of bytes to readstart_addr
: first byte address to read from
-
struct
osd_mem_desc_region
¶ - #include <cl_mam.h>
Information about a memory region
-
struct
osd_mem_desc
¶ - #include <cl_mam.h>
Information about a memory attached to a MAM module