rogue
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
rogue::hardware::MemMap Class Reference

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

#include <MemMap.h>

Inheritance diagram for rogue::hardware::MemMap:
rogue::interfaces::memory::Slave rogue::EnableSharedFromThis< rogue::interfaces::memory::Slave > rogue::EnableSharedFromThisBase

Public Member Functions

 MemMap (uint64_t base, uint32_t size)
 Constructs a raw memory-map bridge instance.
 
 ~MemMap ()
 Destroys the raw memory-map bridge instance.
 
void stop ()
 Stops worker thread, unmaps memory, and closes /dev/mem.
 
void doTransaction (std::shared_ptr< rogue::interfaces::memory::Transaction > tran)
 Queues a memory transaction for asynchronous mapped-memory access.
 
- Public Member Functions inherited from rogue::interfaces::memory::Slave
 Slave (uint32_t min, uint32_t max)
 Constructs a memory slave.
 
virtual ~Slave ()
 Destroys the memory slave instance.
 
void addTransaction (std::shared_ptr< rogue::interfaces::memory::Transaction > transaction)
 Adds a transaction to the internal tracking map.
 
std::shared_ptr< rogue::interfaces::memory::TransactiongetTransaction (uint32_t index)
 Gets a transaction from the internal tracking map.
 
uint32_t min ()
 Returns configured minimum transaction size.
 
uint32_t max ()
 Returns configured maximum transaction size.
 
uint32_t id ()
 Returns unique slave ID.
 
void setName (std::string name)
 Sets slave name.
 
std::string name ()
 Returns slave name.
 
virtual uint32_t doSlaveId ()
 Services SlaveId request from a master.
 
virtual std::string doSlaveName ()
 Services SlaveName request from a master.
 
virtual uint32_t doMinAccess ()
 Services getMinAccess request from an attached master.
 
virtual uint32_t doMaxAccess ()
 Services getMaxAccess request from an attached master.
 
virtual uint64_t doAddress ()
 Services getAddress request from an attached master.
 
void lshiftPy (boost::python::object p)
 Supports << operator usage from Python.
 
std::shared_ptr< rogue::interfaces::memory::Master > & operator<< (std::shared_ptr< rogue::interfaces::memory::Master > &other)
 Connects this slave to a master via chaining operator.
 
- Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::memory::Slave >
std::shared_ptr< rogue::interfaces::memory::Slaveshared_from_this ()
 Returns a shared_ptr<T> for this instance.
 
- Public Member Functions inherited from rogue::EnableSharedFromThisBase
virtual ~EnableSharedFromThisBase ()
 Virtual destructor for polymorphic base usage.
 

Static Public Member Functions

static std::shared_ptr< rogue::hardware::MemMapcreate (uint64_t base, uint32_t size)
 Creates a raw memory-map bridge instance.
 
static void setup_python ()
 Registers Python bindings for this class.
 
- Static Public Member Functions inherited from rogue::interfaces::memory::Slave
static std::shared_ptr< rogue::interfaces::memory::Slavecreate (uint32_t min, uint32_t max)
 Creates a memory slave.
 
static void setup_python ()
 Registers this type with Python bindings.
 

Detailed Description

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:

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

Definition at line 53 of file MemMap.h.

Constructor & Destructor Documentation

◆ MemMap()

rogue::hardware::MemMap::MemMap ( uint64_t  base,
uint32_t  size 
)

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
basePhysical base address to map.
sizeSize of address space to map in bytes.

Definition at line 54 of file MemMap.cpp.

◆ ~MemMap()

rogue::hardware::MemMap::~MemMap ( )

Destroys the raw memory-map bridge instance.

Destructor.

Definition at line 75 of file MemMap.cpp.

Member Function Documentation

◆ create()

rogue::hardware::MemMapPtr rogue::hardware::MemMap::create ( uint64_t  base,
uint32_t  size 
)
static

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.

Parameters
basePhysical base address to map.
sizeSize of address space to map in bytes.
Returns
Shared pointer to the created MemMap.

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.

Definition at line 48 of file MemMap.cpp.

◆ doTransaction()

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

Queues a memory transaction for asynchronous mapped-memory access.

Post a transaction.

Parameters
tranTransaction received from upstream memory master.

Reimplemented from rogue::interfaces::memory::Slave.

Definition at line 91 of file MemMap.cpp.

◆ setup_python()

void rogue::hardware::MemMap::setup_python ( )
static

Registers Python bindings for this class.

Definition at line 159 of file MemMap.cpp.

◆ stop()

void rogue::hardware::MemMap::stop ( )
virtual

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

Reimplemented from rogue::interfaces::memory::Slave.

Definition at line 79 of file MemMap.cpp.


The documentation for this class was generated from the following files: