AxiStreamDma

For conceptual usage, see:

Implementation

This Python API is provided by a Rogue C++ class exported into Python.

Native C++ class: - AxiStreamDma

Generated API

class rogue.hardware.axi.AxiStreamDma(path, dest, ssiEnable)

C++: rogue::hardware::axi::AxiStreamDma

Binding source: [AxiStreamDma.cpp]

Bridge between Rogue stream interfaces and AXI Stream DMA drivers.

AxiStreamDma connects Rogue stream::Master/stream::Slave APIs to the aes-stream-driver kernel interface. It supports:

  • RX path: DMA buffers received from hardware and forwarded as Rogue frames.

  • TX path: Rogue frames written to hardware via DMA.

  • Optional zero-copy buffer mapping when supported by the driver/path. Threading model:

  • A background RX thread is started in the constructor and runs until stop() or destruction.

  • TX operations execute synchronously in caller context of acceptFrame(). Zero-copy model:

  • Enabled by default per device path.

  • zeroCopyDisable(path) must be called before first instance on that path.

  • When disabled or unavailable, frame buffers are allocated from local pool and copied on TX/RX boundaries.

__init__(path, dest, ssiEnable)

C++: rogue::hardware::axi::AxiStreamDma

Constructs an AXI stream DMA bridge.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required. The destination field is an AXI Stream sideband routing value. Usage is driver/firmware specific, but a common mapping is:

  • low 8 bits: AXI tDest value carried with the stream frame

  • upper bits: DMA channel selection/indexing in lower-level hardware ssiEnable controls insertion/interpretation of SLAC SSI user bits:

  • SOF marker in first-user field bit 1

  • EOFE marker in last-user field bit 0

Parameters:
  • path – Device path, for example /dev/datadev_0.

  • dest – Destination index used for DMA transactions.

  • ssiEnable – Enable SSI user-field handling.

setDriverDebug(level)

C++: rogue::hardware::axi::AxiStreamDma::setDriverDebug()

Sets DMA driver debug level.

Forwards level to lower-level driver debug control. Driver messages can be inspected through kernel logs (for example dmesg). Typical drivers treat any positive value as debug enabled. Exposed to Python as setDriverDebug().

Parameters:

level – Driver debug level.

dmaAck()

C++: rogue::hardware::axi::AxiStreamDma::dmaAck()

Sends an ACK strobe through driver-specific DMA control path.

Hardware behavior is implementation-specific to the target DMA core. Exposed to Python as dmaAck().

setTimeout(timeout)

C++: rogue::hardware::axi::AxiStreamDma::setTimeout()

Sets TX/alloc wait timeout.

The timeout is used in blocking select loops for outbound DMA resources. On timeout, warnings are logged and retries continue until resources are available. Exposed to Python as setTimeout().

Parameters:

timeout – Timeout value in microseconds.

getGitVersion()

C++: rogue::hardware::axi::AxiStreamDma::getGitVersion()

Gets DMA driver Git version string.

Returns:

Git version string, empty on failure.

getApiVersion()

C++: rogue::hardware::axi::AxiStreamDma::getApiVersion()

Gets DMA driver API version.

Returns:

Driver API version number.

getBuffSize()

C++: rogue::hardware::axi::AxiStreamDma::getBuffSize()

Gets DMA buffer size.

Returns:

RX/TX DMA buffer size in bytes.

getRxBuffCount()

C++: rogue::hardware::axi::AxiStreamDma::getRxBuffCount()

Gets RX DMA buffer count.

Returns:

Number of RX buffers.

getRxBuffinUserCount()

C++: rogue::hardware::axi::AxiStreamDma::getRxBuffinUserCount()

Gets RX buffers currently held by user space.

Returns:

RX in-user count.

getRxBuffinHwCount()

C++: rogue::hardware::axi::AxiStreamDma::getRxBuffinHwCount()

Gets RX buffers currently held by hardware.

