MemMap

Examples of using the MemMap class are included in Using The MemMap Class.

MemMap objects in C++ are referenced by the following shared pointer typedef:

typedef std::shared_ptr<rogue::hardware::MemMap> rogue::hardware::MemMapPtr

Shared pointer alias for MemMap.

The class description is shown below:

class MemMap : public rogue::interfaces::memory::Slave

Memory-slave bridge for direct /dev/mem mapped register access.

MemMap maps a physical address range from Linux /dev/mem into user space and services Rogue memory transactions against that mapped region.

Transaction flow:

  • doTransaction() enqueues requests from upstream memory masters.

  • A worker thread dequeues transactions and performs 32-bit word accesses.

  • Read/verify requests copy mapped values into transaction buffer.

  • Write/post requests copy transaction buffer values into mapped memory.

This class is intended for environments where raw memory mapping is permitted and safe for the target platform.

Public Functions

MemMap(uint64_t base, uint32_t size)

Constructs a raw memory-map bridge instance.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.

Opens /dev/mem, maps the requested physical range, and starts worker thread for queued transaction processing.

Parameters:
  • base – Physical base address to map.

  • size – Size of address space to map in bytes.

~MemMap()

Destroys the raw memory-map bridge instance.

virtual void stop()

Stops worker thread, unmaps memory, and closes /dev/mem.

virtual void doTransaction(std::shared_ptr<rogue::interfaces::memory::Transaction> tran)

Queues a memory transaction for asynchronous mapped-memory access.

Parameters:

tran – Transaction received from upstream memory master.

Public Static Functions

static std::shared_ptr<rogue::hardware::MemMap> create(uint64_t base, uint32_t size)

Creates a raw memory-map bridge instance.

Parameter semantics are identical to the constructor; see MemMap() for mapping and worker-thread setup details. Exposed to Python as rogue.hardware.MemMap(). This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Parameters:
  • base – Physical base address to map.

  • size – Size of address space to map in bytes.

Returns:

Shared pointer to the created MemMap.

static void setup_python()

Registers Python bindings for this class.