diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-01-08 09:33:36 +0100 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-03-04 08:07:26 -0600 |
commit | 107a49c0c236940da7d3bd0f57da4bc1e2a34cb4 (patch) | |
tree | fdeaad56030a02948377c45838dab97beb7a5c84 /host/lib/usrp/usrp2 | |
parent | 7d5e48032baa62cbe7467833b9e057900602f4b9 (diff) | |
download | uhd-107a49c0c236940da7d3bd0f57da4bc1e2a34cb4.tar.gz uhd-107a49c0c236940da7d3bd0f57da4bc1e2a34cb4.tar.bz2 uhd-107a49c0c236940da7d3bd0f57da4bc1e2a34cb4.zip |
host: Update code base using clang-tidy
The checks from the new clang-tidy file are applied to the source tree
using:
$ find . -name "*.cpp" | sort -u | xargs \
--max-procs 8 --max-args 1 clang-tidy --format-style=file \
--fix -p /path/to/compile_commands.json
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r-- | host/lib/usrp/usrp2/n200_image_loader.cpp | 20 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 36 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.hpp | 8 |
4 files changed, 41 insertions, 41 deletions
diff --git a/host/lib/usrp/usrp2/n200_image_loader.cpp b/host/lib/usrp/usrp2/n200_image_loader.cpp index 55b441c8b..9080a6dee 100644 --- a/host/lib/usrp/usrp2/n200_image_loader.cpp +++ b/host/lib/usrp/usrp2/n200_image_loader.cpp @@ -154,15 +154,15 @@ static void print_usrp2_error(const image_loader::image_loader_args_t& image_loa if (image_loader_args.load_firmware) { usrp2_card_burner_gui += str(boost::format("%s--fw=\"%s\"") % nl - % ((image_loader_args.firmware_path == "") - ? find_image_path("usrp2_fw.bin") - : image_loader_args.firmware_path)); + % ((image_loader_args.firmware_path.empty()) + ? find_image_path("usrp2_fw.bin") + : image_loader_args.firmware_path)); } if (image_loader_args.load_fpga) { - usrp2_card_burner_gui += - str(boost::format("%s--fpga=\"%s\"") % nl - % ((image_loader_args.fpga_path == "") ? find_image_path("usrp2_fpga.bin") - : image_loader_args.fpga_path)); + usrp2_card_burner_gui += str( + boost::format("%s--fpga=\"%s\"") % nl + % ((image_loader_args.fpga_path.empty()) ? find_image_path("usrp2_fpga.bin") + : image_loader_args.fpga_path)); } throw uhd::runtime_error(str( @@ -204,7 +204,7 @@ static uhd::device_addr_t n200_find( uhd::device_addrs_t found = usrp2_find(image_loader_args.args); - if (found.size() > 0) { + if (!found.empty()) { uhd::device_addrs_t n200_found; udp_simple::sptr rev_xport; n200_fw_update_data_t pkt_out; @@ -355,8 +355,8 @@ static void n200_setup_session(n200_session_t& session, * EEPROM or is otherwise unable to provide its revision, this is * impossible, and the user must manually provide a firmware file. */ - if ((session.fw and image_loader_args.firmware_path == "") - or image_loader_args.fpga_path == "") { + if ((session.fw and image_loader_args.firmware_path.empty()) + or image_loader_args.fpga_path.empty()) { if (session.dev_addr["hw_rev"] == "n2xx") { throw uhd::runtime_error("This device's revision cannot be determined. " "You must manually specify a filepath."); diff --git a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp index ca3a79ca5..116051216 100644 --- a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp +++ b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp @@ -45,7 +45,7 @@ public: this->init_spi(); } - ~usrp2_fifo_ctrl_impl(void) + ~usrp2_fifo_ctrl_impl(void) override { _timeout = ACK_TIMEOUT; // reset timeout to something small UHD_SAFE_CALL( @@ -56,7 +56,7 @@ public: /******************************************************************* * Peek and poke 32 bit implementation ******************************************************************/ - void poke32(const wb_addr_type addr, const uint32_t data) + void poke32(const wb_addr_type addr, const uint32_t data) override { boost::mutex::scoped_lock lock(_mutex); @@ -65,7 +65,7 @@ public: this->wait_for_ack(_seq_out - MAX_SEQS_OUT); } - uint32_t peek32(const wb_addr_type addr) + uint32_t peek32(const wb_addr_type addr) override { boost::mutex::scoped_lock lock(_mutex); @@ -77,12 +77,12 @@ public: /******************************************************************* * Peek and poke 16 bit not implemented ******************************************************************/ - void poke16(const wb_addr_type, const uint16_t) + void poke16(const wb_addr_type, const uint16_t) override { throw uhd::not_implemented_error("poke16 not implemented in fifo ctrl module"); } - uint16_t peek16(const wb_addr_type) + uint16_t peek16(const wb_addr_type) override { throw uhd::not_implemented_error("peek16 not implemented in fifo ctrl module"); } @@ -104,7 +104,7 @@ public: const spi_config_t& config, uint32_t data, size_t num_bits, - bool readback) + bool readback) override { boost::mutex::scoped_lock lock(_mutex); @@ -143,7 +143,7 @@ public: /******************************************************************* * Update methods for time ******************************************************************/ - void set_time(const uhd::time_spec_t& time) + void set_time(const uhd::time_spec_t& time) override { boost::mutex::scoped_lock lock(_mutex); _time = time; @@ -152,13 +152,13 @@ public: _timeout = MASSIVE_TIMEOUT; // permanently sets larger timeout } - uhd::time_spec_t get_time() + uhd::time_spec_t get_time() override { boost::mutex::scoped_lock lock(_mutex); return _time; } - void set_tick_rate(const double rate) + void set_tick_rate(const double rate) override { boost::mutex::scoped_lock lock(_mutex); _tick_rate = rate; diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 029d2b30a..23104d18f 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -76,7 +76,7 @@ public: mb_eeprom = usrp2_impl::get_mb_eeprom(*this); } - ~usrp2_iface_impl(void) + ~usrp2_iface_impl(void) override { UHD_SAFE_CALL(this->lock_device(false);) } @@ -85,7 +85,7 @@ public: * Device locking **********************************************************************/ - void lock_device(bool lock) + void lock_device(bool lock) override { if (lock) { this->pokefw(U2_FW_REG_LOCK_GPID, get_process_hash()); @@ -96,7 +96,7 @@ public: } } - bool is_device_locked(void) + bool is_device_locked(void) override { // never assume lock with fpga image mismatch if ((this->peek32(U2_REG_COMPAT_NUM_RB) >> 16) != USRP2_FPGA_COMPAT_NUM) @@ -135,32 +135,32 @@ public: /*********************************************************************** * Peek and Poke **********************************************************************/ - void poke32(const wb_addr_type addr, const uint32_t data) + void poke32(const wb_addr_type addr, const uint32_t data) override { this->get_reg<uint32_t, USRP2_REG_ACTION_FPGA_POKE32>(addr, data); } - uint32_t peek32(const wb_addr_type addr) + uint32_t peek32(const wb_addr_type addr) override { return this->get_reg<uint32_t, USRP2_REG_ACTION_FPGA_PEEK32>(addr); } - void poke16(const wb_addr_type addr, const uint16_t data) + void poke16(const wb_addr_type addr, const uint16_t data) override { this->get_reg<uint16_t, USRP2_REG_ACTION_FPGA_POKE16>(addr, data); } - uint16_t peek16(const wb_addr_type addr) + uint16_t peek16(const wb_addr_type addr) override { return this->get_reg<uint16_t, USRP2_REG_ACTION_FPGA_PEEK16>(addr); } - void pokefw(wb_addr_type addr, uint32_t data) + void pokefw(wb_addr_type addr, uint32_t data) override { this->get_reg<uint32_t, USRP2_REG_ACTION_FW_POKE32>(addr, data); } - uint32_t peekfw(wb_addr_type addr) + uint32_t peekfw(wb_addr_type addr) override { return this->get_reg<uint32_t, USRP2_REG_ACTION_FW_PEEK32>(addr); } @@ -189,7 +189,7 @@ public: const spi_config_t& config, uint32_t data, size_t num_bits, - bool readback) + bool readback) override { static const uhd::dict<spi_config_t::edge_t, int> spi_edge_to_otw = boost::assign::map_list_of(spi_config_t::EDGE_RISE, USRP2_CLK_EDGE_RISE)( @@ -216,7 +216,7 @@ public: /*********************************************************************** * I2C **********************************************************************/ - void write_i2c(uint16_t addr, const byte_vector_t& buf) + void write_i2c(uint16_t addr, const byte_vector_t& buf) override { // setup the out data usrp2_ctrl_data_t out_data = usrp2_ctrl_data_t(); @@ -236,7 +236,7 @@ public: UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_COOL_IM_DONE_I2C_WRITE_DUDE); } - byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) + byte_vector_t read_i2c(uint16_t addr, size_t num_bytes) override { // setup the out data usrp2_ctrl_data_t out_data = usrp2_ctrl_data_t(); @@ -324,7 +324,7 @@ public: throw timeout_error("no control response, possible packet loss"); } - rev_type get_rev(void) + rev_type get_rev(void) override { std::string hw = mb_eeprom["hardware"]; if (hw.empty()) @@ -347,7 +347,7 @@ public: return USRP_NXXX; // unknown type } - const std::string get_cname(void) + const std::string get_cname(void) override { switch (this->get_rev()) { case USRP2_REV3: @@ -368,14 +368,14 @@ public: UHD_THROW_INVALID_CODE_PATH(); } - const std::string get_fw_version_string(void) + const std::string get_fw_version_string(void) override { uint32_t minor = this->get_reg<uint32_t, USRP2_REG_ACTION_FW_PEEK32>(U2_FW_REG_VER_MINOR); return str(boost::format("%u.%u") % _protocol_compat % minor); } - std::string images_warn_help_message(void) + std::string images_warn_help_message(void) override { // determine the images names std::string fw_image, fpga_image; @@ -457,12 +457,12 @@ public: } } - void set_time(const time_spec_t&) + void set_time(const time_spec_t&) override { throw uhd::not_implemented_error("Timed commands not supported"); } - time_spec_t get_time(void) + time_spec_t get_time(void) override { return (0.0); } diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 792c38a11..14e6ed993 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -61,12 +61,12 @@ class usrp2_impl : public uhd::device { public: usrp2_impl(const uhd::device_addr_t&); - ~usrp2_impl(void); + ~usrp2_impl(void) override; // the io interface - uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args); - uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args); - bool recv_async_msg(uhd::async_metadata_t&, double); + uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t& args) override; + uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t& args) override; + bool recv_async_msg(uhd::async_metadata_t&, double) override; static uhd::usrp::mboard_eeprom_t get_mb_eeprom(usrp2_iface&); |