Returns:

RX in-hardware count.

getRxBuffinPreHwQCount()

C++: rogue::hardware::axi::AxiStreamDma::getRxBuffinPreHwQCount()

Gets RX buffers queued before hardware.

Returns:

RX pre-hardware queue count.

getRxBuffinSwQCount()

C++: rogue::hardware::axi::AxiStreamDma::getRxBuffinSwQCount()

Gets RX buffers queued in software.

Returns:

RX software queue count.

getRxBuffMissCount()

C++: rogue::hardware::axi::AxiStreamDma::getRxBuffMissCount()

Gets RX buffer missing count.

Returns:

RX missing buffer count.

getTxBuffCount()

C++: rogue::hardware::axi::AxiStreamDma::getTxBuffCount()

Gets TX DMA buffer count.

Returns:

Number of TX buffers.

getTxBuffinUserCount()

C++: rogue::hardware::axi::AxiStreamDma::getTxBuffinUserCount()

Gets TX buffers currently held by user space.

Returns:

TX in-user count.

getTxBuffinHwCount()

C++: rogue::hardware::axi::AxiStreamDma::getTxBuffinHwCount()

Gets TX buffers currently held by hardware.

Returns:

TX in-hardware count.

getTxBuffinPreHwQCount()

C++: rogue::hardware::axi::AxiStreamDma::getTxBuffinPreHwQCount()

Gets TX buffers queued before hardware.

Returns:

TX pre-hardware queue count.

getTxBuffinSwQCount()

C++: rogue::hardware::axi::AxiStreamDma::getTxBuffinSwQCount()

Gets TX buffers queued in software.

Returns:

TX software queue count.

getTxBuffMissCount()

C++: rogue::hardware::axi::AxiStreamDma::getTxBuffMissCount()

Gets TX buffer missing count.

Returns:

TX missing buffer count.

zeroCopyDisable(path)

C++: rogue::hardware::axi::AxiStreamDma::zeroCopyDisable()

Disables zero-copy mode for a device path.

Must be called before the first AxiStreamDma instance for path. By default, the class attempts to map kernel DMA buffers directly into user space and use those buffers as Rogue frame storage (zero-copy path). This reduces copies and CPU overhead. When disabled, Rogue allocates local pooled buffers and copies data to/from driver buffers. Exposed to Python as zeroCopyDisable().

Parameters:

path – Device path, for example /dev/datadev_0.

_addSlave(slave)

C++: rogue::interfaces::stream::Master::addSlave()

Attaches a downstream slave.

Multiple slaves are supported. The first attached slave is used for frame allocation and receives frames last during send. Exposed as _addSlave() in Python.

Parameters:

slave – Stream slave pointer.

_slaveCount()

C++: rogue::interfaces::stream::Master::slaveCount()

Returns the number of attached slaves.

Exposed as _slaveCount() in Python.

Returns:

Number of attached slaves.

_reqFrame(size, zeroCopyEn)

C++: rogue::interfaces::stream::Master::reqFrame()

Requests allocation of a new frame from the primary slave.

Creates an empty frame with at least the requested payload capacity. The Master will forward this request to the primary Slave object. The request for a new Frame includes a flag which indicates if a zeroCopy frame is allowed. In most cases this flag can be set to true. Non-zero-copy frames are requested if the Master may need to transmit the same frame multiple times. Exposed as _reqFrame() in Python.

Parameters:
  • size – Minimum requested payload size in bytes.

  • zeroCopyEn – Set to true when zero-copy frame allocation is allowed.

Returns:

Newly allocated frame pointer.

_sendFrame(frame)

C++: rogue::interfaces::stream::Master::sendFrame()

Sends a frame to all attached slaves.

This method sends the passed Frame to all of the attached Slave objects by calling their acceptFrame() method. First the secondary Slaves are called in order of attachment, followed last by the primary Slave. If the Frame is a zero copy frame it will most likely be empty when the sendFrame() method returns Exposed as _sendFrame() in Python.

