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 communication
  • mam_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 memory
  • hostmod_ctx: the host module handling the communication
  • data: the data to be written
  • nbyte: the number of bytes to write
  • start_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 memory
  • hostmod_ctx: the host module handling the communication
  • data: the returned read data. Must be preallocated and large enough for nbyte bytes of data.
  • nbyte: the number of bytes to read
  • start_addr: first byte address to read from

struct osd_mem_desc_region
#include <cl_mam.h>

Information about a memory region

Public Members

uint64_t baseaddr
uint64_t memsize
struct osd_mem_desc
#include <cl_mam.h>

Information about a memory attached to a MAM module

Public Members

unsigned int di_addr

DI address of the memory.

uint16_t data_width_bit

Data width in bit.

uint16_t addr_width_bit

Address width in bit.

uint8_t num_regions

Number of accessible memory regions.

struct osd_mem_desc_region osd_mem_desc::regions[8]

Memory region information.