 |
USRP Hardware Driver and USRP Manual
Version: 3.15.0.0-2+b1
UHD and USRP Manual
|
|
Go to the documentation of this file.
8 #ifndef INCLUDED_LIBUHD_BLOCK_CTRL_BASE_HPP
9 #define INCLUDED_LIBUHD_BLOCK_CTRL_BASE_HPP
23 #include <boost/shared_ptr.hpp>
25 namespace uhd {
namespace rfnoc {
59 #define UHD_RFNOC_BLOCK_OBJECT(class_name) typedef boost::shared_ptr<class_name> sptr;
62 #define UHD_RFNOC_BLOCK_CONSTRUCTOR(CLASS_NAME) \
63 CLASS_NAME##_impl(const make_args_t& make_args) : block_ctrl_base(make_args)
67 #define UHD_RFNOC_BLOCK_REGISTER(CLASS_NAME, BLOCK_NAME) \
68 block_ctrl_base::sptr CLASS_NAME##_make(const make_args_t& make_args) \
70 return block_ctrl_base::sptr(new CLASS_NAME##_impl(make_args)); \
72 UHD_STATIC_BLOCK(register_rfnoc_##CLASS_NAME) \
74 uhd::rfnoc::block_ctrl_base::register_block(&CLASS_NAME##_make, BLOCK_NAME); \
93 typedef boost::shared_ptr<block_ctrl_base>
sptr;
169 void sr_write(
const uint32_t reg,
const uint32_t data,
const size_t port = 0);
181 void sr_write(
const std::string& reg,
const uint32_t data,
const size_t port = 0);
224 uint64_t
user_reg_read64(
const std::string& reg,
const size_t port = 0);
249 uint32_t
user_reg_read32(
const std::string& reg,
const size_t port = 0);
313 void set_arg(
const std::string& key,
const std::string& val,
const size_t port = 0);
316 template <
typename T>
317 void set_arg(
const std::string& key,
const T& val,
const size_t port = 0)
326 std::string
get_arg(
const std::string& key,
const size_t port = 0)
const;
329 template <
typename T>
330 T
get_arg(
const std::string& key,
const size_t port = 0)
const
335 std::string
get_arg_type(
const std::string& key,
const size_t port = 0)
const;
373 virtual void _clear(
const size_t port = 0);
394 void _init_port_defs(
const std::string& direction,
396 const size_t first_port_index = 0);
399 void _init_block_args();
402 double get_command_tick_rate(
const size_t port);
405 void _start_drain(
const size_t port = 0);
408 bool _flush(
const size_t port = 0);
414 std::map<size_t, boost::shared_ptr<ctrl_iface> > _ctrl_ifaces;
415 std::map<size_t, time_spec_t> _cmd_timespecs;
416 std::map<size_t, double> _cmd_tickrates;
419 uint32_t _base_address;
425 uint64_t _compat_num;
431 boost::shared_ptr<nocscript::block_iface> _nocscript_iface;
uint64_t user_reg_read64(const uint32_t addr, const size_t port=0)
uhd::device_addr_t get_args(const size_t port=0) const
Return all block arguments as a device_addr_t.
boost::shared_ptr< timed_wb_iface > sptr
Definition: wb_iface.hpp:72
settingsbus_reg_t
Settings register readback.
Definition: constants.hpp:69
uint32_t base_address
This block's base address (address of block port 0)
Definition: block_ctrl_base.hpp:44
uint32_t sr_read32(const settingsbus_reg_t reg, const size_t port=0)
stream_sig_t _resolve_port_def(const blockdef::port_t &port_def) const
std::string unique_id() const
Definition: block_ctrl_base.hpp:144
blockdef::sptr _block_def
Block definition (stores info about the block such as ports)
Definition: block_ctrl_base.hpp:381
Definition: block_id.hpp:39
uhd::property_tree::sptr tree
A property tree for this motherboard. Example: If the root a device's.
Definition: block_ctrl_base.hpp:50
std::map< size_t, boost::shared_ptr< ctrl_iface > > ctrl_ifaces
A valid interface that allows us to read and write registers.
Definition: block_ctrl_base.hpp:42
Definition: block_ctrl_base.hpp:34
time_spec_t get_command_time(const size_t port=0)
boost::shared_ptr< blockdef > sptr
Definition: blockdef.hpp:25
void set_command_time(const time_spec_t &time_spec, const size_t port=ANY_PORT)
make_args_t(const std::string &key="")
Definition: block_ctrl_base.hpp:36
std::vector< size_t > get_ctrl_ports() const
Definition: block_ctrl_base.hpp:87
std::string block_name
The name of the block as it will be addressed.
Definition: block_ctrl_base.hpp:52
timed_wb_iface::sptr get_ctrl_iface(const size_t block_port)
Get a control interface object for block port block_port.
#define UHD_RFNOC_API
Definition: config.hpp:117
static void register_block(const make_t &make, const std::string &name)
std::string to_string() const
Return a string like this: "0/FFT_1" (includes all components, if set)
Definition: node_ctrl_base.hpp:37
uint32_t user_reg_read32(const uint32_t addr, const size_t port=0)
virtual ~block_ctrl_base()
std::string block_key
The key of the block, i.e. how it was registered.
Definition: block_ctrl_base.hpp:54
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.
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.
void clear_command_time(const size_t port)
Describes port options for a block definition.
Definition: blockdef.hpp:34
boost::shared_ptr< block_ctrl_base > sptr
Definition: block_ctrl_base.hpp:92
Definition: device_addr.hpp:38
uint64_t sr_read64(const settingsbus_reg_t reg, const size_t port=0)
boost::shared_ptr< property_tree > sptr
Definition: property_tree.hpp:217
void sr_write(const uint32_t reg, const uint32_t data, 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.
Definition: build_info.hpp:13
size_t device_index
The device index (or motherboard index).
Definition: block_ctrl_base.hpp:46
Definition: time_spec.hpp:29
block_ctrl_base(void)
Definition: block_ctrl_base.hpp:335
Definition: property_tree.hpp:199
virtual void _clear(const size_t port=0)
Override this function if your block does something else.
uhd::property_tree::sptr _tree
Property sub-tree.
Definition: block_ctrl_base.hpp:375
block_id_t get_block_id() const
Definition: block_ctrl_base.hpp:137
uhd::fs_path _root_path
Root node of this block's properties.
Definition: block_ctrl_base.hpp:378
std::string get_arg_type(const std::string &key, const size_t port=0) const
boost::function< sptr(const make_args_t &)> make_t
Definition: block_ctrl_base.hpp:93
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.
Definition: block_ctrl_base.hpp:352
void set_command_tick_rate(const double tick_rate, const size_t port=ANY_PORT)
Definition: stream_sig.hpp:23
std::string get_arg(const std::string &key, const size_t port=0) const
Return a single block argument in string format.
uint32_t get_address(size_t block_port=0)
std::vector< port_t > ports_t
Definition: blockdef.hpp:52
void set_args(const uhd::device_addr_t &args, const size_t port=0)