#include <uhd/rfnoc/block_ctrl_base.hpp>
Public Types | |
typedef boost::shared_ptr< block_ctrl_base > | sptr |
typedef boost::function< sptr(const make_args_t &)> | make_t |
Public Types inherited from uhd::rfnoc::node_ctrl_base | |
typedef boost::shared_ptr< node_ctrl_base > | sptr |
typedef boost::weak_ptr< node_ctrl_base > | wptr |
typedef std::map< size_t, wptr > | node_map_t |
typedef std::pair< size_t, wptr > | node_map_pair_t |
Public Member Functions | |
uint32_t | get_address (size_t block_port=0) |
block_id_t | get_block_id () const |
std::string | unique_id () const |
std::vector< size_t > | get_ctrl_ports () const |
void | sr_write (const uint32_t reg, const uint32_t data, const size_t port=0) |
void | sr_write (const std::string ®, const uint32_t data, const size_t port=0) |
uint64_t | sr_read64 (const settingsbus_reg_t reg, const size_t port=0) |
uint32_t | sr_read32 (const settingsbus_reg_t reg, const size_t port=0) |
uint64_t | user_reg_read64 (const uint32_t addr, const size_t port=0) |
uint64_t | user_reg_read64 (const std::string ®, const size_t port=0) |
uint32_t | user_reg_read32 (const uint32_t addr, const size_t port=0) |
uint32_t | user_reg_read32 (const std::string ®, const size_t port=0) |
void | set_command_time (const time_spec_t &time_spec, const size_t port=ANY_PORT) |
time_spec_t | get_command_time (const size_t port=0) |
void | set_command_tick_rate (const double tick_rate, const size_t port=ANY_PORT) |
void | clear_command_time (const size_t port) |
void | clear () |
void | set_args (const uhd::device_addr_t &args, const size_t port=0) |
void | set_arg (const std::string &key, const std::string &val, const size_t port=0) |
Set a specific block argument. val is converted to the corresponding. More... | |
template<typename T > | |
void | set_arg (const std::string &key, const T &val, const size_t port=0) |
Direct access to set a block argument. More... | |
uhd::device_addr_t | get_args (const size_t port=0) const |
Return all block arguments as a device_addr_t. More... | |
std::string | get_arg (const std::string &key, const size_t port=0) const |
Return a single block argument in string format. More... | |
template<typename T > | |
T | get_arg (const std::string &key, const size_t port=0) const |
Direct access to get a block argument. More... | |
std::string | get_arg_type (const std::string &key, const size_t port=0) const |
Public Member Functions inherited from uhd::rfnoc::node_ctrl_base | |
node_map_t | list_downstream_nodes () |
node_map_t | list_upstream_nodes () |
void | disconnect () |
void | disconnect_output_port (const size_t output_port) |
void | disconnect_input_port (const size_t input_port) |
void | set_downstream_port (const size_t this_port, const size_t remote_port) |
size_t | get_downstream_port (const size_t this_port) |
void | set_upstream_port (const size_t this_port, const size_t remote_port) |
size_t | get_upstream_port (const size_t this_port) |
template<typename T > | |
UHD_INLINE std::vector< boost::shared_ptr< T > > | find_downstream_node (bool active_only=false) |
template<typename T > | |
UHD_INLINE std::vector< boost::shared_ptr< T > > | find_upstream_node (bool active_only=false) |
template<typename T , typename value_type > | |
UHD_INLINE value_type | find_downstream_unique_property (boost::function< value_type(boost::shared_ptr< T > node, size_t port)> get_property, value_type null_value, const std::set< boost::shared_ptr< T > > &exclude_nodes=std::set< boost::shared_ptr< T > >()) |
template<typename T , typename value_type > | |
UHD_INLINE value_type | find_upstream_unique_property (boost::function< value_type(boost::shared_ptr< T > node, size_t port)> get_property, value_type null_value, const std::set< boost::shared_ptr< T > > &exclude_nodes=std::set< boost::shared_ptr< T > >()) |
Static Public Member Functions | |
static void | register_block (const make_t &make, const std::string &name) |
static sptr | make (const make_args_t &make_args, uint64_t noc_id=~0) |
Create a block controller class given a NoC-ID or a block name. More... | |
Protected Member Functions | |
block_ctrl_base (void) | |
virtual | ~block_ctrl_base () |
block_ctrl_base (const make_args_t &make_args) | |
stream_sig_t | _resolve_port_def (const blockdef::port_t &port_def) const |
uhd::fs_path | get_arg_path (const std::string &key, size_t port=0) const |
Return the property tree path to a block argument key on port . More... | |
timed_wb_iface::sptr | get_ctrl_iface (const size_t block_port) |
Get a control interface object for block port block_port . More... | |
virtual void | _clear (const size_t port=0) |
Override this function if your block does something else. More... | |
virtual void | _set_command_time (const time_spec_t &time_spec, const size_t port=ANY_PORT) |
Override this function if your block needs to specially handle. More... | |
Protected Member Functions inherited from uhd::rfnoc::node_ctrl_base | |
node_ctrl_base (void) | |
virtual | ~node_ctrl_base () |
virtual void | _register_downstream_node (node_ctrl_base::sptr downstream_node, size_t port) |
virtual void | _register_upstream_node (node_ctrl_base::sptr upstream_node, size_t port) |
Protected Attributes | |
uhd::property_tree::sptr | _tree |
Property sub-tree. More... | |
uhd::fs_path | _root_path |
Root node of this block's properties. More... | |
blockdef::sptr | _block_def |
Block definition (stores info about the block such as ports) More... | |
Protected Attributes inherited from uhd::rfnoc::node_ctrl_base | |
uhd::device_addr_t | _args |
Stores default arguments. More... | |
node_map_t | _upstream_nodes |
List of upstream nodes. More... | |
node_map_t | _downstream_nodes |
List of downstream nodes. More... | |
size_t | _num_input_ports |
size_t | _num_output_ports |
std::map< size_t, bool > | _rx_streamer_active |
std::map< size_t, bool > | _tx_streamer_active |
typedef boost::function<sptr(const make_args_t&)> uhd::rfnoc::block_ctrl_base::make_t |
typedef boost::shared_ptr<block_ctrl_base> uhd::rfnoc::block_ctrl_base::sptr |
|
inlineprotected |
|
protectedvirtual |
|
protected |
Constructor. This is only called from the internal block factory!
make_args | All arguments to this constructor are passed in this object. Its details are subject to change. Use the UHD_RFNOC_BLOCK_CONSTRUCTOR() macro to set up your block's constructor in a portable fashion. |
|
protectedvirtual |
Override this function if your block does something else.
|
protected |
|
protectedvirtual |
Override this function if your block needs to specially handle.
|
virtual |
Reset block after streaming operation.
This does the following:
Internally, rfnoc::node_ctrl_base::clear() and _clear() are called (in that order).
Between runs, it can be necessary to call this method, or blocks might be left hanging in a streaming state, and can get confused when a new application starts.
For custom behaviour, overwrite _clear(). If you do so, you must take take care of resetting flow control yourself.
TODO: Find better name (it disconnects, clears FC...)
Reimplemented from uhd::rfnoc::node_ctrl_base.
void uhd::rfnoc::block_ctrl_base::clear_command_time | ( | const size_t | port | ) |
Resets the command time. Any command packet after this call will no longer have a time associated with it.
uhd::assertion_error | if the underlying interface does not actually support timing. |
uint32_t uhd::rfnoc::block_ctrl_base::get_address | ( | size_t | block_port = 0 | ) |
Returns the 16-Bit address for this block.
std::string uhd::rfnoc::block_ctrl_base::get_arg | ( | const std::string & | key, |
const size_t | port = 0 |
||
) | const |
Return a single block argument in string format.
|
inline |
Direct access to get a block argument.
|
inlineprotected |
Return the property tree path to a block argument key
on port
.
std::string uhd::rfnoc::block_ctrl_base::get_arg_type | ( | const std::string & | key, |
const size_t | port = 0 |
||
) | const |
uhd::device_addr_t uhd::rfnoc::block_ctrl_base::get_args | ( | const size_t | port = 0 | ) | const |
Return all block arguments as a device_addr_t.
|
inline |
Returns the unique block ID for this block (e.g. "0/FFT_1").
time_spec_t uhd::rfnoc::block_ctrl_base::get_command_time | ( | const size_t | port = 0 | ) |
Returns the current command time for all future command packets.
|
protected |
Get a control interface object for block port block_port
.
std::vector<size_t> uhd::rfnoc::block_ctrl_base::get_ctrl_ports | ( | ) | const |
Returns a list of valid ports that can be used for sr_write(), sr_read() etc.
|
static |
Create a block controller class given a NoC-ID or a block name.
If a block name is given in make_args
, it will directly try to generate a block of this type. If no block name is given, it will look up a name using the NoC-ID and use that. If it can't find a suitable block controller class, it will generate a uhd::rfnoc::block_ctrl. However, if a block name is specified, it will throw a uhd::runtime_error if this block type is not registered.
make_args | Valid make args. |
noc_id | The 64-Bit NoC-ID. |
|
static |
Register a block controller class into the discovery and factory system.
Note: It is not recommended to call this function directly. Rather, use the UHD_RFNOC_BLOCK_REGISTER() macro, which will set up the discovery and factory system correctly.
make | A factory function that makes a block controller object |
name | A unique block name, e.g. 'FFT'. If a block has this block name, it will use make to generate the block controller class. |
void uhd::rfnoc::block_ctrl_base::set_arg | ( | const std::string & | key, |
const std::string & | val, | ||
const size_t | port = 0 |
||
) |
Set a specific block argument. val
is converted to the corresponding.
|
inline |
Direct access to set a block argument.
void uhd::rfnoc::block_ctrl_base::set_args | ( | const uhd::device_addr_t & | args, |
const size_t | port = 0 |
||
) |
Set multiple block args. Calls set_arg() for all individual items.
Note that this function will silently ignore any keys in args
that aren't already registered as block arguments.
void uhd::rfnoc::block_ctrl_base::set_command_tick_rate | ( | const double | tick_rate, |
const size_t | port = ANY_PORT |
||
) |
Sets a tick rate for the command timebase.
tick_rate | The tick rate in Hz |
port | Port |
void uhd::rfnoc::block_ctrl_base::set_command_time | ( | const time_spec_t & | time_spec, |
const size_t | port = ANY_PORT |
||
) |
Sets a command time for all future command packets.
uhd::assertion_error | if the underlying interface does not actually support timing. |
uint32_t uhd::rfnoc::block_ctrl_base::sr_read32 | ( | const settingsbus_reg_t | reg, |
const size_t | port = 0 |
||
) |
Allows reading one register on the settings bus (32-Bit version).
reg | The settings register to be read. |
port | Port on which to read |
Returns the readback value.
uint64_t uhd::rfnoc::block_ctrl_base::sr_read64 | ( | const settingsbus_reg_t | reg, |
const size_t | port = 0 |
||
) |
Allows reading one register on the settings bus (64-Bit version).
reg | The settings register to be read. |
port | Port on which to read |
Returns the readback value.
void uhd::rfnoc::block_ctrl_base::sr_write | ( | const uint32_t | reg, |
const uint32_t | data, | ||
const size_t | port = 0 |
||
) |
Allows setting one register on the settings bus.
Note: There is no address translation ("memory mapping") necessary. Register 0 is 0, 1 is 1 etc.
reg | The settings register to write to. |
data | New value of this register. |
port | Port on which to write |
void uhd::rfnoc::block_ctrl_base::sr_write | ( | const std::string & | reg, |
const uint32_t | data, | ||
const size_t | port = 0 |
||
) |
Allows setting one register on the settings bus.
Like sr_write(), but takes a register name as argument.
reg | The settings register to write to. |
data | New value of this register. |
port | Port on which to write |
uhd::key_error | if reg is not a valid register name |
|
inlinevirtual |
Shorthand for get_block_id().to_string()
Reimplemented from uhd::rfnoc::node_ctrl_base.
uint32_t uhd::rfnoc::block_ctrl_base::user_reg_read32 | ( | const uint32_t | addr, |
const size_t | port = 0 |
||
) |
Allows reading one user-defined register (32-Bit version).
This is a shorthand for setting the requested address through sr_write() and then reading SR_READBACK_REG_USER with sr_read32().
addr | The user register address. |
port | Port on which to read |
uint32_t uhd::rfnoc::block_ctrl_base::user_reg_read32 | ( | const std::string & | reg, |
const size_t | port = 0 |
||
) |
Allows reading one user-defined register (32-Bit version).
Identical to user_reg_read32(), but takes a register name instead of a numeric address. The register name must be defined in the block definition file.
reg | The user register name. |
port | Destination port. |
uhd::key_error | if reg is not a valid register name |
port | Port from which to read |
uint64_t uhd::rfnoc::block_ctrl_base::user_reg_read64 | ( | const uint32_t | addr, |
const size_t | port = 0 |
||
) |
Allows reading one user-defined register (64-Bit version).
This is a shorthand for setting the requested address through sr_write() and then reading SR_READBACK_REG_USER with sr_read64().
addr | The user register address. |
port | Port on which to read |
uint64_t uhd::rfnoc::block_ctrl_base::user_reg_read64 | ( | const std::string & | reg, |
const size_t | port = 0 |
||
) |
Allows reading one user-defined register (64-Bit version).
Identical to user_reg_read64(), but takes a register name instead of a numeric address. The register name must be defined in the block definition file.
reg | The user register address. |
port | Port on which to read |
uhd::key_error | if reg is not a valid register name |
|
protected |
Block definition (stores info about the block such as ports)
|
protected |
Root node of this block's properties.
|
protected |
Property sub-tree.