diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-03-02 15:25:13 -0800 |
---|---|---|
committer | atrnati <54334261+atrnati@users.noreply.github.com> | 2020-03-03 08:51:32 -0600 |
commit | 876d4150aa3da531ddd687b48afada6e43f79146 (patch) | |
tree | fd72a71419f4cd800d4e500cfcaded4dfc8dc367 /host/lib/rfnoc | |
parent | 1393553d623bdf4ba40d5435c9719b6ce990d9ac (diff) | |
download | uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.gz uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.bz2 uhd-876d4150aa3da531ddd687b48afada6e43f79146.zip |
uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r-- | host/lib/rfnoc/actions.cpp | 9 | ||||
-rw-r--r-- | host/lib/rfnoc/chdr_ctrl_xport.cpp | 28 | ||||
-rw-r--r-- | host/lib/rfnoc/chdr_packet.cpp | 4 | ||||
-rw-r--r-- | host/lib/rfnoc/chdr_tx_data_xport.cpp | 4 | ||||
-rw-r--r-- | host/lib/rfnoc/ctrlport_endpoint.cpp | 12 | ||||
-rw-r--r-- | host/lib/rfnoc/ddc_block_control.cpp | 3 | ||||
-rw-r--r-- | host/lib/rfnoc/device_id.cpp | 1 | ||||
-rw-r--r-- | host/lib/rfnoc/fft_block_control.cpp | 7 | ||||
-rw-r--r-- | host/lib/rfnoc/graph.cpp | 17 | ||||
-rw-r--r-- | host/lib/rfnoc/graph_stream_manager.cpp | 2 | ||||
-rw-r--r-- | host/lib/rfnoc/mb_controller.cpp | 7 | ||||
-rw-r--r-- | host/lib/rfnoc/mock_block.cpp | 1 | ||||
-rw-r--r-- | host/lib/rfnoc/noc_block_base.cpp | 8 | ||||
-rw-r--r-- | host/lib/rfnoc/node.cpp | 51 | ||||
-rw-r--r-- | host/lib/rfnoc/null_block_control.cpp | 17 | ||||
-rw-r--r-- | host/lib/rfnoc/radio_control_impl.cpp | 38 | ||||
-rw-r--r-- | host/lib/rfnoc/registry_factory.cpp | 16 | ||||
-rw-r--r-- | host/lib/rfnoc/rfnoc_graph.cpp | 9 | ||||
-rw-r--r-- | host/lib/rfnoc/rfnoc_rx_streamer.cpp | 51 | ||||
-rw-r--r-- | host/lib/rfnoc/rfnoc_tx_streamer.cpp | 37 | ||||
-rw-r--r-- | host/lib/rfnoc/tx_async_msg_queue.cpp | 9 |
21 files changed, 158 insertions, 173 deletions
diff --git a/host/lib/rfnoc/actions.cpp b/host/lib/rfnoc/actions.cpp index 3276c456c..86bc576f3 100644 --- a/host/lib/rfnoc/actions.cpp +++ b/host/lib/rfnoc/actions.cpp @@ -11,9 +11,9 @@ using namespace uhd::rfnoc; namespace { - // A static counter, which we use to uniquely label actions - std::atomic<size_t> action_counter{0}; -} +// A static counter, which we use to uniquely label actions +std::atomic<size_t> action_counter{0}; +} // namespace action_info::action_info(const std::string& key, const uhd::device_addr_t& args) : id(action_counter++), key(key), args(args) @@ -72,7 +72,8 @@ rx_event_action_info::sptr rx_event_action_info::make( /*** TX Metadata Action Info *************************************************/ tx_event_action_info::tx_event_action_info( - uhd::async_metadata_t::event_code_t event_code_, const boost::optional<uint64_t>& tsf_) + uhd::async_metadata_t::event_code_t event_code_, + const boost::optional<uint64_t>& tsf_) : action_info(ACTION_KEY_TX_EVENT), event_code(event_code_), has_tsf(tsf_) { if (has_tsf) { diff --git a/host/lib/rfnoc/chdr_ctrl_xport.cpp b/host/lib/rfnoc/chdr_ctrl_xport.cpp index 043055b75..a59d56b30 100644 --- a/host/lib/rfnoc/chdr_ctrl_xport.cpp +++ b/host/lib/rfnoc/chdr_ctrl_xport.cpp @@ -23,20 +23,18 @@ chdr_ctrl_xport::chdr_ctrl_xport(io_service::sptr io_srv, : _my_epid(my_epid), _recv_packet(pkt_factory.make_generic()) { /* Make dumb send pipe */ - send_io_if::send_callback_t send_cb = [this](frame_buff::uptr buff, - send_link_if* link) { + send_io_if::send_callback_t send_cb = [this]( + frame_buff::uptr buff, send_link_if* link) { link->release_send_buff(std::move(buff)); }; _send_if = io_srv->make_send_client( send_link, num_send_frames, send_cb, recv_link_if::sptr(), 0, nullptr, nullptr); /* Make dumb recv pipe that matches management and control packets */ - uhd::transport::recv_callback_t ctrl_recv_cb = [this](frame_buff::uptr& buff, - recv_link_if* /*recv_link*/, - send_link_if - * /*send_link*/) -> bool { - return this->_ctrl_recv_cb(buff); - }; + uhd::transport::recv_callback_t ctrl_recv_cb = + [this](frame_buff::uptr& buff, + recv_link_if* /*recv_link*/, + send_link_if * /*send_link*/) -> bool { return this->_ctrl_recv_cb(buff); }; recv_io_if::fc_callback_t release_cb = [this](frame_buff::uptr buff, recv_link_if* link, send_link_if* /*send_link*/) { @@ -46,12 +44,10 @@ chdr_ctrl_xport::chdr_ctrl_xport(io_service::sptr io_srv, _ctrl_recv_if = io_srv->make_recv_client( recv_link, num_recv_frames, ctrl_recv_cb, send_link_if::sptr(), 0, release_cb); - uhd::transport::recv_callback_t mgmt_recv_cb = [this](frame_buff::uptr& buff, - recv_link_if* /*recv_link*/, - send_link_if - * /*send_link*/) -> bool { - return this->_mgmt_recv_cb(buff); - }; + uhd::transport::recv_callback_t mgmt_recv_cb = + [this](frame_buff::uptr& buff, + recv_link_if* /*recv_link*/, + send_link_if * /*send_link*/) -> bool { return this->_mgmt_recv_cb(buff); }; _mgmt_recv_if = io_srv->make_recv_client( recv_link, 1, mgmt_recv_cb, send_link_if::sptr(), 0, release_cb); @@ -89,8 +85,8 @@ bool chdr_ctrl_xport::_mgmt_recv_cb(uhd::transport::frame_buff::uptr& buff) return false; } -void chdr_ctrl_xport::_release_cb(uhd::transport::frame_buff::uptr buff, - uhd::transport::recv_link_if* recv_link) +void chdr_ctrl_xport::_release_cb( + uhd::transport::frame_buff::uptr buff, uhd::transport::recv_link_if* recv_link) { recv_link->release_recv_buff(std::move(buff)); } diff --git a/host/lib/rfnoc/chdr_packet.cpp b/host/lib/rfnoc/chdr_packet.cpp index d4b7494e2..fc6c24838 100644 --- a/host/lib/rfnoc/chdr_packet.cpp +++ b/host/lib/rfnoc/chdr_packet.cpp @@ -115,8 +115,8 @@ public: + (chdr_w_stride * (_mdata_offset + get_chdr_header().get_num_mdata()))); } - virtual size_t calculate_payload_offset(const packet_type_t pkt_type, - const uint8_t num_mdata = 0) const + virtual size_t calculate_payload_offset( + const packet_type_t pkt_type, const uint8_t num_mdata = 0) const { chdr_header header; header.set_pkt_type(pkt_type); diff --git a/host/lib/rfnoc/chdr_tx_data_xport.cpp b/host/lib/rfnoc/chdr_tx_data_xport.cpp index 8837e2dbe..321b6ea85 100644 --- a/host/lib/rfnoc/chdr_tx_data_xport.cpp +++ b/host/lib/rfnoc/chdr_tx_data_xport.cpp @@ -62,9 +62,7 @@ chdr_tx_data_xport::chdr_tx_data_xport(uhd::transport::io_service::sptr io_srv, return this->_recv_callback(buff, recv_link, send_link); }; - auto fc_cb = [this](size_t num_bytes) { - return this->_fc_callback(num_bytes); - }; + auto fc_cb = [this](size_t num_bytes) { return this->_fc_callback(num_bytes); }; // Needs just a single recv frame for strs packets _send_io = io_srv->make_send_client(send_link, diff --git a/host/lib/rfnoc/ctrlport_endpoint.cpp b/host/lib/rfnoc/ctrlport_endpoint.cpp index 43bbf815c..f259f8f5d 100644 --- a/host/lib/rfnoc/ctrlport_endpoint.cpp +++ b/host/lib/rfnoc/ctrlport_endpoint.cpp @@ -297,9 +297,9 @@ public: // Flow control not needed because we have allocated special room in the // buffer for async message responses ctrl_payload tx_ctrl(rx_ctrl); - tx_ctrl.is_ack = true; - tx_ctrl.src_epid = _my_epid; - tx_ctrl.status = status; + tx_ctrl.is_ack = true; + tx_ctrl.src_epid = _my_epid; + tx_ctrl.status = status; const auto timeout = [&]() { std::unique_lock<std::mutex> lock(_mutex); return _policy.timeout; @@ -368,7 +368,6 @@ private: const uhd::time_spec_t& time_spec, const steady_clock::time_point& timeout_time) { - if (!_client_clk.is_running()) { throw uhd::system_error("Ctrlport client clock is not running"); } @@ -411,9 +410,8 @@ private: if (!buff_not_full()) { // If we're sending a timed command or if we have a timed command in the // queue, use the MASSIVE_TIMEOUT instead - auto timed_timeout = (check_timed_in_queue() - ? start_timeout(MASSIVE_TIMEOUT) - : timeout_time); + auto timed_timeout = + (check_timed_in_queue() ? start_timeout(MASSIVE_TIMEOUT) : timeout_time); if (not _buff_free_cond.wait_until(lock, timed_timeout, buff_not_full)) { throw uhd::op_timeout( "Control operation timed out waiting for space in command buffer"); diff --git a/host/lib/rfnoc/ddc_block_control.cpp b/host/lib/rfnoc/ddc_block_control.cpp index 8ab76f8ae..8942d128d 100644 --- a/host/lib/rfnoc/ddc_block_control.cpp +++ b/host/lib/rfnoc/ddc_block_control.cpp @@ -369,8 +369,7 @@ private: "Calling resolver for `samp_rate_out/scaling_out'@" << chan); if (samp_rate_out.is_valid()) { if (samp_rate_in.is_valid()) { - decim = - coerce_decim(samp_rate_in.get() / samp_rate_out.get()); + decim = coerce_decim(samp_rate_in.get() / samp_rate_out.get()); set_decim(decim.get(), chan); } // If decim is dirty, it will trigger the decim resolver. diff --git a/host/lib/rfnoc/device_id.cpp b/host/lib/rfnoc/device_id.cpp index 6bd287dce..ade4a3b8f 100644 --- a/host/lib/rfnoc/device_id.cpp +++ b/host/lib/rfnoc/device_id.cpp @@ -14,4 +14,3 @@ device_id_t uhd::rfnoc::allocate_device_id() static std::atomic<device_id_t> counter{1}; return counter++; } - diff --git a/host/lib/rfnoc/fft_block_control.cpp b/host/lib/rfnoc/fft_block_control.cpp index 266eb3e7f..c002d49bb 100644 --- a/host/lib/rfnoc/fft_block_control.cpp +++ b/host/lib/rfnoc/fft_block_control.cpp @@ -8,7 +8,6 @@ #include <uhd/rfnoc/defaults.hpp> #include <uhd/rfnoc/fft_block_control.hpp> #include <uhd/rfnoc/registry.hpp> - #include <string> using namespace uhd::rfnoc; @@ -57,7 +56,6 @@ public: private: - /************************************************************************** * Initialization *************************************************************************/ @@ -80,18 +78,17 @@ private: this->regs().poke32(SR_MAGNITUDE_OUT, uint32_t(this->_shift.get())); }); - //register edge properties + // register edge properties register_property(&_type_in); register_property(&_type_out); - //add resolvers for type (keeps it constant) + // add resolvers for type (keeps it constant) add_property_resolver({&_type_in}, {&_type_in}, [& type_in = _type_in]() { type_in.set(IO_TYPE_SC16); }); add_property_resolver({&_type_out}, {&_type_out}, [& type_out = _type_out]() { type_out.set(IO_TYPE_SC16); }); - } property_t<int> _size{PROP_KEY_FFT_LEN, DEFAULT_SIZE, {res_source_info::USER}}; diff --git a/host/lib/rfnoc/graph.cpp b/host/lib/rfnoc/graph.cpp index f3977f79e..56ebba5b8 100644 --- a/host/lib/rfnoc/graph.cpp +++ b/host/lib/rfnoc/graph.cpp @@ -18,7 +18,7 @@ using namespace uhd::rfnoc::detail; namespace { -const std::string LOG_ID = "RFNOC::GRAPH::DETAIL"; +const std::string LOG_ID = "RFNOC::GRAPH::DETAIL"; constexpr unsigned MAX_ACTION_ITERATIONS = 200; /*! Helper function to pretty-print edge info @@ -275,8 +275,8 @@ void graph_t::resolve_all_properties( } // Start iterating over nodes - bool forward_dir = true; - int num_iterations = 0; + bool forward_dir = true; + int num_iterations = 0; // If all edge properties were known at the beginning, a single iteration // would suffice. However, usually during the first time the property // propagation is run, blocks create new (dynamic) edge properties that @@ -425,10 +425,10 @@ void graph_t::enqueue_action( } // Unpack next action - auto& next_action = _action_queue.front(); - node_ref_t action_src_node = std::get<0>(next_action); - res_source_info action_src_port = std::get<1>(next_action); - action_info::sptr next_action_sptr = std::get<2>(next_action); + auto& next_action = _action_queue.front(); + node_ref_t action_src_node = std::get<0>(next_action); + res_source_info action_src_port = std::get<1>(next_action); + action_info::sptr next_action_sptr = std::get<2>(next_action); _action_queue.pop_front(); // Find the node that is supposed to receive this action, and if we find @@ -592,7 +592,7 @@ bool graph_t::_assert_edge_props_consistent(rfnoc_graph_t::edge_descriptor edge) void graph_t::_check_topology() { node_accessor_t node_accessor{}; - bool topo_ok = true; + bool topo_ok = true; auto v_iterators = boost::vertices(_graph); for (auto it = v_iterators.first; it != v_iterators.second; ++it) { node_ref_t node = boost::get(vertex_property_t(), _graph, *it); @@ -654,4 +654,3 @@ std::pair<graph_t::node_ref_t, graph_t::graph_edge_t> graph_t::_find_neighbour( UHD_THROW_INVALID_CODE_PATH(); } - diff --git a/host/lib/rfnoc/graph_stream_manager.cpp b/host/lib/rfnoc/graph_stream_manager.cpp index f8acab9f2..be2dff3ce 100644 --- a/host/lib/rfnoc/graph_stream_manager.cpp +++ b/host/lib/rfnoc/graph_stream_manager.cpp @@ -10,8 +10,8 @@ #include <uhdlib/rfnoc/link_stream_manager.hpp> #include <uhdlib/transport/links.hpp> #include <boost/format.hpp> -#include <memory> #include <map> +#include <memory> #include <set> using namespace uhd; diff --git a/host/lib/rfnoc/mb_controller.cpp b/host/lib/rfnoc/mb_controller.cpp index 62ec1f886..356224f83 100644 --- a/host/lib/rfnoc/mb_controller.cpp +++ b/host/lib/rfnoc/mb_controller.cpp @@ -127,12 +127,12 @@ uhd::time_spec_t mb_controller::timekeeper::get_time_last_pps() return time_spec_t::from_ticks(get_ticks_last_pps(), _tick_rate); } -void mb_controller::timekeeper::set_time_now(const uhd::time_spec_t &time) +void mb_controller::timekeeper::set_time_now(const uhd::time_spec_t& time) { set_ticks_now(time.to_ticks(_tick_rate)); } -void mb_controller::timekeeper::set_time_next_pps(const uhd::time_spec_t &time) +void mb_controller::timekeeper::set_time_next_pps(const uhd::time_spec_t& time) { set_ticks_next_pps(time.to_ticks(_tick_rate)); } @@ -146,7 +146,8 @@ void mb_controller::timekeeper::set_tick_rate(const double tick_rate) // The period is the inverse of the tick rate, normalized by nanoseconds, // and represented as Q32 (e.g., period == 1ns means period_ns == 1<<32) - const uint64_t period_ns = static_cast<uint64_t>(1e9 / tick_rate * (uint64_t(1) << 32)); + const uint64_t period_ns = + static_cast<uint64_t>(1e9 / tick_rate * (uint64_t(1) << 32)); set_period(period_ns); } diff --git a/host/lib/rfnoc/mock_block.cpp b/host/lib/rfnoc/mock_block.cpp index 867311097..ee35eae7e 100644 --- a/host/lib/rfnoc/mock_block.cpp +++ b/host/lib/rfnoc/mock_block.cpp @@ -49,4 +49,3 @@ uhd::rfnoc::mock_block_container uhd::rfnoc::get_mock_block(const noc_id_t noc_i // Make block and return return ret_val; } - diff --git a/host/lib/rfnoc/noc_block_base.cpp b/host/lib/rfnoc/noc_block_base.cpp index 8f76ac1d1..98466d8eb 100644 --- a/host/lib/rfnoc/noc_block_base.cpp +++ b/host/lib/rfnoc/noc_block_base.cpp @@ -29,9 +29,9 @@ noc_block_base::noc_block_base(make_args_ptr make_args) , _block_args(make_args->args) , _tree(make_args->tree) { - RFNOC_LOG_TRACE( - "Using timebase clock: `" << _tb_clock_iface->get_name() << "'. Current frequency: " - << (_tb_clock_iface->get_freq() / 1e6) << " MHz"); + RFNOC_LOG_TRACE("Using timebase clock: `" + << _tb_clock_iface->get_name() << "'. Current frequency: " + << (_tb_clock_iface->get_freq() / 1e6) << " MHz"); RFNOC_LOG_TRACE("Using ctrlport clock: `" << _ctrlport_clock_iface->get_name() << "'. Current frequency: " << (_ctrlport_clock_iface->get_freq() / 1e6) << " MHz"); @@ -171,7 +171,7 @@ void noc_block_base::set_tick_rate(const double tick_rate) return; } // Update this node - RFNOC_LOG_TRACE("Setting tb clock freq to " << tick_rate/1e6 << " MHz"); + RFNOC_LOG_TRACE("Setting tb clock freq to " << tick_rate / 1e6 << " MHz"); _tb_clock_iface->set_freq(tick_rate); // Now trigger property propagation if (!_tick_rate_props.empty()) { diff --git a/host/lib/rfnoc/node.cpp b/host/lib/rfnoc/node.cpp index 23d5a340d..ff3df7b76 100644 --- a/host/lib/rfnoc/node.cpp +++ b/host/lib/rfnoc/node.cpp @@ -91,7 +91,7 @@ void node_t::clear_command_time(const size_t instance) void node_t::register_property(property_base_t* prop, resolve_callback_t&& clean_callback) { std::lock_guard<std::mutex> _l(_prop_mutex); - const auto src_type = prop->get_src_info().type; + const auto src_type = prop->get_src_info().type; // If the map is empty for this source type, create an empty vector if (_props.count(src_type) == 0) { @@ -99,9 +99,9 @@ void node_t::register_property(property_base_t* prop, resolve_callback_t&& clean } auto prop_already_registered = [prop](const property_base_t* existing_prop) { - return (prop == existing_prop) || - (prop->get_src_info() == existing_prop->get_src_info() - && prop->get_id() == existing_prop->get_id()); + return (prop == existing_prop) + || (prop->get_src_info() == existing_prop->get_src_info() + && prop->get_id() == existing_prop->get_id()); }; if (!filter_props(prop_already_registered).empty()) { throw uhd::runtime_error(std::string("Attempting to double-register property: ") @@ -168,9 +168,7 @@ void node_t::set_action_forwarding_policy( _action_fwd_policies[action_key] = policy; } -void node_t::post_action( - const res_source_info& edge_info, - action_info::sptr action) +void node_t::post_action(const res_source_info& edge_info, action_info::sptr action) { _post_action_cb(edge_info, action); } @@ -230,7 +228,7 @@ property_base_t* node_t::inject_edge_property( // We need to create a new property and stash it away: new_prop = [&]() -> property_base_t* { auto prop = blueprint->clone(new_src_info); - auto ptr = prop.get(); + auto ptr = prop.get(); _dynamic_props.emplace(std::move(prop)); return ptr; }(); @@ -269,12 +267,11 @@ property_base_t* node_t::inject_edge_property( } if (fwd_policy == forwarding_policy_t::ONE_TO_FAN) { const auto opposite_port_type = res_source_info::invert_edge(port_type); - const size_t num_ports = opposite_port_type == res_source_info::INPUT_EDGE + const size_t num_ports = opposite_port_type == res_source_info::INPUT_EDGE ? get_num_input_ports() : get_num_output_ports(); for (size_t i = 0; i < num_ports; i++) { - auto opposite_prop = - inject_edge_property(new_prop, {opposite_port_type, i}); + auto opposite_prop = inject_edge_property(new_prop, {opposite_port_type, i}); // Now add a resolver that will always forward the value from this // property to the other one. add_property_resolver( @@ -302,9 +299,8 @@ property_base_t* node_t::inject_edge_property( if (other_port_idx == port_idx) { continue; } - auto prop = - _find_property({res_source_info::INPUT_EDGE, other_port_idx}, - new_prop->get_id()); + auto prop = _find_property( + {res_source_info::INPUT_EDGE, other_port_idx}, new_prop->get_id()); if (prop) { prop_accessor_t{}.forward<false>(new_prop, prop); } @@ -319,7 +315,8 @@ property_base_t* node_t::inject_edge_property( if (port_type == res_source_info::OUTPUT_EDGE && other_port_idx == port_idx) { continue; } - inject_edge_property(new_prop, {res_source_info::OUTPUT_EDGE, other_port_idx}); + inject_edge_property( + new_prop, {res_source_info::OUTPUT_EDGE, other_port_idx}); } // Now add a dynamic resolver that will update all input properties. // In order to keep this code simple, we bypass the write list and @@ -330,9 +327,8 @@ property_base_t* node_t::inject_edge_property( if (other_port_idx == port_idx) { continue; } - auto prop = - _find_property({res_source_info::OUTPUT_EDGE, other_port_idx}, - new_prop->get_id()); + auto prop = _find_property( + {res_source_info::OUTPUT_EDGE, other_port_idx}, new_prop->get_id()); if (prop) { prop_accessor_t{}.forward<false>(new_prop, prop); } @@ -365,7 +361,8 @@ void node_t::init_props() << "Failed to initialize node. Most likely cause: Inconsistent default " "values. Resolver threw this error: " << ex.what(); - //throw uhd::runtime_error(std::string("Failed to initialize node ") + get_unique_id()); + // throw uhd::runtime_error(std::string("Failed to initialize node ") + + // get_unique_id()); } // 3) Set outputs back to RO @@ -482,12 +479,12 @@ void node_t::forward_edge_property( // Set of local properties that match incoming_prop. It can be an empty set, // or, if the node is misconfigured, a set with more than one entry. Or, if // all is as expected, it's a set with a single entry. - auto local_prop_set = filter_props([prop_src_type, incoming_prop, incoming_port]( - property_base_t* prop) -> bool { - return prop->get_src_info().type == prop_src_type - && prop->get_src_info().instance == incoming_port - && prop->get_id() == incoming_prop->get_id(); - }); + auto local_prop_set = filter_props( + [prop_src_type, incoming_prop, incoming_port](property_base_t* prop) -> bool { + return prop->get_src_info().type == prop_src_type + && prop->get_src_info().instance == incoming_port + && prop->get_id() == incoming_prop->get_id(); + }); // If there is no such property, we're forwarding a new property if (local_prop_set.empty()) { @@ -530,8 +527,7 @@ void node_t::receive_action(const res_source_info& src_info, action_info::sptr a // Now implement custom forwarding for all forwarding policies: if (fwd_policy == forwarding_policy_t::DROP) { - UHD_LOG_TRACE( - get_unique_id(), "Dropping action " << action->key); + UHD_LOG_TRACE(get_unique_id(), "Dropping action " << action->key); } if (fwd_policy == forwarding_policy_t::ONE_TO_ONE) { UHD_LOG_TRACE( @@ -589,4 +585,3 @@ bool node_t::_has_port(const res_source_info& port_info) const || (port_info.type == res_source_info::OUTPUT_EDGE && port_info.instance <= get_num_output_ports()); } - diff --git a/host/lib/rfnoc/null_block_control.cpp b/host/lib/rfnoc/null_block_control.cpp index 443c2f3d7..8a5ab56a5 100644 --- a/host/lib/rfnoc/null_block_control.cpp +++ b/host/lib/rfnoc/null_block_control.cpp @@ -4,9 +4,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later // +#include <uhd/rfnoc/defaults.hpp> #include <uhd/rfnoc/null_block_control.hpp> #include <uhd/rfnoc/registry.hpp> -#include <uhd/rfnoc/defaults.hpp> #include <atomic> namespace { @@ -41,9 +41,9 @@ public: RFNOC_BLOCK_CONSTRUCTOR(null_block_control) { uint32_t initial_state = regs().peek32(REG_CTRL_STATUS); - _streaming = initial_state & 0x2; - _nipc = (initial_state >> 24) & 0xFF; - _item_width = (initial_state >> 16) & 0xFF; + _streaming = initial_state & 0x2; + _nipc = (initial_state >> 24) & 0xFF; + _item_width = (initial_state >> 16) & 0xFF; reset_counters(); register_issue_stream_cmd(); } @@ -121,17 +121,17 @@ public: return regs().peek32(REG_SRC_THROTTLE_CYC); } - uint64_t get_count( - const port_type_t port_type, const count_type_t count_type) + uint64_t get_count(const port_type_t port_type, const count_type_t count_type) { - const uint32_t count_addr_lo = [&](){ + const uint32_t count_addr_lo = [&]() { switch (port_type) { case SOURCE: return count_type == LINES ? REG_SRC_LINE_CNT_LO : REG_SRC_PKT_CNT_LO; case SINK: return count_type == LINES ? REG_SNK_LINE_CNT_LO : REG_SNK_PKT_CNT_LO; case LOOP: - return count_type == LINES ? REG_LOOP_LINE_CNT_LO : REG_LOOP_PKT_CNT_LO; + return count_type == LINES ? REG_LOOP_LINE_CNT_LO + : REG_LOOP_PKT_CNT_LO; default: UHD_THROW_INVALID_CODE_PATH(); } @@ -140,7 +140,6 @@ public: } private: - /*! Action API: Register a handler for stream commands */ void register_issue_stream_cmd() diff --git a/host/lib/rfnoc/radio_control_impl.cpp b/host/lib/rfnoc/radio_control_impl.cpp index ea67d891e..faa6a01a6 100644 --- a/host/lib/rfnoc/radio_control_impl.cpp +++ b/host/lib/rfnoc/radio_control_impl.cpp @@ -5,8 +5,8 @@ // #include <uhd/exception.hpp> -#include <uhd/utils/log.hpp> #include <uhd/rfnoc/mb_controller.hpp> +#include <uhd/utils/log.hpp> #include <uhdlib/rfnoc/radio_control_impl.hpp> #include <uhdlib/utils/compat_check.hpp> #include <map> @@ -26,7 +26,7 @@ const std::string DEFAULT_GAIN_PROFILE("default"); } // namespace -const std::string radio_control::ALL_LOS = "all"; +const std::string radio_control::ALL_LOS = "all"; const std::string radio_control::ALL_GAINS = ""; const size_t radio_control::ALL_CHANS = size_t(~0); @@ -125,8 +125,8 @@ radio_control_impl::radio_control_impl(make_args_ptr make_args) uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); stream_cmd_action->stream_cmd.stream_now = false; stream_cmd_action->stream_cmd.time_spec = - get_mb_controller()->get_timekeeper(0)->get_time_now() + - uhd::time_spec_t(OVERRUN_RESTART_DELAY); + get_mb_controller()->get_timekeeper(0)->get_time_now() + + uhd::time_spec_t(OVERRUN_RESTART_DELAY); const size_t port = src.instance; if (port > get_num_output_ports()) { RFNOC_LOG_WARNING("Received stream command to invalid output port!"); @@ -141,8 +141,8 @@ radio_control_impl::radio_control_impl(make_args_ptr make_args) _type_in.reserve(get_num_input_ports()); _type_out.reserve(get_num_output_ports()); for (size_t chan = 0; chan < get_num_output_ports(); ++chan) { - _spp_prop.push_back(property_t<int>( - PROP_KEY_SPP, DEFAULT_SPP, {res_source_info::USER, chan})); + _spp_prop.push_back( + property_t<int>(PROP_KEY_SPP, DEFAULT_SPP, {res_source_info::USER, chan})); _samp_rate_in.push_back(property_t<double>( PROP_KEY_SAMP_RATE, get_tick_rate(), {res_source_info::INPUT_EDGE, chan})); _samp_rate_out.push_back(property_t<double>( @@ -196,7 +196,8 @@ radio_control_impl::radio_control_impl(make_args_ptr make_args) // At run time, it will use the implementation by the child class. add_property_resolver({&_samp_rate_in.back(), &_samp_rate_out.back()}, {&_samp_rate_in.back(), &_samp_rate_out.back()}, - [this, chan, + [this, + chan, &samp_rate_in = _samp_rate_in.at(chan), &samp_rate_out = _samp_rate_out.at(chan)]() { RFNOC_LOG_TRACE("Calling resolver for samp_rate@" << chan); @@ -358,7 +359,8 @@ uhd::gain_range_t radio_control_impl::get_rx_gain_range(const size_t chan) const return result; } -uhd::gain_range_t radio_control_impl::get_rx_gain_range(const std::string& name, const size_t chan) const +uhd::gain_range_t radio_control_impl::get_rx_gain_range( + const std::string& name, const size_t chan) const { if (name != ALL_GAINS) { throw uhd::value_error( @@ -374,7 +376,8 @@ double radio_control_impl::set_tx_gain(const double gain, const size_t chan) return gain; } -double radio_control_impl::set_tx_gain(const double gain, const std::string& name, const size_t chan) +double radio_control_impl::set_tx_gain( + const double gain, const std::string& name, const size_t chan) { if (name != ALL_GAINS) { throw uhd::key_error( @@ -390,7 +393,8 @@ double radio_control_impl::set_rx_gain(const double gain, const size_t chan) return gain; } -double radio_control_impl::set_rx_gain(const double gain, const std::string& name, const size_t chan) +double radio_control_impl::set_rx_gain( + const double gain, const std::string& name, const size_t chan) { if (name != ALL_GAINS) { throw uhd::key_error( @@ -525,7 +529,8 @@ double radio_control_impl::get_rx_gain(const size_t chan) double radio_control_impl::get_tx_gain(const std::string& name, const size_t chan) { if (name != ALL_GAINS) { - throw uhd::value_error(std::string("get_tx_gain(): Unknown gain name `") + name + "'"); + throw uhd::value_error( + std::string("get_tx_gain(): Unknown gain name `") + name + "'"); } return get_tx_gain(chan); } @@ -533,7 +538,8 @@ double radio_control_impl::get_tx_gain(const std::string& name, const size_t cha double radio_control_impl::get_rx_gain(const std::string& name, const size_t chan) { if (name != ALL_GAINS) { - throw uhd::value_error(std::string("get_rx_gain(): Unknown gain name `") + name + "'"); + throw uhd::value_error( + std::string("get_rx_gain(): Unknown gain name `") + name + "'"); } return get_rx_gain(chan); } @@ -624,12 +630,14 @@ std::vector<std::string> radio_control_impl::get_tx_lo_names(const size_t) const return {}; } -std::vector<std::string> radio_control_impl::get_tx_lo_sources(const std::string&, const size_t) +std::vector<std::string> radio_control_impl::get_tx_lo_sources( + const std::string&, const size_t) { return {"internal"}; } -uhd::freq_range_t radio_control_impl::get_tx_lo_freq_range(const std::string&, const size_t) +uhd::freq_range_t radio_control_impl::get_tx_lo_freq_range( + const std::string&, const size_t) { return uhd::freq_range_t(); } @@ -905,7 +913,7 @@ void radio_control_impl::async_message_handler( // BASE == 0x0000 for RX, 0x1000 for TX const uint32_t addr_base = (addr >= regmap::SWREG_RX_ERR) ? regmap::SWREG_RX_ERR : regmap::SWREG_TX_ERR; - const uint32_t chan = (addr - addr_base) / regmap::SWREG_CHAN_OFFSET; + const uint32_t chan = (addr - addr_base) / regmap::SWREG_CHAN_OFFSET; // Note: addr_offset is always going to be zero for now, because we only // have one "register" that gets hit for either RX or TX, but we'll keep it // in case we add other regs in the future diff --git a/host/lib/rfnoc/registry_factory.cpp b/host/lib/rfnoc/registry_factory.cpp index b251410bf..debe59133 100644 --- a/host/lib/rfnoc/registry_factory.cpp +++ b/host/lib/rfnoc/registry_factory.cpp @@ -58,10 +58,10 @@ void registry::register_block_direct(noc_id_t noc_id, { block_device_pair_t key{noc_id, device_id}; if (get_direct_block_registry().count(key)) { - std::cerr - << "[REGISTRY] WARNING: Attempting to overwrite previously " - "registered RFNoC block with noc_id,device_id: " << std::hex - << "0x" << noc_id << ", 0x" << device_id <<std::dec << std::endl; + std::cerr << "[REGISTRY] WARNING: Attempting to overwrite previously " + "registered RFNoC block with noc_id,device_id: " + << std::hex << "0x" << noc_id << ", 0x" << device_id << std::dec + << std::endl; return; } get_direct_block_registry().emplace(key, @@ -76,10 +76,9 @@ void registry::register_block_descriptor( const std::string& block_key, factory_t factory_fn) { if (get_descriptor_block_registry().count(block_key)) { - std::cerr - << "[REGISTRY] WARNING: Attempting to overwrite previously " - "registered RFNoC block with block key" - << block_key << std::endl; + std::cerr << "[REGISTRY] WARNING: Attempting to overwrite previously " + "registered RFNoC block with block key" + << block_key << std::endl; return; } get_descriptor_block_registry().emplace(block_key, std::move(factory_fn)); @@ -107,4 +106,3 @@ block_factory_info_t factory::get_block_factory(noc_id_t noc_id, device_type_t d } return get_direct_block_registry().at(key); } - diff --git a/host/lib/rfnoc/rfnoc_graph.cpp b/host/lib/rfnoc/rfnoc_graph.cpp index 9cb9edfe8..f5a462bad 100644 --- a/host/lib/rfnoc/rfnoc_graph.cpp +++ b/host/lib/rfnoc/rfnoc_graph.cpp @@ -35,7 +35,7 @@ struct block_xbar_info noc_id_t noc_id; size_t inst_num; }; -} +} // namespace class rfnoc_graph_impl : public rfnoc_graph { @@ -43,8 +43,9 @@ public: /************************************************************************** * Structors *************************************************************************/ - rfnoc_graph_impl(detail::rfnoc_device::sptr dev, const uhd::device_addr_t& dev_addr) - try : _device(dev), + rfnoc_graph_impl( + detail::rfnoc_device::sptr dev, const uhd::device_addr_t& dev_addr) try + : _device(dev), _tree(_device->get_tree()), _num_mboards(_tree->list("/mboards").size()), _block_registry(std::make_unique<detail::block_container_t>()), @@ -492,7 +493,7 @@ private: + std::to_string(chdr_w_to_bits(chdr_w)) + " but device " + std::to_string(mb_idx) + " has CHDR width of " + std::to_string( - chdr_w_to_bits(_device->get_mb_iface(mb_idx).get_chdr_w())) + chdr_w_to_bits(_device->get_mb_iface(mb_idx).get_chdr_w())) + " bits!"); } if (_device->get_mb_iface(mb_idx).get_endianness() != endianness) { diff --git a/host/lib/rfnoc/rfnoc_rx_streamer.cpp b/host/lib/rfnoc/rfnoc_rx_streamer.cpp index d6778267f..081682a94 100644 --- a/host/lib/rfnoc/rfnoc_rx_streamer.cpp +++ b/host/lib/rfnoc/rfnoc_rx_streamer.cpp @@ -68,11 +68,13 @@ rfnoc_rx_streamer::rfnoc_rx_streamer( mtu_resolver_out.insert(&mtu_prop); } - add_property_resolver({&_mtu_in[i]}, std::move(mtu_resolver_out), - [&mtu_in = _mtu_in[i], i, this]() { + add_property_resolver({&_mtu_in[i]}, + std::move(mtu_resolver_out), + [& mtu_in = _mtu_in[i], i, this]() { RFNOC_LOG_TRACE("Calling resolver for `mtu_in'@" << i); if (mtu_in.is_valid()) { - const size_t mtu = std::min(mtu_in.get(), rx_streamer_impl::get_mtu()); + const size_t mtu = + std::min(mtu_in.get(), rx_streamer_impl::get_mtu()); // Set the same MTU value for all chans for (auto& prop : this->_mtu_in) { prop.set(mtu); @@ -112,7 +114,7 @@ void rfnoc_rx_streamer::issue_stream_cmd(const stream_cmd_t& stream_cmd) "single streamer will fail to time align."); } - auto cmd = stream_cmd_action_info::make(stream_cmd.stream_mode); + auto cmd = stream_cmd_action_info::make(stream_cmd.stream_mode); cmd->stream_cmd = stream_cmd; for (size_t i = 0; i < get_num_channels(); i++) { @@ -126,8 +128,7 @@ const uhd::stream_args_t& rfnoc_rx_streamer::get_stream_args() const return _stream_args; } -bool rfnoc_rx_streamer::check_topology( - const std::vector<size_t>& connected_inputs, +bool rfnoc_rx_streamer::check_topology(const std::vector<size_t>& connected_inputs, const std::vector<size_t>& connected_outputs) { // Check that all channels are connected @@ -160,27 +161,26 @@ void rfnoc_rx_streamer::connect_channel( rx_streamer_impl<chdr_rx_data_xport>::connect_channel(channel, std::move(xport)); } -void rfnoc_rx_streamer::_register_props(const size_t chan, - const std::string& otw_format) +void rfnoc_rx_streamer::_register_props(const size_t chan, const std::string& otw_format) { // Create actual properties and store them - _scaling_in.push_back(property_t<double>( - PROP_KEY_SCALING, {res_source_info::INPUT_EDGE, chan})); + _scaling_in.push_back( + property_t<double>(PROP_KEY_SCALING, {res_source_info::INPUT_EDGE, chan})); _samp_rate_in.push_back( property_t<double>(PROP_KEY_SAMP_RATE, {res_source_info::INPUT_EDGE, chan})); - _tick_rate_in.push_back(property_t<double>( - PROP_KEY_TICK_RATE, {res_source_info::INPUT_EDGE, chan})); + _tick_rate_in.push_back( + property_t<double>(PROP_KEY_TICK_RATE, {res_source_info::INPUT_EDGE, chan})); _type_in.emplace_back(property_t<std::string>( PROP_KEY_TYPE, otw_format, {res_source_info::INPUT_EDGE, chan})); - _mtu_in.emplace_back(property_t<size_t>( - PROP_KEY_MTU, get_mtu(), {res_source_info::INPUT_EDGE, chan})); + _mtu_in.emplace_back( + property_t<size_t>(PROP_KEY_MTU, get_mtu(), {res_source_info::INPUT_EDGE, chan})); // Give us some shorthands for the rest of this function property_t<double>* scaling_in = &_scaling_in.back(); property_t<double>* samp_rate_in = &_samp_rate_in.back(); property_t<double>* tick_rate_in = &_tick_rate_in.back(); property_t<std::string>* type_in = &_type_in.back(); - property_t<size_t>* mtu_in = &_mtu_in.back(); + property_t<size_t>* mtu_in = &_mtu_in.back(); // Register them register_property(scaling_in); @@ -190,24 +190,23 @@ void rfnoc_rx_streamer::_register_props(const size_t chan, register_property(mtu_in); // Add resolvers - add_property_resolver({scaling_in}, {}, - [&scaling_in = *scaling_in, chan, this]() { - RFNOC_LOG_TRACE("Calling resolver for `scaling_in'@" << chan); - if (scaling_in.is_valid()) { - this->set_scale_factor(chan, scaling_in.get() / 32767.0); - } - }); + add_property_resolver({scaling_in}, {}, [& scaling_in = *scaling_in, chan, this]() { + RFNOC_LOG_TRACE("Calling resolver for `scaling_in'@" << chan); + if (scaling_in.is_valid()) { + this->set_scale_factor(chan, scaling_in.get() / 32767.0); + } + }); - add_property_resolver({samp_rate_in}, {}, - [&samp_rate_in = *samp_rate_in, chan, this]() { + add_property_resolver( + {samp_rate_in}, {}, [& samp_rate_in = *samp_rate_in, chan, this]() { RFNOC_LOG_TRACE("Calling resolver for `samp_rate_in'@" << chan); if (samp_rate_in.is_valid()) { this->set_samp_rate(samp_rate_in.get()); } }); - add_property_resolver({tick_rate_in}, {}, - [&tick_rate_in = *tick_rate_in, chan, this]() { + add_property_resolver( + {tick_rate_in}, {}, [& tick_rate_in = *tick_rate_in, chan, this]() { RFNOC_LOG_TRACE("Calling resolver for `tick_rate_in'@" << chan); if (tick_rate_in.is_valid()) { this->set_tick_rate(tick_rate_in.get()); diff --git a/host/lib/rfnoc/rfnoc_tx_streamer.cpp b/host/lib/rfnoc/rfnoc_tx_streamer.cpp index d4aa267af..9b511818e 100644 --- a/host/lib/rfnoc/rfnoc_tx_streamer.cpp +++ b/host/lib/rfnoc/rfnoc_tx_streamer.cpp @@ -16,8 +16,8 @@ const std::string STREAMER_ID = "TxStreamer"; static std::atomic<uint64_t> streamer_inst_ctr; static constexpr size_t ASYNC_MSG_QUEUE_SIZE = 1000; -rfnoc_tx_streamer::rfnoc_tx_streamer(const size_t num_chans, - const uhd::stream_args_t stream_args) +rfnoc_tx_streamer::rfnoc_tx_streamer( + const size_t num_chans, const uhd::stream_args_t stream_args) : tx_streamer_impl<chdr_tx_data_xport>(num_chans, stream_args) , _unique_id(STREAMER_ID + "#" + std::to_string(streamer_inst_ctr++)) , _stream_args(stream_args) @@ -56,11 +56,13 @@ rfnoc_tx_streamer::rfnoc_tx_streamer(const size_t num_chans, mtu_resolver_out.insert(&mtu_prop); } - add_property_resolver({&_mtu_out[i]}, std::move(mtu_resolver_out), - [&mtu_out = _mtu_out[i], i, this]() { + add_property_resolver({&_mtu_out[i]}, + std::move(mtu_resolver_out), + [& mtu_out = _mtu_out[i], i, this]() { RFNOC_LOG_TRACE("Calling resolver for `mtu_out'@" << i); if (mtu_out.is_valid()) { - const size_t mtu = std::min(mtu_out.get(), tx_streamer_impl::get_mtu()); + const size_t mtu = + std::min(mtu_out.get(), tx_streamer_impl::get_mtu()); // Set the same MTU value for all chans for (auto& prop : this->_mtu_out) { prop.set(mtu); @@ -96,8 +98,7 @@ const uhd::stream_args_t& rfnoc_tx_streamer::get_stream_args() const return _stream_args; } -bool rfnoc_tx_streamer::check_topology( - const std::vector<size_t>& connected_inputs, +bool rfnoc_tx_streamer::check_topology(const std::vector<size_t>& connected_inputs, const std::vector<size_t>& connected_outputs) { // Check that all channels are connected @@ -119,7 +120,8 @@ void rfnoc_tx_streamer::connect_channel( set_property<size_t>(PROP_KEY_MTU, mtu, {res_source_info::OUTPUT_EDGE, channel}); xport->set_enqueue_async_msg_fn( - [this, channel](async_metadata_t::event_code_t event_code, bool has_tsf, uint64_t tsf) { + [this, channel]( + async_metadata_t::event_code_t event_code, bool has_tsf, uint64_t tsf) { async_metadata_t md; md.channel = channel; md.event_code = event_code; @@ -135,23 +137,22 @@ void rfnoc_tx_streamer::connect_channel( tx_streamer_impl<chdr_tx_data_xport>::connect_channel(channel, std::move(xport)); } -bool rfnoc_tx_streamer::recv_async_msg(uhd::async_metadata_t& async_metadata, - double timeout) +bool rfnoc_tx_streamer::recv_async_msg( + uhd::async_metadata_t& async_metadata, double timeout) { const auto timeout_ms = static_cast<uint64_t>(timeout * 1000); return _async_msg_queue->recv_async_msg(async_metadata, timeout_ms); } -void rfnoc_tx_streamer::_register_props(const size_t chan, - const std::string& otw_format) +void rfnoc_tx_streamer::_register_props(const size_t chan, const std::string& otw_format) { // Create actual properties and store them - _scaling_out.push_back(property_t<double>( - PROP_KEY_SCALING, {res_source_info::OUTPUT_EDGE, chan})); - _samp_rate_out.push_back(property_t<double>( - PROP_KEY_SAMP_RATE, {res_source_info::OUTPUT_EDGE, chan})); - _tick_rate_out.push_back(property_t<double>( - PROP_KEY_TICK_RATE, {res_source_info::OUTPUT_EDGE, chan})); + _scaling_out.push_back( + property_t<double>(PROP_KEY_SCALING, {res_source_info::OUTPUT_EDGE, chan})); + _samp_rate_out.push_back( + property_t<double>(PROP_KEY_SAMP_RATE, {res_source_info::OUTPUT_EDGE, chan})); + _tick_rate_out.push_back( + property_t<double>(PROP_KEY_TICK_RATE, {res_source_info::OUTPUT_EDGE, chan})); _type_out.emplace_back(property_t<std::string>( PROP_KEY_TYPE, otw_format, {res_source_info::OUTPUT_EDGE, chan})); _mtu_out.push_back(property_t<size_t>( diff --git a/host/lib/rfnoc/tx_async_msg_queue.cpp b/host/lib/rfnoc/tx_async_msg_queue.cpp index 71a05074f..52c268dc9 100644 --- a/host/lib/rfnoc/tx_async_msg_queue.cpp +++ b/host/lib/rfnoc/tx_async_msg_queue.cpp @@ -11,13 +11,10 @@ using namespace uhd; using namespace uhd::rfnoc; -tx_async_msg_queue::tx_async_msg_queue(size_t capacity) - : _queue(capacity) -{ -} +tx_async_msg_queue::tx_async_msg_queue(size_t capacity) : _queue(capacity) {} -bool tx_async_msg_queue::recv_async_msg(uhd::async_metadata_t& async_metadata, - int32_t timeout_ms) +bool tx_async_msg_queue::recv_async_msg( + uhd::async_metadata_t& async_metadata, int32_t timeout_ms) { using namespace std::chrono; |