USRP Hardware Driver and USRP Manual  Version: 004.000.000.HEAD-0-g8773fb2c
UHD and USRP Manual
uhd::rfnoc::block_ctrl_base Class Reference

#include <uhd/rfnoc/block_ctrl_base.hpp>

Inheritance diagram for uhd::rfnoc::block_ctrl_base:
uhd::rfnoc::node_ctrl_base uhd::rfnoc::sink_block_ctrl_base uhd::rfnoc::source_block_ctrl_base uhd::rfnoc::block_ctrl uhd::rfnoc::ddc_block_ctrl uhd::rfnoc::dma_fifo_block_ctrl uhd::rfnoc::duc_block_ctrl uhd::rfnoc::fir_block_ctrl uhd::rfnoc::null_block_ctrl uhd::rfnoc::radio_ctrl uhd::rfnoc::siggen_block_ctrl uhd::rfnoc::window_block_ctrl uhd::rfnoc::block_ctrl uhd::rfnoc::ddc_block_ctrl uhd::rfnoc::dma_fifo_block_ctrl uhd::rfnoc::duc_block_ctrl uhd::rfnoc::fir_block_ctrl uhd::rfnoc::null_block_ctrl uhd::rfnoc::radio_ctrl uhd::rfnoc::siggen_block_ctrl uhd::rfnoc::window_block_ctrl

Public Types

typedef boost::shared_ptr< block_ctrl_basesptr
 
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_basesptr
 
typedef boost::weak_ptr< node_ctrl_basewptr
 
typedef std::map< size_t, wptrnode_map_t
 
typedef std::pair< size_t, wptrnode_map_pair_t
 

Public Member Functions

boost::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 boost::uint32_t reg, const boost::uint32_t data, const size_t port=0)
 
void sr_write (const std::string &reg, const boost::uint32_t data, const size_t port=0)
 
boost::uint64_t sr_read64 (const settingsbus_reg_t reg, const size_t port=0)
 
boost::uint32_t sr_read32 (const settingsbus_reg_t reg, const size_t port=0)
 
boost::uint64_t user_reg_read64 (const boost::uint32_t addr, const size_t port=0)
 
boost::uint64_t user_reg_read64 (const std::string &reg, const size_t port=0)
 
boost::uint32_t user_reg_read32 (const boost::uint32_t addr, const size_t port=0)
 
boost::uint32_t user_reg_read32 (const std::string &reg, 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 (const size_t port=0)
 
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 >
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
virtual void clear ()
 
node_map_t list_downstream_nodes ()
 
node_map_t list_upstream_nodes ()
 
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 ()
 
template<typename T >
UHD_INLINE std::vector< boost::shared_ptr< T > > find_upstream_node ()
 
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, boost::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...
 
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...
 
- 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...
 
bool _transport_is_big_endian
 Endianness of underlying transport (for data transport) 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...
 

Member Typedef Documentation

◆ make_t

typedef boost::function<sptr(const make_args_t &)> uhd::rfnoc::block_ctrl_base::make_t

◆ sptr

Constructor & Destructor Documentation

◆ block_ctrl_base() [1/2]

uhd::rfnoc::block_ctrl_base::block_ctrl_base ( void  )
inlineprotected

◆ ~block_ctrl_base()

virtual uhd::rfnoc::block_ctrl_base::~block_ctrl_base ( )
protectedvirtual

◆ block_ctrl_base() [2/2]

uhd::rfnoc::block_ctrl_base::block_ctrl_base ( const make_args_t make_args)
protected

Constructor. This is only called from the internal block factory!

Parameters
make_argsAll 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.

Member Function Documentation

◆ _clear()

virtual void uhd::rfnoc::block_ctrl_base::_clear ( const size_t  port = 0)
protectedvirtual

Override this function if your block does something else.

◆ _resolve_port_def()

stream_sig_t uhd::rfnoc::block_ctrl_base::_resolve_port_def ( const blockdef::port_t port_def) const
protected

◆ clear()

void uhd::rfnoc::block_ctrl_base::clear ( const size_t  port = 0)

Reset block after streaming operation.

This does the following:

  • Reset flow control (sequence numbers etc.)
  • Clear the list of connected blocks

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...)

◆ clear_command_time()

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.

Exceptions
uhd::assertion_errorif the underlying interface does not actually support timing.

◆ get_address()

boost::uint32_t uhd::rfnoc::block_ctrl_base::get_address ( size_t  block_port = 0)

Returns the 16-Bit address for this block.

◆ get_arg() [1/2]

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.

◆ get_arg() [2/2]

