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/b200 | |
| 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/b200')
| -rw-r--r-- | host/lib/usrp/b200/b200_cores.hpp | 6 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_iface.cpp | 29 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_iface.hpp | 8 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_image_loader.cpp | 4 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_impl.cpp | 20 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_impl.hpp | 8 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_io_impl.cpp | 5 | ||||
| -rw-r--r-- | host/lib/usrp/b200/b200_uart.cpp | 6 | 
8 files changed, 45 insertions, 41 deletions
| diff --git a/host/lib/usrp/b200/b200_cores.hpp b/host/lib/usrp/b200/b200_cores.hpp index 7054fd068..1042cf422 100644 --- a/host/lib/usrp/b200/b200_cores.hpp +++ b/host/lib/usrp/b200/b200_cores.hpp @@ -24,11 +24,11 @@ public:      b200_local_spi_core(uhd::wb_iface::sptr iface, perif_t default_perif); -    virtual uint32_t transact_spi(int which_slave, +    uint32_t transact_spi(int which_slave,          const uhd::spi_config_t& config,          uint32_t data,          size_t num_bits, -        bool readback); +        bool readback) override;      void change_perif(perif_t perif);      void restore_perif(); @@ -48,7 +48,7 @@ public:      typedef std::shared_ptr<b200_ref_pll_ctrl> sptr;      b200_ref_pll_ctrl(b200_local_spi_core::sptr spi); -    virtual void set_lock_to_ext_ref(bool external); +    void set_lock_to_ext_ref(bool external) override;  private:      b200_local_spi_core::sptr _spi; diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp index 2efc9efb5..aa8b14cc6 100644 --- a/host/lib/usrp/b200/b200_iface.cpp +++ b/host/lib/usrp/b200/b200_iface.cpp @@ -161,18 +161,20 @@ public:              timeout); // timeout      } -    void write_i2c(UHD_UNUSED(uint16_t addr), UHD_UNUSED(const byte_vector_t& bytes)) +    void write_i2c( +        UHD_UNUSED(uint16_t addr), UHD_UNUSED(const byte_vector_t& bytes)) override      {          throw uhd::not_implemented_error("b200 write i2c");      } -    byte_vector_t read_i2c(UHD_UNUSED(uint16_t addr), UHD_UNUSED(size_t num_bytes)) +    byte_vector_t read_i2c( +        UHD_UNUSED(uint16_t addr), UHD_UNUSED(size_t num_bytes)) override      {          throw uhd::not_implemented_error("b200 read i2c");      } -    void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& bytes) +    void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& bytes) override      {          int ret = fx3_control_write(B200_VREQ_EEPROM_WRITE,              0, @@ -191,7 +193,7 @@ public:                                      .str());      } -    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      {          byte_vector_t recv_bytes(num_bytes);          int bytes_read = fx3_control_read(B200_VREQ_EEPROM_READ, @@ -213,7 +215,8 @@ public:          return recv_bytes;      } -    void load_firmware(const std::string filestring, UHD_UNUSED(bool force) = false) +    void load_firmware( +        const std::string filestring, UHD_UNUSED(bool force) = false) override      {          if (load_img_msg) {              UHD_LOGGER_INFO("B200") << "Loading firmware image: " << filestring << "..."; @@ -244,7 +247,7 @@ public:          std::this_thread::sleep_for(std::chrono::milliseconds(1000));      } -    void reset_fx3(void) +    void reset_fx3(void) override      {          unsigned char data[4];          memset(data, 0x00, sizeof(data)); @@ -262,7 +265,7 @@ public:                      .str());      } -    void reset_gpif(void) +    void reset_gpif(void) override      {          unsigned char data[4];          memset(data, 0x00, sizeof(data)); @@ -281,7 +284,7 @@ public:                      .str());      } -    void set_fpga_reset_pin(const bool reset) +    void set_fpga_reset_pin(const bool reset) override      {          unsigned char data[4];          memset(data, (reset) ? 0xFF : 0x00, sizeof(data)); @@ -301,7 +304,7 @@ public:          */      } -    uint8_t get_usb_speed(void) +    uint8_t get_usb_speed(void) override      {          unsigned char rx_data[1];          memset(rx_data, 0x00, sizeof(rx_data)); @@ -321,7 +324,7 @@ public:          return boost::lexical_cast<uint8_t>(rx_data[0]);      } -    uint8_t get_fx3_status(void) +    uint8_t get_fx3_status(void) override      {          unsigned char rx_data[1];          memset(rx_data, 0x00, sizeof(rx_data)); @@ -343,7 +346,7 @@ public:          return boost::lexical_cast<uint8_t>(rx_data[0]);      } -    uint16_t get_compat_num(void) +    uint16_t get_compat_num(void) override      {          unsigned char rx_data[2];          memset(rx_data, 0x00, sizeof(rx_data)); @@ -482,7 +485,7 @@ public:          return static_cast<size_t>(filesize);      } -    uint32_t load_fpga(const std::string filestring, bool force) +    uint32_t load_fpga(const std::string filestring, bool force) override      {          uint8_t fx3_state = 0;          uint32_t wait_count; @@ -660,7 +663,7 @@ public:          return 0;      } -    uint32_t load_bootloader(const std::string filestring) +    uint32_t load_bootloader(const std::string filestring) override      {          // open bootloader file          const char* filename = filestring.c_str(); diff --git a/host/lib/usrp/b200/b200_iface.hpp b/host/lib/usrp/b200/b200_iface.hpp index 7d7e169d4..5450fb7b6 100644 --- a/host/lib/usrp/b200/b200_iface.hpp +++ b/host/lib/usrp/b200/b200_iface.hpp @@ -94,11 +94,11 @@ public:      //! load a bootloader image onto device EEPROM      virtual uint32_t load_bootloader(const std::string filestring) = 0; -    virtual void write_eeprom( -        uint16_t addr, uint16_t offset, const uhd::byte_vector_t& bytes) = 0; +    void write_eeprom( +        uint16_t addr, uint16_t offset, const uhd::byte_vector_t& bytes) override = 0; -    virtual uhd::byte_vector_t read_eeprom( -        uint16_t addr, uint16_t offset, size_t num_bytes) = 0; +    uhd::byte_vector_t read_eeprom( +        uint16_t addr, uint16_t offset, size_t num_bytes) override = 0;      static std::string fx3_state_string(uint8_t state);  }; diff --git a/host/lib/usrp/b200/b200_image_loader.cpp b/host/lib/usrp/b200/b200_image_loader.cpp index 25bf7ce2f..675819018 100644 --- a/host/lib/usrp/b200/b200_image_loader.cpp +++ b/host/lib/usrp/b200/b200_image_loader.cpp @@ -34,7 +34,7 @@ static b200_iface::sptr get_b200_iface(      b200_iface::sptr iface;      mboard_eeprom_t eeprom; // Internal use -    if (dev_handles.size() > 0) { +    if (!dev_handles.empty()) {          for (usb_device_handle::sptr dev_handle : dev_handles) {              if (dev_handle->firmware_loaded()) {                  iface  = b200_iface::make(usb_control::make(dev_handle, 0)); @@ -104,7 +104,7 @@ static bool b200_image_loader(const image_loader::image_loader_args_t& image_loa          return false; // No initialized B2x0 found      std::string fpga_path; -    if (image_loader_args.fpga_path == "") { +    if (image_loader_args.fpga_path.empty()) {          /*           * Normally, we can auto-generate the FPGA filename from what's in the EEPROM,           * but if the applicable value is not in the EEPROM, the user must give a specific diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 7f250fd42..e43eff045 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -42,8 +42,8 @@ constexpr int64_t REENUMERATION_TIMEOUT_MS = 3000;  class b200_ad9361_client_t : public ad9361_params  {  public: -    ~b200_ad9361_client_t() {} -    double get_band_edge(frequency_band_t band) +    ~b200_ad9361_client_t() override {} +    double get_band_edge(frequency_band_t band) override      {          switch (band) {              case AD9361_RX_BAND0: @@ -56,15 +56,15 @@ public:                  return 0;          }      } -    clocking_mode_t get_clocking_mode() +    clocking_mode_t get_clocking_mode() override      {          return clocking_mode_t::AD9361_XTAL_N_CLK_PATH;      } -    digital_interface_mode_t get_digital_interface_mode() +    digital_interface_mode_t get_digital_interface_mode() override      {          return AD9361_DDR_FDD_LVCMOS;      } -    digital_interface_delays_t get_digital_interface_timing() +    digital_interface_delays_t get_digital_interface_timing() override      {          digital_interface_delays_t delays;          delays.rx_clk_delay  = 0; @@ -79,8 +79,8 @@ public:  class b2xxmini_ad9361_client_t : public ad9361_params  {  public: -    ~b2xxmini_ad9361_client_t() {} -    double get_band_edge(frequency_band_t band) +    ~b2xxmini_ad9361_client_t() override {} +    double get_band_edge(frequency_band_t band) override      {          switch (band) {              case AD9361_RX_BAND0: @@ -93,15 +93,15 @@ public:                  return 0; // On both Rx and Tx          }      } -    clocking_mode_t get_clocking_mode() +    clocking_mode_t get_clocking_mode() override      {          return clocking_mode_t::AD9361_XTAL_N_CLK_PATH;      } -    digital_interface_mode_t get_digital_interface_mode() +    digital_interface_mode_t get_digital_interface_mode() override      {          return AD9361_DDR_FDD_LVCMOS;      } -    digital_interface_delays_t get_digital_interface_timing() +    digital_interface_delays_t get_digital_interface_timing() override      {          digital_interface_delays_t delays;          delays.rx_clk_delay  = 0; diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index cb2edea80..44205f03a 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -115,12 +115,12 @@ class b200_impl : public uhd::device  public:      // structors      b200_impl(const uhd::device_addr_t&, uhd::transport::usb_device_handle::sptr& handle); -    ~b200_impl(void); +    ~b200_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;      //! Check that the combination of stream args and tick rate are valid.      // diff --git a/host/lib/usrp/b200/b200_io_impl.cpp b/host/lib/usrp/b200/b200_io_impl.cpp index 57a1b18c7..ac87a0e34 100644 --- a/host/lib/usrp/b200/b200_io_impl.cpp +++ b/host/lib/usrp/b200/b200_io_impl.cpp @@ -255,7 +255,8 @@ uhd::usrp::subdev_spec_t b200_impl::coerce_subdev_spec(      //      // Any other spec is probably illegal and will be caught by      // validate_subdev_spec(). -    if (spec.size() and (_product == B200 or _product == B200MINI or _product == B205MINI) +    if (!spec.empty() +        and (_product == B200 or _product == B200MINI or _product == B205MINI)          and spec[0].sd_name == "B") {          spec[0].sd_name = "A";      } @@ -266,7 +267,7 @@ void b200_impl::update_subdev_spec(      const std::string& tx_rx, const uhd::usrp::subdev_spec_t& spec)  {      // sanity checking -    if (spec.size()) { +    if (!spec.empty()) {          validate_subdev_spec(_tree, spec, tx_rx);      } diff --git a/host/lib/usrp/b200/b200_uart.cpp b/host/lib/usrp/b200/b200_uart.cpp index b78690705..089c6c9b3 100644 --- a/host/lib/usrp/b200/b200_uart.cpp +++ b/host/lib/usrp/b200/b200_uart.cpp @@ -57,21 +57,21 @@ struct b200_uart_impl : b200_uart          buff->commit(packet_info.num_packet_words32 * sizeof(uint32_t));      } -    void write_uart(const std::string& buff) +    void write_uart(const std::string& buff) override      {          for (const char ch : buff) {              this->send_char(ch);          }      } -    std::string read_uart(double timeout) +    std::string read_uart(double timeout) override      {          std::string line;          _line_queue.pop_with_timed_wait(line, timeout);          return line;      } -    void handle_uart_packet(managed_recv_buffer::sptr buff) +    void handle_uart_packet(managed_recv_buffer::sptr buff) override      {          const uint32_t* packet_buff = buff->cast<const uint32_t*>();          vrt::if_packet_info_t packet_info; | 
