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/usrp/b200/b200_uart.cpp | |
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/usrp/b200/b200_uart.cpp')
-rw-r--r-- | host/lib/usrp/b200/b200_uart.cpp | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/host/lib/usrp/b200/b200_uart.cpp b/host/lib/usrp/b200/b200_uart.cpp index 8c8e2462a..b78690705 100644 --- a/host/lib/usrp/b200/b200_uart.cpp +++ b/host/lib/usrp/b200/b200_uart.cpp @@ -7,24 +7,24 @@ #include "b200_uart.hpp" #include "b200_impl.hpp" +#include <uhd/exception.hpp> #include <uhd/transport/bounded_buffer.hpp> #include <uhd/transport/vrt_if_packet.hpp> +#include <uhd/types/time_spec.hpp> #include <uhd/utils/byteswap.hpp> #include <uhd/utils/log.hpp> -#include <uhd/types/time_spec.hpp> -#include <uhd/exception.hpp> using namespace uhd; using namespace uhd::transport; struct b200_uart_impl : b200_uart { - b200_uart_impl(zero_copy_if::sptr xport, const uint32_t sid): - _xport(xport), - _sid(sid), - _count(0), - _baud_div(std::floor(B200_BUS_CLOCK_RATE/115200 + 0.5)), - _line_queue(4096) + b200_uart_impl(zero_copy_if::sptr xport, const uint32_t sid) + : _xport(xport) + , _sid(sid) + , _count(0) + , _baud_div(std::floor(B200_BUS_CLOCK_RATE / 115200 + 0.5)) + , _line_queue(4096) { /*NOP*/ } @@ -35,31 +35,31 @@ struct b200_uart_impl : b200_uart UHD_ASSERT_THROW(bool(buff)); vrt::if_packet_info_t packet_info; - packet_info.link_type = vrt::if_packet_info_t::LINK_TYPE_CHDR; - packet_info.packet_type = vrt::if_packet_info_t::PACKET_TYPE_CONTEXT; + packet_info.link_type = vrt::if_packet_info_t::LINK_TYPE_CHDR; + packet_info.packet_type = vrt::if_packet_info_t::PACKET_TYPE_CONTEXT; packet_info.num_payload_words32 = 2; - packet_info.num_payload_bytes = packet_info.num_payload_words32*sizeof(uint32_t); + packet_info.num_payload_bytes = + packet_info.num_payload_words32 * sizeof(uint32_t); packet_info.packet_count = _count++; - packet_info.sob = false; - packet_info.eob = false; - packet_info.sid = _sid; - packet_info.has_sid = true; - packet_info.has_cid = false; - packet_info.has_tsi = false; - packet_info.has_tsf = false; - packet_info.has_tlr = false; + packet_info.sob = false; + packet_info.eob = false; + packet_info.sid = _sid; + packet_info.has_sid = true; + packet_info.has_cid = false; + packet_info.has_tsi = false; + packet_info.has_tsf = false; + packet_info.has_tlr = false; - uint32_t *packet_buff = buff->cast<uint32_t *>(); + uint32_t* packet_buff = buff->cast<uint32_t*>(); vrt::if_hdr_pack_le(packet_buff, packet_info); - packet_buff[packet_info.num_header_words32+0] = uhd::htowx(uint32_t(_baud_div)); - packet_buff[packet_info.num_header_words32+1] = uhd::htowx(uint32_t(ch)); - buff->commit(packet_info.num_packet_words32*sizeof(uint32_t)); + packet_buff[packet_info.num_header_words32 + 0] = uhd::htowx(uint32_t(_baud_div)); + packet_buff[packet_info.num_header_words32 + 1] = uhd::htowx(uint32_t(ch)); + buff->commit(packet_info.num_packet_words32 * sizeof(uint32_t)); } - void write_uart(const std::string &buff) + void write_uart(const std::string& buff) { - for(const char ch: buff) - { + for (const char ch : buff) { this->send_char(ch); } } @@ -73,15 +73,14 @@ struct b200_uart_impl : b200_uart void handle_uart_packet(managed_recv_buffer::sptr buff) { - const uint32_t *packet_buff = buff->cast<const uint32_t *>(); + const uint32_t* packet_buff = buff->cast<const uint32_t*>(); vrt::if_packet_info_t packet_info; - packet_info.link_type = vrt::if_packet_info_t::LINK_TYPE_CHDR; - packet_info.num_packet_words32 = buff->size()/sizeof(uint32_t); + packet_info.link_type = vrt::if_packet_info_t::LINK_TYPE_CHDR; + packet_info.num_packet_words32 = buff->size() / sizeof(uint32_t); vrt::if_hdr_unpack_le(packet_buff, packet_info); - const char ch = char(uhd::wtohx(packet_buff[packet_info.num_header_words32+1])); + const char ch = char(uhd::wtohx(packet_buff[packet_info.num_header_words32 + 1])); _line += ch; - if (ch == '\n') - { + if (ch == '\n') { _line_queue.push_with_pop_on_full(_line); _line.clear(); } |