aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/include/uhd/rfnoc/node_ctrl_base.hpp28
-rw-r--r--host/lib/rfnoc/ddc_block_ctrl_impl.cpp9
-rw-r--r--host/lib/rfnoc/duc_block_ctrl_impl.cpp6
-rw-r--r--host/lib/rfnoc/legacy_compat.cpp6
-rw-r--r--host/lib/usrp/device3/device3_impl.cpp4
5 files changed, 41 insertions, 12 deletions
diff --git a/host/include/uhd/rfnoc/node_ctrl_base.hpp b/host/include/uhd/rfnoc/node_ctrl_base.hpp
index c92dd3639..c94507173 100644
--- a/host/include/uhd/rfnoc/node_ctrl_base.hpp
+++ b/host/include/uhd/rfnoc/node_ctrl_base.hpp
@@ -1,6 +1,7 @@
//
// Copyright 2014-2016 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
+// Copyright 2019 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
@@ -20,6 +21,11 @@
#include <map>
#include <set>
+namespace uhd { namespace usrp {
+// Forward declaration for friend clause
+class device3_impl;
+}} // namespace uhd::usrp
+
namespace uhd { namespace rfnoc {
#define UHD_RFNOC_BLOCK_TRACE() UHD_LOGGER_TRACE("RFNOC")
@@ -39,6 +45,7 @@ public:
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;
+ typedef boost::function<void(void)> graph_update_cb_t;
/***********************************************************************
* Node control
@@ -238,7 +245,21 @@ protected:
*/
virtual void _register_upstream_node(node_ctrl_base::sptr upstream_node, size_t port);
+ /*! Initiate the update graph callback
+ *
+ * Call this from your block when you've changed one of these:
+ * - sampling rate
+ * - scaling
+ * - tick rate
+ */
+ void update_graph()
+ {
+ _graph_update_cb();
+ }
+
private:
+ friend class uhd::usrp::device3_impl;
+
/*! Implements the search algorithm for find_downstream_node() and
* find_upstream_node().
*
@@ -264,6 +285,11 @@ private:
value_type NULL_VALUE,
const std::set<boost::shared_ptr<T> >& exclude_nodes);
+ void set_graph_update_cb(graph_update_cb_t graph_update_cb)
+ {
+ _graph_update_cb = graph_update_cb;
+ }
+
/*! Stores the remote port number of a downstream connection.
*/
std::map<size_t, size_t> _upstream_ports;
@@ -272,6 +298,8 @@ private:
*/
std::map<size_t, size_t> _downstream_ports;
+ graph_update_cb_t _graph_update_cb;
+
}; /* class node_ctrl_base */
}} /* namespace uhd::rfnoc */
diff --git a/host/lib/rfnoc/ddc_block_ctrl_impl.cpp b/host/lib/rfnoc/ddc_block_ctrl_impl.cpp
index 7785d525d..13bf43072 100644
--- a/host/lib/rfnoc/ddc_block_ctrl_impl.cpp
+++ b/host/lib/rfnoc/ddc_block_ctrl_impl.cpp
@@ -52,11 +52,12 @@ public:
.set_coercer([this, chan](const double value) {
return this->set_output_rate(value, chan);
})
- .set(default_output_rate);
+ .set(default_output_rate)
+ .add_coerced_subscriber([this](const double) { update_graph(); });
_tree->access<double>(get_arg_path("input_rate/value", chan))
- .add_coerced_subscriber([this, chan](const double rate) {
- this->set_input_rate(rate, chan);
- });
+ .add_coerced_subscriber(
+ [this, chan](const double rate) { this->set_input_rate(rate, chan); })
+ .add_coerced_subscriber([this](const double) { update_graph(); });
// Legacy properties (for backward compat w/ multi_usrp)
const uhd::fs_path dsp_base_path = _root_path / "legacy_api" / chan;
diff --git a/host/lib/rfnoc/duc_block_ctrl_impl.cpp b/host/lib/rfnoc/duc_block_ctrl_impl.cpp
index 0a24fcc31..18f6c9fb5 100644
--- a/host/lib/rfnoc/duc_block_ctrl_impl.cpp
+++ b/host/lib/rfnoc/duc_block_ctrl_impl.cpp
@@ -53,11 +53,13 @@ public:
.set_coercer([this, chan](const double value) {
return this->set_input_rate(value, chan);
})
- .set(default_input_rate);
+ .set(default_input_rate)
+ .add_coerced_subscriber([this](const double) { update_graph(); });
_tree->access<double>(get_arg_path("output_rate/value", chan))
.add_coerced_subscriber([this, chan](const double rate) {
this->set_output_rate(rate, chan);
- });
+ })
+ .add_coerced_subscriber([this](const double) { update_graph(); });
// Legacy properties (for backward compat w/ multi_usrp)
const uhd::fs_path dsp_base_path = _root_path / "legacy_api" / chan;
diff --git a/host/lib/rfnoc/legacy_compat.cpp b/host/lib/rfnoc/legacy_compat.cpp
index 3f2bc9584..30c3f628f 100644
--- a/host/lib/rfnoc/legacy_compat.cpp
+++ b/host/lib/rfnoc/legacy_compat.cpp
@@ -406,9 +406,6 @@ public:
.set(rate);
}
}
- // Update streamers:
- boost::dynamic_pointer_cast<uhd::usrp::device3_impl>(_device)
- ->update_rx_streamers();
}
void set_tx_rate(const double rate, const size_t chan)
@@ -458,9 +455,6 @@ public:
.set(rate);
}
}
- // Update streamers:
- boost::dynamic_pointer_cast<uhd::usrp::device3_impl>(_device)
- ->update_tx_streamers();
}
private: // types
diff --git a/host/lib/usrp/device3/device3_impl.cpp b/host/lib/usrp/device3/device3_impl.cpp
index d636b3338..ba88ed2e8 100644
--- a/host/lib/usrp/device3/device3_impl.cpp
+++ b/host/lib/usrp/device3/device3_impl.cpp
@@ -165,6 +165,10 @@ void device3_impl::enumerate_rfnoc_blocks(size_t device_index,
boost::lock_guard<boost::mutex> lock(_block_ctrl_mutex);
_rfnoc_block_ctrl.push_back(
uhd::rfnoc::block_ctrl_base::make(make_args, noc_id));
+ _rfnoc_block_ctrl.back()->set_graph_update_cb([this]() {
+ update_rx_streamers();
+ update_tx_streamers();
+ });
}
}
}