Parameters:

frame – Frame to send.

_stop()

C++: rogue::interfaces::stream::Master::stop()

Stops frame generation and shuts down associated threads.

Exposed as stop() in Python. This is the primary subclass hook on Master. Override when the subclass owns background activity or transport resources that require deterministic shutdown.

__rshift__(other)

C++: rogue::interfaces::stream::Master::rshiftPy()

Supports >> operator usage from Python.

Parameters:

p – Python object expected to resolve to a stream Slave.

Returns:

Original Python object for chaining semantics.

setDebug(debug, name)

C++: rogue::interfaces::stream::Slave::setDebug()

Sets debug message verbosity and logger name.

This method enables debug messages when using the base Slave class attached as a primary or secondary Slave on a Master. Typically used when attaching a base Slave object for debug purposes. Exposed as setDebug() in Python.

Parameters:
  • debug – Maximum number of bytes to print in debug message.

  • name – Name included in debug messages.

_acceptFrame(frame)

C++: rogue::interfaces::stream::Slave::acceptFrame()

Accepts a frame from an upstream master.

Invokes the Python override when provided.

Parameters:

frame – Frame received from the stream path.

getFrameCount()

C++: rogue::interfaces::stream::Slave::getFrameCount()

Returns frame counter.

Returns the total frames received. Only valid if acceptFrame is not re-implemented as a sub-class. Typically used when attaching a base Slave object for debug purposes. Exposed as getFrameCount() in Python.

Returns:

Total number of Frame objects received.

getByteCount()

C++: rogue::interfaces::stream::Slave::getByteCount()

Returns byte counter.

Returns the total bytes received. Only valid if acceptFrame is not re-implemented as a sub-class. Typically used when attaching a base Slave object for debug purposes. Exposed as getByteCount() in Python.

Returns:

Total number of bytes received.

_stop()

C++: rogue::interfaces::stream::Slave::stop()

Shuts down threads associated with this object.

Called during shutdown to stop activity and allow clean process exit. Subclasses should override when they own worker threads or timers. Exposed as stop() in Python.

getAllocCount()

C++: rogue::interfaces::stream::Pool::getAllocCount()

Returns total currently allocated buffer count.

This value is incremented as buffers are allocated and decremented as buffers are freed. Exposed as getAllocCount() in Python.

Returns:

Total currently allocated buffers.

getAllocBytes()

C++: rogue::interfaces::stream::Pool::getAllocBytes()

Returns total currently allocated bytes.

This value is incremented as buffers are allocated and decremented as buffers are freed. Exposed as getAllocBytes() in Python.

Returns:

Total currently allocated bytes.

setFixedSize(size)

C++: rogue::interfaces::stream::Pool::setFixedSize()

Sets fixed-size mode.

This method puts the allocator into fixed size mode. Exposed as setFixedSize() in Python.

Parameters:

size – Fixed size value.

getFixedSize()

C++: rogue::interfaces::stream::Pool::getFixedSize()

Returns fixed-size allocation setting.

A return value of 0 means fixed-size mode is disabled. Exposed as getFixedSize() in Python.

Returns:

Fixed size value or 0 when fixed-size mode is disabled.

setPoolSize(size)

C++: rogue::interfaces::stream::Pool::setPoolSize()

Sets buffer pool size. Exposed as setPoolSize() in Python.

Parameters:

size – Number of entries to keep in the pool.

getPoolSize()

C++: rogue::interfaces::stream::Pool::getPoolSize()

Returns configured maximum number of cached pool entries. Exposed as getPoolSize() in Python.

Returns:

Pool size.

__lshift__(other)

C++: rogue::interfaces::stream::Slave::lshiftPy()

Supports << operator usage from Python.

Parameters:

p – Python object expected to resolve to a stream Master.

Returns:

Original Python object for chaining semantics.