template<typename T >
T uhd::rfnoc::block_ctrl_base::get_arg ( const std::string &  key,
const size_t  port = 0 
) const
inline

Direct access to get a block argument.

◆ get_arg_path()

uhd::fs_path uhd::rfnoc::block_ctrl_base::get_arg_path ( const std::string &  key,
size_t  port = 0 
) const
inlineprotected

Return the property tree path to a block argument key on port.

◆ get_arg_type()

std::string uhd::rfnoc::block_ctrl_base::get_arg_type ( const std::string &  key,
const size_t  port = 0 
) const

◆ get_args()

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.

◆ get_block_id()

block_id_t uhd::rfnoc::block_ctrl_base::get_block_id ( ) const
inline

Returns the unique block ID for this block (e.g. "0/FFT_1").

◆ get_command_time()

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.

Returns
the command time as a time_spec_t.

◆ get_ctrl_iface()

wb_iface::sptr uhd::rfnoc::block_ctrl_base::get_ctrl_iface ( const size_t  block_port)
protected

Get a control interface object for block port block_port.

◆ get_ctrl_ports()

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.

◆ make()

static sptr uhd::rfnoc::block_ctrl_base::make ( const make_args_t make_args,
boost::uint64_t  noc_id = ~0 
)
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.

Parameters
make_argsValid make args.
noc_idThe 64-Bit NoC-ID.
Returns
a shared pointer to a new device instance

◆ register_block()

static void uhd::rfnoc::block_ctrl_base::register_block ( const make_t make,
const std::string &  name 
)
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.

Parameters
makeA factory function that makes a block controller object
nameA unique block name, e.g. 'FFT'. If a block has this block name, it will use make to generate the block controller class.

◆ set_arg() [1/2]

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.

◆ set_arg() [2/2]

template<typename T >
void uhd::rfnoc::block_ctrl_base::set_arg ( const std::string &  key,
const T &  val,
const size_t  port = 0 
)
inline

Direct access to set a block argument.

◆ set_args()

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.

◆ set_command_tick_rate()

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.

Parameters
thetick rate in Hz port Port

◆ set_command_time()

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.

Exceptions
uhd::assertion_errorif the underlying interface does not actually support timing.

◆ sr_read32()

boost::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).

Parameters
regThe settings register to be read.
portPort on which to read

Returns the readback value.

◆ sr_read64()

boost::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).

Parameters
regThe settings register to be read.
portPort on which to read

Returns the readback value.

◆ sr_write() [1/2]

void uhd::rfnoc::block_ctrl_base::sr_write ( const boost::uint32_t  reg,
const boost::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.

Parameters
regThe settings register to write to.
dataNew value of this register.

◆ sr_write() [2/2]

void uhd::rfnoc::block_ctrl_base::sr_write ( const std::string &  reg,
const boost::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.

Parameters
regThe settings register to write to.
dataNew value of this register.
portPort on which to write
Exceptions
uhd::key_errorif reg is not a valid register name

◆ unique_id()

std::string uhd::rfnoc::block_ctrl_base::unique_id ( ) const
inlinevirtual

Shorthand for get_block_id().to_string()

Reimplemented from uhd::rfnoc::node_ctrl_base.

◆ user_reg_read32() [1/2]

boost::uint32_t uhd::rfnoc::block_ctrl_base::user_reg_read32 ( const boost::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().

Parameters
addrThe user register address.
portPort on which to read
Returns
the readback value.

◆ user_reg_read32() [2/2]

boost::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.

Parameters
regThe user register name.
Returns
the readback value.
Exceptions
uhd::key_errorif reg is not a valid register name

◆ user_reg_read64() [1/2]

boost::uint64_t uhd::rfnoc::block_ctrl_base::user_reg_read64 ( const boost::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().

Parameters
addrThe user register address.
portPort on which to read
Returns
the readback value.

◆ user_reg_read64() [2/2]

boost::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.

Parameters
addrThe user register address.
portPort on which to read
Returns
the readback value.
Exceptions
uhd::key_errorif reg is not a valid register name

Member Data Documentation

◆ _block_def

blockdef::sptr uhd::rfnoc::block_ctrl_base::_block_def
protected

Block definition (stores info about the block such as ports)

◆ _root_path

uhd::fs_path uhd::rfnoc::block_ctrl_base::_root_path
protected

Root node of this block's properties.

◆ _transport_is_big_endian

bool uhd::rfnoc::block_ctrl_base::_transport_is_big_endian
protected

Endianness of underlying transport (for data transport)

◆ _tree

uhd::property_tree::sptr uhd::rfnoc::block_ctrl_base::_tree
protected

Property sub-tree.


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