#include <uhd/rfnoc_graph.hpp>
Public Types | |
using | sptr = std::shared_ptr< rfnoc_graph > |
Public Member Functions | |
virtual | ~rfnoc_graph () |
virtual std::vector< block_id_t > | find_blocks (const std::string &block_id_hint) const =0 |
template<typename T > | |
std::vector< block_id_t > | find_blocks (const std::string &block_id_hint) const |
virtual bool | has_block (const block_id_t &block_id) const =0 |
Checks if a specific NoC block exists on the device. More... | |
template<typename T > | |
bool | has_block (const block_id_t &block_id) const |
virtual noc_block_base::sptr | get_block (const block_id_t &block_id) const =0 |
Returns a block controller class for an NoC block. More... | |
template<typename T > | |
std::shared_ptr< T > | get_block (const block_id_t &block_id) const |
virtual bool | is_connectable (const block_id_t &src_blk, size_t src_port, const block_id_t &dst_blk, size_t dst_port)=0 |
virtual void | connect (const block_id_t &src_blk, size_t src_port, const block_id_t &dst_blk, size_t dst_port, bool is_back_edge=false)=0 |
virtual void | connect (uhd::tx_streamer::sptr streamer, size_t strm_port, const block_id_t &dst_blk, size_t dst_port, uhd::transport::adapter_id_t adapter_id=uhd::transport::NULL_ADAPTER_ID)=0 |
virtual void | connect (const block_id_t &src_blk, size_t src_port, uhd::rx_streamer::sptr streamer, size_t strm_port, uhd::transport::adapter_id_t adapter_id=uhd::transport::NULL_ADAPTER_ID)=0 |
virtual void | disconnect (const block_id_t &src_blk, size_t src_port, const block_id_t &dst_blk, size_t dst_port)=0 |
virtual void | disconnect (const std::string &streamer_id)=0 |
virtual void | disconnect (const std::string &streamer_id, size_t port)=0 |
virtual std::vector< uhd::transport::adapter_id_t > | enumerate_adapters_from_src (const block_id_t &src_blk, size_t src_port)=0 |
virtual std::vector< uhd::transport::adapter_id_t > | enumerate_adapters_to_dst (const block_id_t &dst_blk, size_t dst_port)=0 |
virtual std::vector< graph_edge_t > | enumerate_static_connections () const =0 |
virtual std::vector< graph_edge_t > | enumerate_active_connections ()=0 |
virtual void | commit ()=0 |
virtual void | release ()=0 |
virtual std::string | to_dot ()=0 |
virtual rx_streamer::sptr | create_rx_streamer (const size_t num_ports, const stream_args_t &args)=0 |
virtual tx_streamer::sptr | create_tx_streamer (const size_t num_ports, const stream_args_t &args)=0 |
virtual size_t | get_num_mboards () const =0 |
virtual std::shared_ptr< mb_controller > | get_mb_controller (const size_t mb_index=0)=0 |
virtual bool | synchronize_devices (const uhd::time_spec_t &time_spec, const bool quiet)=0 |
virtual uhd::property_tree::sptr | get_tree (void) const =0 |
Return a reference to the property tree. More... | |
Static Public Member Functions | |
static sptr | make (const device_addr_t &dev_addr) |
The core class for a UHD session with (an) RFNoC device(s)
This class is a superset of uhd::device. It does not only hold a device session, but also manages the RFNoC blocks on those devices. Only devices compatible with a modern version of RFNoC can be addressed by this class.
using uhd::rfnoc::rfnoc_graph::sptr = std::shared_ptr<rfnoc_graph> |
A shared pointer to allow easy access to this class and for automatic memory management.
|
inlinevirtual |
|
pure virtual |
Commit graph and run initial checks
This method needs to be called when the graph is ready for action. It will run checks on the graph and run a property propagation.
uhd::resolve_error | if the properties fail to resolve. |
|
pure virtual |
Connect a RFNoC block with block ID src_block
to another with block ID dst_block
.
Note you need to also call this on statically connected blocks if you desire to use them.
Connections that are made using this API call will be listed when calling enumerate_active_connections().
src_blk | The block ID of the source block to connect. |
src_port | The port of the source block to connect. |
dst_blk | The block ID of the destination block to connect to. |
dst_port | The port of the destination block to connect to. |
is_back_edge | Flag this edge as a back-edge. See also Back edges. |
uhd::routing_error | if the source or destination ports are statically connected to a different block |
|
pure virtual |
Connect TX streamer to an input of an NoC block
streamer | The streamer to connect. |
strm_port | The port of the streamer to connect. |
dst_blk | The block ID of the destination block to connect to. |
dst_port | The port of the destination block to connect to. |
adapter_id | The local device ID (transport) to use for this connection. |
connect_disallowed_on_dst | if the destination port is statically connected to a different block |
|
pure virtual |
Connect RX streamer to an output of an NoC block
src_blk | The block ID of the source block to connect. |
src_port | The port of the source block to connect. |
streamer | The streamer to connect. |
strm_port | The port of the streamer to connect. |
adapter_id | The local device ID (transport) to use for this connection. |
connect_disallowed_on_src | if the source port is statically connected to a different block |
|
pure virtual |
Create a new receive streamer from the streamer arguments The created streamer is still not connected to anything yet. The graph::connect call has to be made on this streamer to start using it. If a different streamer is already connected to the intended source then that call may fail.
num_ports | Number of ports that will be connected to the streamer |
args | Arguments to aid the construction of the streamer |
|
pure virtual |
Create a new transmit streamer from the streamer arguments The created streamer is still not connected to anything yet. The graph::connect call has to be made on this streamer to start using it. If a different streamer is already connected to the intended sink then that call may fail.
num_ports | Number of ports that will be connected to the streamer |
args | Arguments to aid the construction of the streamer |
|
pure virtual |
Disconnect a RFNoC block with block ID src_blk
from another with block ID dst_blk
. This will logically disconnect the blocks, but the physical connection will not be changed until a new connection is made on the source port.
Disconnected edges will no longer be listed in enumerate_active_connections().
src_blk | The block ID of the source block to disconnect. |
src_port | The port of the source block to disconnect. |
dst_blk | The block ID of the destination block to disconnect from. |
dst_port | The port of the destination block to disconnect from. |
|
pure virtual |
Disconnect a streamer with ID streamer_id
. This will logically disconnect the streamer, but physical connection will not be changed. For RX streamers, the physical connection will be changed when a new connection is made to the upstream source port(s). For TX streamers, the physical connection will be changed when the TX streamer is destroyed or the port(s) are connected to another block.
streamer_id | The ID of the streamer to disconnect. |
|
pure virtual |
Disconnect port port
of a streamer with ID streamer_id
. This will logically disconnect the streamer, but physical connection will not be changed. For RX streamers, the physical connection will be changed when a new connection is made to the upstreame source port. For TX streamers, the physical connection will be changed when the TX streamer is destroyed or the port is connected to another block.
streamer_id | The ID of the streamer. |
port | The port to disconnect. |
|
pure virtual |
Enumerate all the active connections in the graph
An active connection is a connection which was previously created by calling connect().
|
pure virtual |
Enumerate all the possible host transport adapters that can be used to receive from the specified block
If addr and second_addr were specified in device_args, the adapter_id_t associated with addr will come first in the vector, then second_addr.
src_blk | The block ID of the source block to connect to. |
src_port | The port of the source block to connect to. |
|
pure virtual |
Enumerate all the possible host transport adapters that can be used to send to the specified block
If addr and second_addr were specified in device_args, the adapter_id_t associated with addr will come first in the vector, then second_addr.
dst_blk | The block ID of the destination block to connect to. |
dst_port | The port of the destination block to connect to. |
|
pure virtual |
Enumerate all the possible static connections in the graph
A static connection is a connection that is statically connected in hardware. Note that static connections also need to be declared using connect() if an application wants to use them, or they won't be available for property propagation or any other graph mechanism.
|
pure virtual |
Returns the block ids of all blocks that match the specified hint
Uses block_id_t::match() internally. If no matching block is found, it returns an empty vector.
The returned vector is sorted lexicographically.
To access specialized block controller classes (i.e. derived from uhd::rfnoc::noc_block_base), use the templated version of this function:
|
inline |
Type-cast version of find_blocks().
|
pure virtual |
Returns a block controller class for an NoC block.
If the given block ID is not valid (i.e. such a block does not exist on this device), it will throw a uhd::lookup_error.
block_id | Canonical block name (e.g. "0/FFT#1"). |
|
inline |
Same as get_block(), but with a type cast.
If you have a block controller class that is derived from noc_block_base, use this function to access its specific methods. If the given block ID is not valid (i.e. such a block does not exist on this device) or if the type does not match, it will throw a uhd::lookup_error.
|
pure virtual |
Return a reference to a motherboard controller
See also uhd::rfnoc::mb_controller
mb_index | The index of the motherboard in the graph, 0 if only one device is used. |
|
pure virtual |
Return the number of motherboards in this graph
Methods that take a motherboard index (e.g., get_mb_controller()) will error out if an index is passed that is greater or equal to this number of motherboards.
|
pure virtual |
Return a reference to the property tree.
|
pure virtual |
Checks if a specific NoC block exists on the device.
block_id | Canonical block name (e.g. "0/FFT#1"). |
|
inline |
Same as has_block(), but with a type check.
|
pure virtual |
Verify if two blocks/ports are connectable.
If this call returns true, then connect() can be called with the same arguments. It does not, however, check if the block was already connnected.
|
static |
Make a new USRP graph from the specified device address(es).
dev_addr | the device address |
uhd::key_error | no device found |
uhd::index_error | fewer devices found than expected |
|
pure virtual |
|
pure virtual |
Run any routines necessary to synchronize devices
The specific implementation of this call are device-specific. In all cases, it will set the motherboard time to a common value, if devices share a common reference. Depending on the hardware it may run other algorithms to synchronize individual hardware components.
Any application that requires any kind of phase or time alignment (if supported by the hardware) must call this before operation. Note that during the initialization of an rfnoc_graph, this method is always called and thus calling it again from an external application is only necessary when synchronization was previously lost.
Note that because this is a motherboard-level API, individual LOs may still be unsynchronized (i.e., not phase-aligned) after calling this. Typically, to synchronize LOs, it is necessary to tune daughterboard channels to the same frequency by using a timed command. See Synchronizing Channel Phase for more details.
Internally, this calls mb_controller::synchronize() with a full list of motherboard controllers for this rfnoc_graph.
time_spec | The timestamp to be used to sync the devices. It will be an input to set_time_next_pps() on the motherboard controllers. |
quiet | If true, there will be no errors or warnings printed if the synchronization happens. synchronize_devices() will always be called during initialization, but preconditions might not yet be met (e.g., the time and reference sources might still be internal ), and will fail quietly in that case. |
|
pure virtual |
Create a dot representation of the current graph
The graph is represented in the dot language, which can be visualized using the Graphviz tools. It contains all blocks and their connections. The connections are drawn between the ports of the blocks.