aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/sink_block_ctrl_base.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-01-16 15:16:05 -0800
committerBrent Stapleton <brent.stapleton@ettus.com>2019-01-17 18:03:42 -0800
commit6bd47c969222ee9e5e89cd00ebea9141c215e55c (patch)
tree3cbddae51f99bef056446ae936fd409aee0add66 /host/lib/rfnoc/sink_block_ctrl_base.cpp
parent18cfd25129d06c456eade78d4e74dc4dceae6501 (diff)
downloaduhd-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/sink_block_ctrl_base.cpp')
-rw-r--r--host/lib/rfnoc/sink_block_ctrl_base.cpp71
1 files changed, 34 insertions, 37 deletions
diff --git a/host/lib/rfnoc/sink_block_ctrl_base.cpp b/host/lib/rfnoc/sink_block_ctrl_base.cpp
index d14fe2f38..bb81706f9 100644
--- a/host/lib/rfnoc/sink_block_ctrl_base.cpp
+++ b/host/lib/rfnoc/sink_block_ctrl_base.cpp
@@ -5,8 +5,8 @@
// SPDX-License-Identifier: GPL-3.0-or-later
//
-#include <uhd/rfnoc/sink_block_ctrl_base.hpp>
#include <uhd/rfnoc/constants.hpp>
+#include <uhd/rfnoc/sink_block_ctrl_base.hpp>
#include <uhd/utils/log.hpp>
#include <uhdlib/rfnoc/utils.hpp>
@@ -20,22 +20,19 @@ using namespace uhd::rfnoc;
stream_sig_t sink_block_ctrl_base::get_input_signature(size_t block_port) const
{
if (not _tree->exists(_root_path / "ports" / "in" / block_port)) {
- throw uhd::runtime_error(str(
- boost::format("Invalid port number %d for block %s")
- % block_port % unique_id()
- ));
+ throw uhd::runtime_error(str(boost::format("Invalid port number %d for block %s")
+ % block_port % unique_id()));
}
return _resolve_port_def(
- _tree->access<blockdef::port_t>(_root_path / "ports" / "in" / block_port).get()
- );
+ _tree->access<blockdef::port_t>(_root_path / "ports" / "in" / block_port).get());
}
std::vector<size_t> sink_block_ctrl_base::get_input_ports() const
{
std::vector<size_t> input_ports;
input_ports.reserve(_tree->list(_root_path / "ports" / "in").size());
- for(const std::string port: _tree->list(_root_path / "ports" / "in")) {
+ for (const std::string port : _tree->list(_root_path / "ports" / "in")) {
input_ports.push_back(boost::lexical_cast<size_t>(port));
}
return input_ports;
@@ -44,57 +41,57 @@ std::vector<size_t> sink_block_ctrl_base::get_input_ports() const
/***********************************************************************
* FPGA Configuration
**********************************************************************/
-size_t sink_block_ctrl_base::get_fifo_size(size_t block_port) const {
- if (_tree->exists(_root_path / "input_buffer_size" / str(boost::format("%d") % block_port))) {
- return _tree->access<size_t>(_root_path / "input_buffer_size" / str(boost::format("%d") % block_port)).get();
+size_t sink_block_ctrl_base::get_fifo_size(size_t block_port) const
+{
+ if (_tree->exists(
+ _root_path / "input_buffer_size" / str(boost::format("%d") % block_port))) {
+ return _tree
+ ->access<size_t>(
+ _root_path / "input_buffer_size" / str(boost::format("%d") % block_port))
+ .get();
}
return 0;
}
void sink_block_ctrl_base::configure_flow_control_in(
- const size_t bytes,
- const size_t block_port
-) {
- UHD_RFNOC_BLOCK_TRACE() << boost::format("sink_block_ctrl_base::configure_flow_control_in(bytes=%d)") % bytes;
+ const size_t bytes, const size_t block_port)
+{
+ UHD_RFNOC_BLOCK_TRACE()
+ << boost::format("sink_block_ctrl_base::configure_flow_control_in(bytes=%d)")
+ % bytes;
uint32_t bytes_word = 0;
if (bytes) {
// Bit 32 enables flow control
- bytes_word = (1<<31) | bytes;
+ bytes_word = (1 << 31) | bytes;
}
sr_write(SR_FLOW_CTRL_BYTES_PER_ACK, bytes_word, block_port);
}
-void sink_block_ctrl_base::set_error_policy(
- const std::string &policy
-) {
- if (policy == "next_packet")
- {
+void sink_block_ctrl_base::set_error_policy(const std::string& policy)
+{
+ if (policy == "next_packet") {
sr_write(SR_ERROR_POLICY, (1 << 2) | 1);
- }
- else if (policy == "next_burst")
- {
+ } else if (policy == "next_burst") {
sr_write(SR_ERROR_POLICY, (1 << 3) | 1);
- }
- else if (policy == "continue")
- {
+ } else if (policy == "continue") {
sr_write(SR_ERROR_POLICY, (1 << 1) | 1);
- }
- else if (policy == "wait")
- {
+ } else if (policy == "wait") {
sr_write(SR_ERROR_POLICY, 1);
- }
- else throw uhd::value_error("Block input cannot handle requested error policy: " + policy);
+ } else
+ throw uhd::value_error(
+ "Block input cannot handle requested error policy: " + policy);
}
/***********************************************************************
* Hooks
**********************************************************************/
size_t sink_block_ctrl_base::_request_input_port(
- const size_t suggested_port,
- const uhd::device_addr_t &
-) const {
- const std::set<size_t> valid_input_ports = utils::str_list_to_set<size_t>(_tree->list(_root_path / "ports" / "in"));
- return utils::node_map_find_first_free(_upstream_nodes, suggested_port, valid_input_ports);
+ const size_t suggested_port, const uhd::device_addr_t&) const
+{
+ const std::set<size_t> valid_input_ports =
+ utils::str_list_to_set<size_t>(_tree->list(_root_path / "ports" / "in"));
+ return utils::node_map_find_first_free(
+ _upstream_nodes, suggested_port, valid_input_ports);
}
// vim: sw=4 et: