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/lib/rfnoc/client_zero.cpp | |
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/lib/rfnoc/client_zero.cpp')
-rw-r--r-- | host/lib/rfnoc/client_zero.cpp | 27 |
1 files changed, 7 insertions, 20 deletions
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) |