aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-05-21 17:08:07 -0700
committerBrent Stapleton <brent.stapleton@ettus.com>2019-07-15 10:12:33 -0700
commit7e1b567d538011df383c62239ca52fe6887d54d9 (patch)
treed6d672e4e0d42901b92163ae0a08acafa5d518f8 /host/include
parentcd755b0a51bb136ce4f17a83157c4d8fe5ffa972 (diff)
downloaduhd-7e1b567d538011df383c62239ca52fe6887d54d9.tar.gz
uhd-7e1b567d538011df383c62239ca52fe6887d54d9.tar.bz2
uhd-7e1b567d538011df383c62239ca52fe6887d54d9.zip
rfnoc: Add update_graph() API call
Blocks that change scaling, tick rate, or sampling rate can now notify the graph to update streamers. Before, this was handled only by mult_usrp, and only for DDC and DUC blocks.
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/rfnoc/node_ctrl_base.hpp28
1 files changed, 28 insertions, 0 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 */