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/common | |
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/common')
-rw-r--r-- | host/lib/usrp/common/ad9361_ctrl.cpp | 42 | ||||
-rw-r--r-- | host/lib/usrp/common/ad936x_manager.cpp | 13 | ||||
-rw-r--r-- | host/lib/usrp/common/fx2_ctrl.cpp | 30 | ||||
-rw-r--r-- | host/lib/usrp/common/io_service_mgr.cpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/common/pwr_cal_mgr.cpp | 24 | ||||
-rw-r--r-- | host/lib/usrp/common/recv_packet_demuxer.cpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/common/validate_subdev_spec.cpp | 2 |
7 files changed, 62 insertions, 59 deletions
diff --git a/host/lib/usrp/common/ad9361_ctrl.cpp b/host/lib/usrp/common/ad9361_ctrl.cpp index a584ef0f7..55abd025c 100644 --- a/host/lib/usrp/common/ad9361_ctrl.cpp +++ b/host/lib/usrp/common/ad9361_ctrl.cpp @@ -28,9 +28,9 @@ public: { } - virtual ~ad9361_io_spi() {} + ~ad9361_io_spi() override {} - virtual uint8_t peek8(uint32_t reg) + uint8_t peek8(uint32_t reg) override { std::lock_guard<std::mutex> lock(_mutex); @@ -51,7 +51,7 @@ public: return static_cast<uint8_t>(val); } - virtual void poke8(uint32_t reg, uint8_t val) + void poke8(uint32_t reg, uint8_t val) override { std::lock_guard<std::mutex> lock(_mutex); @@ -93,7 +93,7 @@ public: { _device.initialize(); } - double set_gain(const std::string& which, const double value) + double set_gain(const std::string& which, const double value) override { std::lock_guard<std::mutex> lock(_mutex); @@ -103,7 +103,7 @@ public: return return_val; } - void set_agc(const std::string& which, bool enable) + void set_agc(const std::string& which, bool enable) override { std::lock_guard<std::mutex> lock(_mutex); @@ -111,7 +111,7 @@ public: _device.set_agc(chain, enable); } - void set_agc_mode(const std::string& which, const std::string& mode) + void set_agc_mode(const std::string& which, const std::string& mode) override { std::lock_guard<std::mutex> lock(_mutex); ad9361_device_t::chain_t chain = _get_chain_from_antenna(which); @@ -125,7 +125,7 @@ public: } //! set a new clock rate, return the exact value - double set_clock_rate(const double rate) + double set_clock_rate(const double rate) override { std::lock_guard<std::mutex> lock(_mutex); // clip to known bounds @@ -144,14 +144,14 @@ public: } //! set which RX and TX chains/antennas are active - void set_active_chains(bool tx1, bool tx2, bool rx1, bool rx2) + void set_active_chains(bool tx1, bool tx2, bool rx1, bool rx2) override { std::lock_guard<std::mutex> lock(_mutex); _device.set_active_chains(tx1, tx2, rx1, rx2); } //! set which timing mode to use - 1R1T, 2R2T - void set_timing_mode(const std::string& timing_mode) + void set_timing_mode(const std::string& timing_mode) override { std::lock_guard<std::mutex> lock(_mutex); @@ -164,7 +164,7 @@ public: } //! tune the given frontend, return the exact value - double tune(const std::string& which, const double freq) + double tune(const std::string& which, const double freq) override { std::lock_guard<std::mutex> lock(_mutex); @@ -179,7 +179,7 @@ public: } //! get the current frequency for the given frontend - double get_freq(const std::string& which) + double get_freq(const std::string& which) override { std::lock_guard<std::mutex> lock(_mutex); @@ -188,7 +188,7 @@ public: } //! turn on/off data port loopback - void data_port_loopback(const bool on) + void data_port_loopback(const bool on) override { std::lock_guard<std::mutex> lock(_mutex); @@ -196,7 +196,7 @@ public: } //! read internal RSSI sensor - sensor_value_t get_rssi(const std::string& which) + sensor_value_t get_rssi(const std::string& which) override { std::lock_guard<std::mutex> lock(_mutex); @@ -205,12 +205,12 @@ public: } //! read the internal temp sensor. Average over 3 results - sensor_value_t get_temperature() + sensor_value_t get_temperature() override { return sensor_value_t("temp", _device.get_average_temperature(), "C"); } - void set_dc_offset_auto(const std::string& which, const bool on) + void set_dc_offset_auto(const std::string& which, const bool on) override { std::lock_guard<std::mutex> lock(_mutex); @@ -218,7 +218,7 @@ public: _device.set_dc_offset_auto(direction, on); } - void set_iq_balance_auto(const std::string& which, const bool on) + void set_iq_balance_auto(const std::string& which, const bool on) override { std::lock_guard<std::mutex> lock(_mutex); @@ -226,7 +226,7 @@ public: _device.set_iq_balance_auto(direction, on); } - double set_bw_filter(const std::string& which, const double bw) + double set_bw_filter(const std::string& which, const double bw) override { ad9361_device_t::direction_t direction = _get_direction_from_antenna(which); double actual_bw = bw; @@ -248,7 +248,7 @@ public: return actual_bw; } - std::vector<std::string> get_filter_names(const std::string& which) + std::vector<std::string> get_filter_names(const std::string& which) override { std::lock_guard<std::mutex> lock(_mutex); @@ -257,7 +257,7 @@ public: } filter_info_base::sptr get_filter( - const std::string& which, const std::string& filter_name) + const std::string& which, const std::string& filter_name) override { std::lock_guard<std::mutex> lock(_mutex); @@ -268,7 +268,7 @@ public: void set_filter(const std::string& which, const std::string& filter_name, - const filter_info_base::sptr filter) + const filter_info_base::sptr filter) override { std::lock_guard<std::mutex> lock(_mutex); @@ -277,7 +277,7 @@ public: _device.set_filter(direction, chain, filter_name, filter); } - void output_digital_test_tone(bool enb) + void output_digital_test_tone(bool enb) override { _device.digital_test_tone(enb); } diff --git a/host/lib/usrp/common/ad936x_manager.cpp b/host/lib/usrp/common/ad936x_manager.cpp index 9646f0427..31e823d32 100644 --- a/host/lib/usrp/common/ad936x_manager.cpp +++ b/host/lib/usrp/common/ad936x_manager.cpp @@ -57,7 +57,7 @@ public: /************************************************************************ * API Calls ***********************************************************************/ - void init_codec() + void init_codec() override { for (const std::string& rx_fe : _rx_frontends) { _codec_ctrl->set_gain(rx_fe, DEFAULT_GAIN); @@ -86,7 +86,7 @@ public: // worst case conditions to stress the interface. // void loopback_self_test(std::function<void(uint32_t)> poker_functor, - std::function<uint64_t()> peeker_functor) + std::function<uint64_t()> peeker_functor) override { // Put AD936x in loopback mode _codec_ctrl->data_port_loopback(true); @@ -135,7 +135,7 @@ public: } - double get_auto_tick_rate(const double lcm_rate, size_t num_chans) + double get_auto_tick_rate(const double lcm_rate, size_t num_chans) override { UHD_ASSERT_THROW(num_chans >= 1 and num_chans <= _n_frontends); const uhd::meta_range_t rate_range = _codec_ctrl->get_clock_rate_range(); @@ -186,7 +186,7 @@ public: return new_rate; } - bool check_bandwidth(double rate, const std::string dir) + bool check_bandwidth(double rate, const std::string dir) override { double bw = _bw[dir == "Rx" ? "RX1" : "TX1"]; if (bw == 0.) // 0 indicates bandwidth is default value. @@ -208,8 +208,9 @@ public: return (rate <= bw); } - void populate_frontend_subtree( - uhd::property_tree::sptr subtree, const std::string& key, uhd::direction_t dir) + void populate_frontend_subtree(uhd::property_tree::sptr subtree, + const std::string& key, + uhd::direction_t dir) override { subtree->create<std::string>("name").set("FE-" + key); diff --git a/host/lib/usrp/common/fx2_ctrl.cpp b/host/lib/usrp/common/fx2_ctrl.cpp index cbb108dae..82e84c6d9 100644 --- a/host/lib/usrp/common/fx2_ctrl.cpp +++ b/host/lib/usrp/common/fx2_ctrl.cpp @@ -134,7 +134,7 @@ public: _ctrl_transport = ctrl_transport; } - void usrp_fx2_reset(void) + void usrp_fx2_reset(void) override { unsigned char reset_y = 1; unsigned char reset_n = 0; @@ -144,7 +144,7 @@ public: std::this_thread::sleep_for(std::chrono::milliseconds(2000)); } - void usrp_load_firmware(std::string filestring, bool force) + void usrp_load_firmware(std::string filestring, bool force) override { const char* filename = filestring.c_str(); @@ -218,7 +218,7 @@ public: throw uhd::io_error("usrp_load_firmware: bad record"); } - void usrp_init(void) + void usrp_init(void) override { // disable usrp_rx_enable(false); @@ -231,7 +231,7 @@ public: usrp_tx_reset(false); } - void usrp_load_fpga(std::string filestring) + void usrp_load_fpga(std::string filestring) override { const char* filename = filestring.c_str(); @@ -283,7 +283,7 @@ public: UHD_LOGGER_INFO("FX2") << "FPGA image loaded"; } - void usrp_load_eeprom(std::string filestring) + void usrp_load_eeprom(std::string filestring) override { if (load_img_msg) UHD_LOGGER_INFO("FX2") << "Loading EEPROM image: " << filestring << "..."; @@ -369,13 +369,13 @@ public: >= 0); } - void usrp_tx_enable(bool on) + void usrp_tx_enable(bool on) override { UHD_ASSERT_THROW(usrp_control_write_cmd(VRQ_FPGA_SET_TX_ENABLE, on, 0) >= 0); } - void usrp_rx_enable(bool on) + void usrp_rx_enable(bool on) override { UHD_ASSERT_THROW(usrp_control_write_cmd(VRQ_FPGA_SET_RX_ENABLE, on, 0) >= 0); } @@ -392,7 +392,7 @@ public: UHD_ASSERT_THROW(usrp_control_write_cmd(VRQ_FPGA_SET_RX_RESET, on, 0) >= 0); } - void usrp_fpga_reset(bool on) + void usrp_fpga_reset(bool on) override { UHD_ASSERT_THROW(usrp_control_write_cmd(VRQ_FPGA_SET_RESET, on, 0) >= 0); } @@ -401,7 +401,7 @@ public: uint16_t value, uint16_t index, unsigned char* buff, - uint16_t length) + uint16_t length) override { return _ctrl_transport->submit(VRT_VENDOR_OUT, // bmReqeustType request, // bRequest @@ -416,7 +416,7 @@ public: uint16_t value, uint16_t index, unsigned char* buff, - uint16_t length) + uint16_t length) override { return _ctrl_transport->submit(VRT_VENDOR_IN, // bmReqeustType request, // bRequest @@ -432,18 +432,18 @@ public: return usrp_control_write(request, value, index, 0, 0); } - byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) + byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) override { this->write_i2c(addr, byte_vector_t(1, uint8_t(offset))); return this->read_i2c(addr, num_bytes); } - int usrp_i2c_write(uint16_t i2c_addr, unsigned char* buf, uint16_t len) + int usrp_i2c_write(uint16_t i2c_addr, unsigned char* buf, uint16_t len) override { return usrp_control_write(VRQ_I2C_WRITE, i2c_addr, 0, buf, len); } - int usrp_i2c_read(uint16_t i2c_addr, unsigned char* buf, uint16_t len) + int usrp_i2c_read(uint16_t i2c_addr, unsigned char* buf, uint16_t len) override { return usrp_control_read(VRQ_I2C_READ, i2c_addr, 0, buf, len); } @@ -451,7 +451,7 @@ public: static const bool iface_debug = false; static const size_t max_i2c_data_bytes = 64; - void write_i2c(uint16_t addr, const byte_vector_t& bytes) + void write_i2c(uint16_t addr, const byte_vector_t& bytes) override { UHD_ASSERT_THROW(bytes.size() < max_i2c_data_bytes); @@ -462,7 +462,7 @@ public: uhd::runtime_error("USRP: failed i2c write"); } - 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 { UHD_ASSERT_THROW(num_bytes < max_i2c_data_bytes); diff --git a/host/lib/usrp/common/io_service_mgr.cpp b/host/lib/usrp/common/io_service_mgr.cpp index e30fa422d..0c2af5f68 100644 --- a/host/lib/usrp/common/io_service_mgr.cpp +++ b/host/lib/usrp/common/io_service_mgr.cpp @@ -416,9 +416,10 @@ public: const link_type_t link_type, const io_service_args_t& default_args, const uhd::device_addr_t& stream_args, - const std::string& streamer_id); + const std::string& streamer_id) override; - void disconnect_links(recv_link_if::sptr recv_link, send_link_if::sptr send_link); + void disconnect_links( + recv_link_if::sptr recv_link, send_link_if::sptr send_link) override; private: enum io_service_type_t { INLINE_IO_SRV, BLOCKING_IO_SRV, POLLING_IO_SRV }; diff --git a/host/lib/usrp/common/pwr_cal_mgr.cpp b/host/lib/usrp/common/pwr_cal_mgr.cpp index 0c30be7ad..d2838cbe9 100644 --- a/host/lib/usrp/common/pwr_cal_mgr.cpp +++ b/host/lib/usrp/common/pwr_cal_mgr.cpp @@ -55,19 +55,19 @@ public: set_serial(serial); } - void set_gain_group(uhd::gain_group::sptr gain_group) + void set_gain_group(uhd::gain_group::sptr gain_group) override { _gain_group = gain_group; } - bool has_power_data() + bool has_power_data() override { const std::string key = _get_key(); _load_cal_data(key); return _cal_data.count(key) && bool(_cal_data.at(key)); } - void populate_subtree(uhd::property_tree::sptr subtree) + void populate_subtree(uhd::property_tree::sptr subtree) override { subtree->create<std::string>(uhd::fs_path("ref_power/key")) .set_coercer([](const std::string&) -> std::string { @@ -93,7 +93,7 @@ public: .set_publisher([this]() { return this->get_power_range(); }); } - double set_power(const double power_dbm) + double set_power(const double power_dbm) override { const std::string key = _get_key(); _load_cal_data(key); @@ -128,7 +128,7 @@ public: return coerced_total_power; } - double get_power() + double get_power() override { const std::string key = _get_key(); _load_cal_data(key); @@ -148,14 +148,14 @@ public: return hw_power + (_gain_group->get_value() - hw_gain); } - void update_power() + void update_power() override { if (_mode == tracking_mode::TRACK_POWER) { set_power(_desired_power); } } - uhd::meta_range_t get_power_range() + uhd::meta_range_t get_power_range() override { const std::string key = _get_key(); _load_cal_data(key); @@ -171,7 +171,7 @@ public: return cal_data->get_power_limits(freq); } - void set_temperature(const int temp_C) + void set_temperature(const int temp_C) override { for (auto& cal_data : _cal_data) { if (cal_data.second) { @@ -180,12 +180,12 @@ public: } } - void set_tracking_mode(const tracking_mode mode) + void set_tracking_mode(const tracking_mode mode) override { _mode = mode; } - void set_serial(const std::string& serial) + void set_serial(const std::string& serial) override { if (serial == _serial || serial.empty()) { return; @@ -233,12 +233,12 @@ public: } } - std::string get_serial() const + std::string get_serial() const override { return _serial; } - std::string get_key() + std::string get_key() override { return _get_key(); } diff --git a/host/lib/usrp/common/recv_packet_demuxer.cpp b/host/lib/usrp/common/recv_packet_demuxer.cpp index c5ed1563e..9d3067286 100644 --- a/host/lib/usrp/common/recv_packet_demuxer.cpp +++ b/host/lib/usrp/common/recv_packet_demuxer.cpp @@ -26,7 +26,7 @@ public: { /*NOP*/ } - void release(void) + void release(void) override { delete this; } @@ -56,7 +56,8 @@ public: /* NOP */ } - managed_recv_buffer::sptr get_recv_buff(const size_t index, const double timeout) + managed_recv_buffer::sptr get_recv_buff( + const size_t index, const double timeout) override { boost::mutex::scoped_lock lock(_mutex); managed_recv_buffer::sptr buff; diff --git a/host/lib/usrp/common/validate_subdev_spec.cpp b/host/lib/usrp/common/validate_subdev_spec.cpp index 61895a7f8..dc9c7700a 100644 --- a/host/lib/usrp/common/validate_subdev_spec.cpp +++ b/host/lib/usrp/common/validate_subdev_spec.cpp @@ -32,7 +32,7 @@ void uhd::usrp::validate_subdev_spec(property_tree::sptr tree, tree->list(str(boost::format("/mboards/%s/%s_dsps") % mb % type)).size(); // sanity checking on the length - if (spec.size() == 0) + if (spec.empty()) throw uhd::value_error( str(boost::format("Empty %s subdevice specification is not supported.\n") % type)); |