diff options
-rw-r--r-- | host/include/uhd/rfnoc/noc_block_base.hpp | 8 | ||||
-rw-r--r-- | host/include/uhd/rfnoc/noc_block_make_args.hpp | 3 | ||||
-rw-r--r-- | host/lib/rfnoc/noc_block_base.cpp | 1 | ||||
-rw-r--r-- | host/tests/rfnoc_blocks_test.cpp | 2 |
4 files changed, 14 insertions, 0 deletions
diff --git a/host/include/uhd/rfnoc/noc_block_base.hpp b/host/include/uhd/rfnoc/noc_block_base.hpp index 6396d64df..fb26f6089 100644 --- a/host/include/uhd/rfnoc/noc_block_base.hpp +++ b/host/include/uhd/rfnoc/noc_block_base.hpp @@ -11,6 +11,7 @@ #include <uhd/rfnoc/block_id.hpp> #include <uhd/rfnoc/node.hpp> #include <uhd/rfnoc/register_iface_holder.hpp> +#include <uhd/types/device_addr.hpp> //! Shorthand for block constructor #define RFNOC_BLOCK_CONSTRUCTOR(CLASS_NAME) \ @@ -100,6 +101,10 @@ public: */ double get_tick_rate() const { return _tick_rate; } + /*! Return the arguments that were passed into this block from the framework + */ + uhd::device_addr_t get_block_args() const { return _block_args; } + protected: noc_block_base(make_args_ptr make_args); @@ -184,6 +189,9 @@ private: // block had requested and was granted access std::shared_ptr<mb_controller> _mb_controller; + //! Arguments that were passed into this block + const uhd::device_addr_t _block_args; + }; // class noc_block_base }} /* namespace uhd::rfnoc */ diff --git a/host/include/uhd/rfnoc/noc_block_make_args.hpp b/host/include/uhd/rfnoc/noc_block_make_args.hpp index 2d42d476e..8a5fbd46f 100644 --- a/host/include/uhd/rfnoc/noc_block_make_args.hpp +++ b/host/include/uhd/rfnoc/noc_block_make_args.hpp @@ -51,6 +51,9 @@ struct noc_block_base::make_args_t //! The subtree for this block uhd::property_tree::sptr tree; + + //! Additional args that can be parsed and used by this block + uhd::device_addr_t args; }; }} /* namespace uhd::rfnoc */ diff --git a/host/lib/rfnoc/noc_block_base.cpp b/host/lib/rfnoc/noc_block_base.cpp index 97aaeb002..f99d5aae7 100644 --- a/host/lib/rfnoc/noc_block_base.cpp +++ b/host/lib/rfnoc/noc_block_base.cpp @@ -25,6 +25,7 @@ noc_block_base::noc_block_base(make_args_ptr make_args) , _num_output_ports(make_args->num_output_ports) , _clock_iface(make_args->clk_iface) , _mb_controller(std::move(make_args->mb_control)) + , _block_args(make_args->args) { // First, create one tick_rate property for every port _tick_rate_props.reserve(get_num_input_ports() + get_num_output_ports()); diff --git a/host/tests/rfnoc_blocks_test.cpp b/host/tests/rfnoc_blocks_test.cpp index 113fbf630..4b393eb36 100644 --- a/host/tests/rfnoc_blocks_test.cpp +++ b/host/tests/rfnoc_blocks_test.cpp @@ -49,12 +49,14 @@ BOOST_AUTO_TEST_CASE(test_ddc_block) constexpr noc_block_base::noc_id_t mock_noc_id = 0x7E57DDC0; auto ddc_make_args = make_make_args(mock_noc_id, "0/DDC#0", num_chans, num_chans); + ddc_make_args->args = uhd::device_addr_t("foo=bar"); auto ddc_reg_iface = std::dynamic_pointer_cast<mock_reg_iface_t>(ddc_make_args->reg_iface); ddc_reg_iface->read_memory[ddc_block_control::RB_COMPAT_NUM] = (ddc_block_control::MAJOR_COMPAT << 16) | ddc_block_control::MINOR_COMPAT; ddc_reg_iface->read_memory[ddc_block_control::RB_NUM_HB] = num_hb; ddc_reg_iface->read_memory[ddc_block_control::RB_CIC_MAX_DECIM] = max_cic; auto test_ddc = ddc_block_control_make(std::move(ddc_make_args)); + BOOST_CHECK_EQUAL(test_ddc->get_block_args().get("foo"), "bar"); node_accessor.init_props(test_ddc.get()); UHD_LOG_DEBUG("TEST", "Init done."); |