From 7e1b567d538011df383c62239ca52fe6887d54d9 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 21 May 2019 17:08:07 -0700 Subject: 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. --- host/include/uhd/rfnoc/node_ctrl_base.hpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'host/include') 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 #include +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 wptr; typedef std::map node_map_t; typedef std::pair node_map_pair_t; + typedef boost::function 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 >& 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 _upstream_ports; @@ -272,6 +298,8 @@ private: */ std::map _downstream_ports; + graph_update_cb_t _graph_update_cb; + }; /* class node_ctrl_base */ }} /* namespace uhd::rfnoc */ -- cgit v1.2.3