Master

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

typedef std::shared_ptr<rogue::interfaces::stream::Master> rogue::interfaces::stream::MasterPtr

Alias for using shared pointer as MasterPtr.

The class description is shown below:

class Master : public rogue::EnableSharedFromThis<rogue::interfaces::stream::Master>

Stream master class.

This class serves as the source for sending Frame data to a Slave. Each master interfaces to one or more stream slave objects. The first stream Slave is used to allocated new Frame objects and it is the last Slave to receive frame data.

Subclassed by rogue::hardware::axi::AxiStreamDma, rogue::interfaces::stream::Fifo, rogue::interfaces::stream::Filter, rogue::interfaces::stream::RateDrop, rogue::interfaces::stream::TcpCore, rogue::protocols::batcher::InverterV1, rogue::protocols::batcher::SplitterV1, rogue::protocols::packetizer::Application, rogue::protocols::packetizer::Transport, rogue::protocols::rssi::Application, rogue::protocols::rssi::Transport, rogue::protocols::srp::Cmd, rogue::protocols::srp::SrpV0, rogue::protocols::srp::SrpV3, rogue::protocols::udp::Client, rogue::protocols::udp::Server, rogue::protocols::xilinx::Xvc, rogue::utilities::fileio::LegacyStreamReader, rogue::utilities::fileio::StreamReader, rogue::utilities::Prbs, rogue::utilities::StreamUnZip, rogue::utilities::StreamZip

Public Functions

uint32_t slaveCount()

Get Slave Count.

Return the number of slaves.

Exposed as _slaveCount() to Python.

void addSlave(std::shared_ptr<rogue::interfaces::stream::Slave> slave)

Add a slave object.

Multiple slaves are allowed. The first added slave is the Slave object from which the Master will request new Frame allocations. The first Slave is also the last Slave object which will receive the Frame.

Exposed as _addSlave() to Python. Called in Python by the pyrogue.streamTop() method.

Parameters:

slave – Stream Slave pointer (SlavePtr)

std::shared_ptr<rogue::interfaces::stream::Frame> reqFrame(uint32_t size, bool zeroCopyEn)

Request new Frame to be allocated by primary Slave.

This method is called to create a new Frame object. An empty Frame with the requested payload capacity is create. 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() to Python.

Parameters:
  • size – Minimum size for requested Frame, larger Frame may be allocated

  • zeroCopyEn – Flag which indicates if a zero copy mode Frame is allowed.

Returns:

Newly allocated Frame pointer (FramePtr)

void sendFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame)

Push frame to all 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 to Python

Parameters:

frameFrame pointer (FramePtr) to send

bool ensureSingleBuffer(std::shared_ptr<rogue::interfaces::stream::Frame> &frame, bool reqEn)

Ensure frame is a single buffer.

This method makes sure the passed frame is composed of a single buffer. If the reqNew flag is true and the passed frame is not a single buffer, a new frame will be requested and the frame data will be copied, with the passed frame pointer being updated. The return value will indicate if the frame is a single buffer at the end of the process. A frame lock must be held when this method is called.

Not exposed to Python

Parameters:
  • frame – Reference to frame pointer (FramePtr)

  • rewEn – Flag to determine if a new frame should be requested

virtual void stop()

Shut down any threads associated with this object.

This method is called to stop any frames from being generated by this Master and shut down any threads, allowing for a clean program exit

Exposed as stop() to Python Subclasses should override this method

void equalsPy(boost::python::object p)

Support == operator in python.

boost::python::object rshiftPy(boost::python::object p)

Support >> operator in python.

void operator==(std::shared_ptr<rogue::interfaces::stream::Slave> &other)

Support == operator in C++.

std::shared_ptr<rogue::interfaces::stream::Slave> &operator>>(std::shared_ptr<rogue::interfaces::stream::Slave> &other)

Support >> operator in C++.

Public Static Functions

static std::shared_ptr<rogue::interfaces::stream::Master> create()

Class factory which returns a pointer to a Master object (MasterPtr)

Create a new Master

Exposed as rogue.interfaces.stream.Master() to Python