aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-06-07 21:37:15 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:27 -0800
commit6bd43946a71173cbf0f1d318843ba34d6849dc30 (patch)
tree35e0b46fc8e399718d6adafcda0929c86e0035ad /host/lib/rfnoc
parent491a74269e7d7d7589119c22f229c994d8a2c3f8 (diff)
downloaduhd-6bd43946a71173cbf0f1d318843ba34d6849dc30.tar.gz
uhd-6bd43946a71173cbf0f1d318843ba34d6849dc30.tar.bz2
uhd-6bd43946a71173cbf0f1d318843ba34d6849dc30.zip
rfnoc: Add shutdown feature to blocks
On destruction, the rfnoc_graph will call shutdown() on all blocks. This allows a safe de-initialization of blocks independent of the lifetime of the noc_block_base::sptr. Also adds the shutdown feature to null_block_control.
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r--host/lib/rfnoc/block_container.cpp9
-rw-r--r--host/lib/rfnoc/noc_block_base.cpp13
-rw-r--r--host/lib/rfnoc/node.cpp5
-rw-r--r--host/lib/rfnoc/null_block_control.cpp8
-rw-r--r--host/lib/rfnoc/rfnoc_graph.cpp1
5 files changed, 33 insertions, 3 deletions
diff --git a/host/lib/rfnoc/block_container.cpp b/host/lib/rfnoc/block_container.cpp
index 0151b228b..6bbb3828b 100644
--- a/host/lib/rfnoc/block_container.cpp
+++ b/host/lib/rfnoc/block_container.cpp
@@ -6,6 +6,7 @@
#include <uhd/utils/log.hpp>
#include <uhdlib/rfnoc/block_container.hpp>
+#include <uhdlib/rfnoc/node_accessor.hpp>
#include <boost/format.hpp>
#include <algorithm>
@@ -72,3 +73,11 @@ noc_block_base::sptr block_container_t::get_block(const block_id_t& block_id) co
return *block_itr;
}
+void block_container_t::shutdown()
+{
+ node_accessor_t node_accessor{};
+ for (auto it = _blocks.begin(); it != _blocks.end(); ++it) {
+ node_accessor.shutdown(it->get());
+ }
+
+}
diff --git a/host/lib/rfnoc/noc_block_base.cpp b/host/lib/rfnoc/noc_block_base.cpp
index 6e72decfe..c0d8cf2a9 100644
--- a/host/lib/rfnoc/noc_block_base.cpp
+++ b/host/lib/rfnoc/noc_block_base.cpp
@@ -113,7 +113,20 @@ void noc_block_base::_set_tick_rate(const double tick_rate)
_tick_rate = tick_rate;
}
+void noc_block_base::shutdown()
+{
+ RFNOC_LOG_TRACE("Calling deinit()");
+ deinit();
+ RFNOC_LOG_DEBUG("Invalidating register interface");
+ update_reg_iface();
+}
+
std::shared_ptr<mb_controller> noc_block_base::get_mb_controller()
{
return _mb_controller;
}
+
+void noc_block_base::deinit()
+{
+ RFNOC_LOG_DEBUG("deinit() called, but not implemented.");
+}
diff --git a/host/lib/rfnoc/node.cpp b/host/lib/rfnoc/node.cpp
index 7eff22eab..b3ad2b380 100644
--- a/host/lib/rfnoc/node.cpp
+++ b/host/lib/rfnoc/node.cpp
@@ -540,6 +540,11 @@ void node_t::receive_action(const res_source_info& src_info, action_info::sptr a
}
}
+void node_t::shutdown()
+{
+ RFNOC_LOG_DEBUG("shutdown() not implemented.");
+}
+
bool node_t::_has_port(const res_source_info& port_info) const
{
return (port_info.type == res_source_info::INPUT_EDGE
diff --git a/host/lib/rfnoc/null_block_control.cpp b/host/lib/rfnoc/null_block_control.cpp
index be0738b76..21042453d 100644
--- a/host/lib/rfnoc/null_block_control.cpp
+++ b/host/lib/rfnoc/null_block_control.cpp
@@ -162,9 +162,11 @@ private:
});
}
- /**************************************************************************
- * FPGA communication (register IO)
- *************************************************************************/
+ void deinit()
+ {
+ issue_stream_cmd(stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
+ }
+
/**************************************************************************
* Attributes
diff --git a/host/lib/rfnoc/rfnoc_graph.cpp b/host/lib/rfnoc/rfnoc_graph.cpp
index 201920366..5b2277284 100644
--- a/host/lib/rfnoc/rfnoc_graph.cpp
+++ b/host/lib/rfnoc/rfnoc_graph.cpp
@@ -38,6 +38,7 @@ public:
~rfnoc_graph_impl()
{
_graph.reset();
+ _block_registry->shutdown();
}
/**************************************************************************