MemMap

Examples of using the MemMap class are included in Raw Hardware Interface.

Python binding

This C++ class is also exported into Python as rogue.hardware.MemMap.

Python API page: - MemMap

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

typedef std::shared_ptr<rogue::hardware::MemMap> rogue::hardware::MemMapPtr
[header]

Shared pointer alias for MemMap.

The class description is shown below:

class MemMap : public rogue::interfaces::memory::Slave
[header]

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)
[header] [impl]

Constructs a raw memory-map bridge instance.

Creator.

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()
[header] [impl]

Destroys the raw memory-map bridge instance.

Destructor.

virtual void stop()
[header] [impl]

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

virtual void doTransaction(std::shared_ptr<rogue::interfaces::memory::Transaction> tran)
[header] [impl]

Queues a memory transaction for asynchronous mapped-memory access.

Post a transaction.

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)
[header] [impl]

Creates a raw memory-map bridge instance.

Class creation.

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.

Company : SLAC National Accelerator Laboratory

Description: Raw Memory Mapped Access

This file is part of the rogue software platform. It is subject to the license terms in the LICENSE.txt file found in the top-level directory of this distribution and at: https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. No part of the rogue software platform, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE.txt file.

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()
[header] [impl]

Registers Python bindings for this class.