diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-01-16 15:16:05 -0800 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2019-01-17 18:03:42 -0800 |
commit | 6bd47c969222ee9e5e89cd00ebea9141c215e55c (patch) | |
tree | 3cbddae51f99bef056446ae936fd409aee0add66 /host/lib/rfnoc/rx_stream_terminator.cpp | |
parent | 18cfd25129d06c456eade78d4e74dc4dceae6501 (diff) | |
download | uhd-6bd47c969222ee9e5e89cd00ebea9141c215e55c.tar.gz uhd-6bd47c969222ee9e5e89cd00ebea9141c215e55c.tar.bz2 uhd-6bd47c969222ee9e5e89cd00ebea9141c215e55c.zip |
lib: rfnoc: apply clang-format
This is a continuation of 967be2a4.
$ clang-format -i -style=file host/lib/rfnoc/*.cpp
Diffstat (limited to 'host/lib/rfnoc/rx_stream_terminator.cpp')
-rw-r--r-- | host/lib/rfnoc/rx_stream_terminator.cpp | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/host/lib/rfnoc/rx_stream_terminator.cpp b/host/lib/rfnoc/rx_stream_terminator.cpp index 83c0420e2..18ecb4974 100644 --- a/host/lib/rfnoc/rx_stream_terminator.cpp +++ b/host/lib/rfnoc/rx_stream_terminator.cpp @@ -6,20 +6,20 @@ // #include "../transport/super_recv_packet_handler.hpp" -#include <uhd/utils/log.hpp> #include <uhd/rfnoc/source_node_ctrl.hpp> -#include <uhdlib/rfnoc/rx_stream_terminator.hpp> +#include <uhd/utils/log.hpp> #include <uhdlib/rfnoc/radio_ctrl_impl.hpp> +#include <uhdlib/rfnoc/rx_stream_terminator.hpp> #include <boost/format.hpp> using namespace uhd::rfnoc; size_t rx_stream_terminator::_count = 0; -rx_stream_terminator::rx_stream_terminator() : - _term_index(_count), - _samp_rate(rate_node_ctrl::RATE_UNDEFINED), - _tick_rate(tick_node_ctrl::RATE_UNDEFINED) +rx_stream_terminator::rx_stream_terminator() + : _term_index(_count) + , _samp_rate(rate_node_ctrl::RATE_UNDEFINED) + , _tick_rate(tick_node_ctrl::RATE_UNDEFINED) { _count++; } @@ -38,20 +38,19 @@ void rx_stream_terminator::set_rx_streamer(bool active, const size_t) { // TODO this is identical to source_node_ctrl::set_rx_streamer() -> factor out UHD_RFNOC_BLOCK_TRACE() << "rx_stream_terminator::set_rx_streamer() " << active; - for(const node_ctrl_base::node_map_pair_t upstream_node: _upstream_nodes) { + for (const node_ctrl_base::node_map_pair_t upstream_node : _upstream_nodes) { source_node_ctrl::sptr curr_upstream_block_ctrl = boost::dynamic_pointer_cast<source_node_ctrl>(upstream_node.second.lock()); if (curr_upstream_block_ctrl) { curr_upstream_block_ctrl->set_rx_streamer( - active, - get_upstream_port(upstream_node.first) - ); + active, get_upstream_port(upstream_node.first)); } _rx_streamer_active[upstream_node.first] = active; } } -void rx_stream_terminator::handle_overrun(boost::weak_ptr<uhd::rx_streamer> streamer, const size_t) +void rx_stream_terminator::handle_overrun( + boost::weak_ptr<uhd::rx_streamer> streamer, const size_t) { std::unique_lock<std::mutex> l(_overrun_handler_mutex, std::defer_lock); if (!l.try_lock()) { @@ -59,24 +58,28 @@ void rx_stream_terminator::handle_overrun(boost::weak_ptr<uhd::rx_streamer> stre return; } - std::vector<boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> > upstream_radio_nodes = + std::vector<boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl>> upstream_radio_nodes = find_upstream_node<uhd::rfnoc::radio_ctrl_impl>(); const size_t n_radios = upstream_radio_nodes.size(); if (n_radios == 0) { return; } - UHD_RFNOC_BLOCK_TRACE() << "rx_stream_terminator::handle_overrun()" ; + UHD_RFNOC_BLOCK_TRACE() << "rx_stream_terminator::handle_overrun()"; boost::shared_ptr<uhd::transport::sph::recv_packet_streamer> my_streamer = - boost::dynamic_pointer_cast<uhd::transport::sph::recv_packet_streamer>(streamer.lock()); - if (not my_streamer) return; //If the rx_streamer has expired then overflow handling makes no sense. + boost::dynamic_pointer_cast<uhd::transport::sph::recv_packet_streamer>( + streamer.lock()); + if (not my_streamer) + return; // If the rx_streamer has expired then overflow handling makes no sense. bool in_continuous_streaming_mode = true; - int num_channels = 0; - for(const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> &node: upstream_radio_nodes) { + int num_channels = 0; + for (const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl>& node : + upstream_radio_nodes) { num_channels += node->get_active_rx_ports().size(); - for(const size_t port: node->get_active_rx_ports()) { - in_continuous_streaming_mode = in_continuous_streaming_mode && node->in_continuous_streaming_mode(port); + for (const size_t port : node->get_active_rx_ports()) { + in_continuous_streaming_mode = in_continuous_streaming_mode + && node->in_continuous_streaming_mode(port); } } if (num_channels == 0) { @@ -84,35 +87,40 @@ void rx_stream_terminator::handle_overrun(boost::weak_ptr<uhd::rx_streamer> stre } if (num_channels == 1 and in_continuous_streaming_mode) { - std::vector<size_t> active_rx_ports = upstream_radio_nodes[0]->get_active_rx_ports(); + std::vector<size_t> active_rx_ports = + upstream_radio_nodes[0]->get_active_rx_ports(); if (active_rx_ports.empty()) { return; } const size_t port = active_rx_ports[0]; - upstream_radio_nodes[0]->issue_stream_cmd(stream_cmd_t::STREAM_MODE_START_CONTINUOUS, port); + upstream_radio_nodes[0]->issue_stream_cmd( + stream_cmd_t::STREAM_MODE_START_CONTINUOUS, port); return; } ///////////////////////////////////////////////////////////// // MIMO overflow recovery time ///////////////////////////////////////////////////////////// - for(const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> &node: upstream_radio_nodes) { - for(const size_t port: node->get_active_rx_ports()) { + for (const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl>& node : + upstream_radio_nodes) { + for (const size_t port : node->get_active_rx_ports()) { // check all the ports on all the radios node->rx_ctrl_clear_cmds(port); node->issue_stream_cmd(stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS, port); } } - //flush transports + // flush transports my_streamer->flush_all(0.001); // TODO flushing will probably have to go away. - //restart streaming on all channels + // restart streaming on all channels if (in_continuous_streaming_mode) { stream_cmd_t stream_cmd(stream_cmd_t::STREAM_MODE_START_CONTINUOUS); stream_cmd.stream_now = false; - stream_cmd.time_spec = upstream_radio_nodes[0]->get_time_now() + time_spec_t(0.05); + stream_cmd.time_spec = + upstream_radio_nodes[0]->get_time_now() + time_spec_t(0.05); - for(const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl> &node: upstream_radio_nodes) { - for(const size_t port: node->get_active_rx_ports()) { + for (const boost::shared_ptr<uhd::rfnoc::radio_ctrl_impl>& node : + upstream_radio_nodes) { + for (const size_t port : node->get_active_rx_ports()) { node->issue_stream_cmd(stream_cmd, port); } } @@ -121,7 +129,6 @@ void rx_stream_terminator::handle_overrun(boost::weak_ptr<uhd::rx_streamer> stre rx_stream_terminator::~rx_stream_terminator() { - UHD_RFNOC_BLOCK_TRACE() << "rx_stream_terminator::~rx_stream_terminator() " ; + UHD_RFNOC_BLOCK_TRACE() << "rx_stream_terminator::~rx_stream_terminator() "; set_rx_streamer(false, 0); } - |