From 12dd0939fcc877e4f30c045ead6b2d8fc2f63772 Mon Sep 17 00:00:00 2001 From: Trung Tran Date: Wed, 24 Oct 2018 11:01:31 -0700 Subject: block_ctrl_base: add UHD_SAFE_CALL to destructor This will stop the exception throw during destructor of E310 where new FPGA image(idle image) is load. --- host/lib/rfnoc/block_ctrl_base.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'host') diff --git a/host/lib/rfnoc/block_ctrl_base.cpp b/host/lib/rfnoc/block_ctrl_base.cpp index 277aedf80..fada105de 100644 --- a/host/lib/rfnoc/block_ctrl_base.cpp +++ b/host/lib/rfnoc/block_ctrl_base.cpp @@ -21,7 +21,7 @@ #include #include #include - +#include using namespace uhd; using namespace uhd::rfnoc; using std::string; @@ -143,18 +143,20 @@ block_ctrl_base::block_ctrl_base( block_ctrl_base::~block_ctrl_base() { - if (get_ctrl_ports().size() > 0) { - // Notify the data-path gatekeeper in noc_shell that we are done - // with this block. This operation disconnects the noc_block - // data-path from noc_shell which dumps all input and output - // packets that are in flight, for now and until the setting is - // disabled. This prevents long-running blocks without a tear-down - // mechanism to gracefully flush. - const size_t port = get_ctrl_ports().front(); - sr_write(SR_CLEAR_TX_FC, 0x2, port); // Disconnect TX data-path - sr_write(SR_CLEAR_RX_FC, 0x2, port); // Disconnect RX data-path - } - _tree->remove(_root_path); + UHD_SAFE_CALL( + if (get_ctrl_ports().size() > 0) { + // Notify the data-path gatekeeper in noc_shell that we are done + // with this block. This operation disconnects the noc_block + // data-path from noc_shell which dumps all input and output + // packets that are in flight, for now and until the setting is + // disabled. This prevents long-running blocks without a tear-down + // mechanism to gracefully flush. + const size_t port = get_ctrl_ports().front(); + sr_write(SR_CLEAR_TX_FC, 0x2, port); // Disconnect TX data-path + sr_write(SR_CLEAR_RX_FC, 0x2, port); // Disconnect RX data-path + } + _tree->remove(_root_path); + ) } void block_ctrl_base::_init_port_defs( -- cgit v1.2.3