diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-08-01 17:13:41 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:36 -0800 |
commit | 7bac67af0898486745ea2f0590e80f5e614196af (patch) | |
tree | b11925c15d84d455199c65b59e1383969aa9d625 /host | |
parent | bddaac5e2678b190719228fc26877af5a2ef1910 (diff) | |
download | uhd-7bac67af0898486745ea2f0590e80f5e614196af.tar.gz uhd-7bac67af0898486745ea2f0590e80f5e614196af.tar.bz2 uhd-7bac67af0898486745ea2f0590e80f5e614196af.zip |
rfnoc: client0: Change flush-all-blocks to not throw on timeout
The convenience call that flushed all the blocks would throw during
timeout. Now, it returns a bool whether or not the flush was successful.
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/client_zero.hpp | 4 | ||||
-rw-r--r-- | host/lib/rfnoc/client_zero.cpp | 27 | ||||
-rw-r--r-- | host/lib/rfnoc/rfnoc_graph.cpp | 4 |
3 files changed, 12 insertions, 23 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/client_zero.hpp b/host/lib/include/uhdlib/rfnoc/client_zero.hpp index b9bcb32e5..43f955870 100644 --- a/host/lib/include/uhdlib/rfnoc/client_zero.hpp +++ b/host/lib/include/uhdlib/rfnoc/client_zero.hpp @@ -154,9 +154,9 @@ public: bool complete_flush(uint16_t portno); /*! Go through the entire flush process for all ports - * \throws uhd::runtime_error if flush failed + * \return whether or not the flush succeeded */ - void complete_flush_all_blocks(); + bool complete_flush_all_blocks(); /*! Reset a port's control logic * diff --git a/host/lib/rfnoc/client_zero.cpp b/host/lib/rfnoc/client_zero.cpp index f5a54fd62..af23ba1cc 100644 --- a/host/lib/rfnoc/client_zero.cpp +++ b/host/lib/rfnoc/client_zero.cpp @@ -154,38 +154,25 @@ bool client_zero::complete_flush(uint16_t portno) return poll_flush_done(portno); } -void client_zero::complete_flush_all_blocks() +bool client_zero::complete_flush_all_blocks() { const size_t num_blocks = get_num_blocks(); const size_t first_block_port = 1 + get_num_stream_endpoints(); // Issue flush commands - auto flush_done = std::vector<bool>(); for (size_t portno = 0; portno < num_blocks; ++portno) { auto block_portno = portno + first_block_port; set_flush(block_portno); - flush_done.push_back(false); } // Poll for flush done - auto start = std::chrono::steady_clock::now(); - size_t flushes_done = 0; - while (flushes_done < num_blocks) { - for (size_t portno = 0; portno < num_blocks; ++portno) { - if (flush_done[portno]) { - continue; - } - if (std::chrono::steady_clock::now() > (start + DEFAULT_POLL_TIMEOUT)) { - throw uhd::runtime_error( - str(boost::format("Timeout while flushing port %d") % portno)); - } - auto block_portno = portno + first_block_port; - if (get_flush_done(block_portno)) { - flush_done[portno] = true; - flushes_done++; - } - } + bool all_ports_flushed = true; + for (size_t portno = 0; portno < num_blocks; ++portno) { + size_t block_portno = portno + first_block_port; + all_ports_flushed = all_ports_flushed && poll_flush_done(block_portno); } + + return all_ports_flushed; } void client_zero::reset_ctrl(uint16_t portno) diff --git a/host/lib/rfnoc/rfnoc_graph.cpp b/host/lib/rfnoc/rfnoc_graph.cpp index 795ffd289..f820a6960 100644 --- a/host/lib/rfnoc/rfnoc_graph.cpp +++ b/host/lib/rfnoc/rfnoc_graph.cpp @@ -663,7 +663,9 @@ private: std::string("Flushing and resetting blocks on mboard ") + std::to_string(mb_idx)); - mb_cz->complete_flush_all_blocks(); + if (!mb_cz->complete_flush_all_blocks()) { + UHD_LOG_WARNING(LOG_ID, "One or more blocks timed out during flush!"); + } // Reset for (size_t portno = 0; portno < num_blocks; ++portno) { |