diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-03-09 10:38:42 +0100 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-03-17 15:44:05 -0500 |
commit | 668a04befdc4ec43b2a6e86992c672ef5f8408e0 (patch) | |
tree | 67734ba32968831a5b4ea8dd59b7b2ab52e68d01 /host | |
parent | 19f3c1203a42d9da3d7cb16c881fe2bbdc5ec0ce (diff) | |
download | uhd-668a04befdc4ec43b2a6e86992c672ef5f8408e0.tar.gz uhd-668a04befdc4ec43b2a6e86992c672ef5f8408e0.tar.bz2 uhd-668a04befdc4ec43b2a6e86992c672ef5f8408e0.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
Note: This is the same procedure as 107a49c0, but applied to all the new
code since then.
Diffstat (limited to 'host')
27 files changed, 280 insertions, 262 deletions
diff --git a/host/lib/include/uhdlib/usrp/common/rpc.py b/host/lib/include/uhdlib/usrp/common/rpc.py index c484991a6..7840d10aa 100644 --- a/host/lib/include/uhdlib/usrp/common/rpc.py +++ b/host/lib/include/uhdlib/usrp/common/rpc.py @@ -124,7 +124,7 @@ namespace uhd { namespace usrp { %endfor // Deprecated - uhd::rpc_client::sptr get_raw_rpc_client() { return _rpcc; } + uhd::rpc_client::sptr get_raw_rpc_client() override { return _rpcc; } private: uhd::rpc_client::sptr _rpcc; diff --git a/host/lib/rfnoc/null_block_control.cpp b/host/lib/rfnoc/null_block_control.cpp index bb5fe2ea9..b51dbb906 100644 --- a/host/lib/rfnoc/null_block_control.cpp +++ b/host/lib/rfnoc/null_block_control.cpp @@ -109,12 +109,12 @@ public: regs().poke32(REG_SRC_THROTTLE_CYC, cycs); } - uint32_t get_item_width() + uint32_t get_item_width() override { return _item_width; } - uint32_t get_nipc() + uint32_t get_nipc() override { return _nipc; } diff --git a/host/lib/transport/dpdk_simple.cpp b/host/lib/transport/dpdk_simple.cpp index d93d73b56..835885cba 100644 --- a/host/lib/transport/dpdk_simple.cpp +++ b/host/lib/transport/dpdk_simple.cpp @@ -74,7 +74,7 @@ public: UHD_LOG_TRACE("DPDK::SIMPLE", "Constructor complete"); } - ~dpdk_simple_impl(void) + ~dpdk_simple_impl(void) override { UHD_LOG_TRACE("DPDK::SIMPLE", "~dpdk_simple_impl(), DPDK port index " << _link->get_port()->get_port_id()); @@ -91,7 +91,7 @@ public: * \param length bytes of data to send * \return number of bytes sent (releases buffer if sent) */ - size_t send(const boost::asio::const_buffer& user_buff) + size_t send(const boost::asio::const_buffer& user_buff) override { // Extract buff and sanity check const size_t nbytes = boost::asio::buffer_size(user_buff); @@ -117,7 +117,7 @@ public: * \param timeout the timeout in seconds * \return the number of bytes received or zero on timeout */ - size_t recv(const boost::asio::mutable_buffer& user_buff, double timeout) + size_t recv(const boost::asio::mutable_buffer& user_buff, double timeout) override { size_t user_buff_size = boost::asio::buffer_size(user_buff); uint8_t* user_data = boost::asio::buffer_cast<uint8_t*>(user_buff); @@ -146,12 +146,12 @@ public: return copy_len; } - std::string get_recv_addr(void) + std::string get_recv_addr(void) override { return dpdk::ipv4_num_to_str(_last_recv_addr); } - std::string get_send_addr(void) + std::string get_send_addr(void) override { return dpdk::ipv4_num_to_str(_link->get_remote_ipv4()); } diff --git a/host/lib/transport/inline_io_service.cpp b/host/lib/transport/inline_io_service.cpp index 11835b285..7eb3072b7 100644 --- a/host/lib/transport/inline_io_service.cpp +++ b/host/lib/transport/inline_io_service.cpp @@ -207,7 +207,7 @@ public: _num_send_frames = num_send_frames; } - ~inline_recv_io() + ~inline_recv_io() override { _io_srv->disconnect_receiver(_data_link.get(), this); if (_fc_link) { @@ -263,7 +263,7 @@ public: _num_send_frames = num_send_frames; } - ~inline_send_io() + ~inline_send_io() override { _io_srv->disconnect_sender(_send_link.get()); if (_recv_link) { diff --git a/host/lib/transport/offload_io_service.cpp b/host/lib/transport/offload_io_service.cpp index 32811cbc0..706841f86 100644 --- a/host/lib/transport/offload_io_service.cpp +++ b/host/lib/transport/offload_io_service.cpp @@ -257,7 +257,7 @@ public: offload_io_service_impl( io_service::sptr io_srv, const offload_io_service::params_t& params); - ~offload_io_service_impl(); + ~offload_io_service_impl() override; void attach_recv_link(recv_link_if::sptr link) override; void attach_send_link(send_link_if::sptr link) override; diff --git a/host/lib/transport/udp_wsa_zero_copy.cpp b/host/lib/transport/udp_wsa_zero_copy.cpp index b4880478a..55773296f 100644 --- a/host/lib/transport/udp_wsa_zero_copy.cpp +++ b/host/lib/transport/udp_wsa_zero_copy.cpp @@ -91,12 +91,12 @@ public: this->release(); // makes buffer available via get_new } - ~udp_zero_copy_asio_mrb(void) + ~udp_zero_copy_asio_mrb(void) override { WSACloseEvent(_overlapped.hEvent); } - void release(void) + void release(void) override { _wsa_buff.len = _frame_size; _flags = 0; @@ -143,12 +143,12 @@ public: WSASetEvent(_overlapped.hEvent); // makes buffer available via get_new } - ~udp_zero_copy_asio_msb(void) + ~udp_zero_copy_asio_msb(void) override { WSACloseEvent(_overlapped.hEvent); } - void release(void) + void release(void) override { _wsa_buff.len = size(); WSASend(_sock_fd, &_wsa_buff, 1, NULL, 0, &_overlapped, NULL); @@ -284,7 +284,7 @@ public: } } - ~udp_zero_copy_wsa_impl(void) + ~udp_zero_copy_wsa_impl(void) override { closesocket(_sock_fd); } @@ -293,18 +293,18 @@ public: * Receive implementation: * Block on the managed buffer's get call and advance the index. ******************************************************************/ - managed_recv_buffer::sptr get_recv_buff(double timeout) + managed_recv_buffer::sptr get_recv_buff(double timeout) override { if (_next_recv_buff_index == _num_recv_frames) _next_recv_buff_index = 0; return _mrb_pool[_next_recv_buff_index]->get_new(timeout, _next_recv_buff_index); } - size_t get_num_recv_frames(void) const + size_t get_num_recv_frames(void) const override { return _num_recv_frames; } - size_t get_recv_frame_size(void) const + size_t get_recv_frame_size(void) const override { return _recv_frame_size; } @@ -313,23 +313,23 @@ public: * Send implementation: * Block on the managed buffer's get call and advance the index. ******************************************************************/ - managed_send_buffer::sptr get_send_buff(double timeout) + managed_send_buffer::sptr get_send_buff(double timeout) override { if (_next_send_buff_index == _num_send_frames) _next_send_buff_index = 0; return _msb_pool[_next_send_buff_index]->get_new(timeout, _next_send_buff_index); } - size_t get_num_send_frames(void) const + size_t get_num_send_frames(void) const override { return _num_send_frames; } - size_t get_send_frame_size(void) const + size_t get_send_frame_size(void) const override { return _send_frame_size; } - uint16_t get_local_port(void) const + uint16_t get_local_port(void) const override { struct sockaddr_in addr_info; int addr_len = sizeof(addr_info); @@ -340,7 +340,7 @@ public: return local_port; } - std::string get_local_addr(void) const + std::string get_local_addr(void) const override { // Behold the beauty of winsock struct sockaddr_in addr_info; diff --git a/host/lib/usrp/b100/clock_ctrl.cpp b/host/lib/usrp/b100/clock_ctrl.cpp index 12ef2052f..e8d112635 100644 --- a/host/lib/usrp/b100/clock_ctrl.cpp +++ b/host/lib/usrp/b100/clock_ctrl.cpp @@ -232,7 +232,7 @@ public: this->enable_tx_dboard_clock(false); } - ~b100_clock_ctrl_impl(void) + ~b100_clock_ctrl_impl(void) override { UHD_SAFE_CALL(this->enable_test_clock(ENABLE_THE_TEST_OUT); this->enable_rx_dboard_clock(false); @@ -339,7 +339,7 @@ public: this->send_all_regs(); } - void set_fpga_clock_rate(double rate) + void set_fpga_clock_rate(double rate) override { if (_out_rate == rate) return; @@ -352,7 +352,7 @@ public: set_tx_dboard_clock_rate(rate); } - double get_fpga_clock_rate(void) + double get_fpga_clock_rate(void) override { return this->_out_rate; } @@ -360,7 +360,7 @@ public: /*********************************************************************** * FPGA clock enable **********************************************************************/ - void enable_fpga_clock(bool enb) + void enable_fpga_clock(bool enb) override { _ad9522_regs.out0_format = ad9522_regs_t::OUT0_FORMAT_LVDS; _ad9522_regs.out0_lvds_power_down = !enb; @@ -385,7 +385,7 @@ public: /*********************************************************************** * RX Dboard Clock Control (output 9, divider 3) **********************************************************************/ - void enable_rx_dboard_clock(bool enb) + void enable_rx_dboard_clock(bool enb) override { _ad9522_regs.out9_format = ad9522_regs_t::OUT9_FORMAT_LVDS; _ad9522_regs.out9_lvds_power_down = !enb; @@ -393,7 +393,7 @@ public: this->latch_regs(); } - std::vector<double> get_rx_dboard_clock_rates(void) + std::vector<double> get_rx_dboard_clock_rates(void) override { std::vector<double> rates; for (size_t div = 1; div <= 16 + 16; div++) @@ -401,7 +401,7 @@ public: return rates; } - void set_rx_dboard_clock_rate(double rate) + void set_rx_dboard_clock_rate(double rate) override { assert_has(get_rx_dboard_clock_rates(), rate, "rx dboard clock rate"); _rx_clock_rate = rate; @@ -416,7 +416,7 @@ public: this->soft_sync(); } - double get_rx_clock_rate(void) + double get_rx_clock_rate(void) override { return _rx_clock_rate; } @@ -424,7 +424,7 @@ public: /*********************************************************************** * TX Dboard Clock Control (output 6, divider 2) **********************************************************************/ - void enable_tx_dboard_clock(bool enb) + void enable_tx_dboard_clock(bool enb) override { _ad9522_regs.out6_format = ad9522_regs_t::OUT6_FORMAT_LVDS; _ad9522_regs.out6_lvds_power_down = !enb; @@ -432,12 +432,12 @@ public: this->latch_regs(); } - std::vector<double> get_tx_dboard_clock_rates(void) + std::vector<double> get_tx_dboard_clock_rates(void) override { return get_rx_dboard_clock_rates(); // same master clock, same dividers... } - void set_tx_dboard_clock_rate(double rate) + void set_tx_dboard_clock_rate(double rate) override { assert_has(get_tx_dboard_clock_rates(), rate, "tx dboard clock rate"); _tx_clock_rate = rate; @@ -452,7 +452,7 @@ public: this->soft_sync(); } - double get_tx_clock_rate(void) + double get_tx_clock_rate(void) override { return _tx_clock_rate; } @@ -460,7 +460,7 @@ public: /*********************************************************************** * Clock reference control **********************************************************************/ - void use_internal_ref(void) + void use_internal_ref(void) override { _ad9522_regs.enable_ref2 = 1; _ad9522_regs.enable_ref1 = 0; @@ -471,7 +471,7 @@ public: this->latch_regs(); } - void use_external_ref(void) + void use_external_ref(void) override { _ad9522_regs.enable_ref2 = 0; _ad9522_regs.enable_ref1 = 1; @@ -482,7 +482,7 @@ public: this->latch_regs(); } - void use_auto_ref(void) + void use_auto_ref(void) override { _ad9522_regs.enable_ref2 = 1; _ad9522_regs.enable_ref1 = 1; @@ -493,7 +493,7 @@ public: this->latch_regs(); } - bool get_locked(void) + bool get_locked(void) override { static const uint8_t addr = 0x01F; uint32_t reg = this->read_reg(addr); diff --git a/host/lib/usrp/b100/codec_ctrl.cpp b/host/lib/usrp/b100/codec_ctrl.cpp index f6e2d8b93..fad25cf8c 100644 --- a/host/lib/usrp/b100/codec_ctrl.cpp +++ b/host/lib/usrp/b100/codec_ctrl.cpp @@ -36,17 +36,17 @@ class b100_codec_ctrl_impl : public b100_codec_ctrl public: // structors b100_codec_ctrl_impl(spi_iface::sptr iface); - ~b100_codec_ctrl_impl(void); + ~b100_codec_ctrl_impl(void) override; // aux adc and dac control - double read_aux_adc(aux_adc_t which); - void write_aux_dac(aux_dac_t which, double volts); + double read_aux_adc(aux_adc_t which) override; + void write_aux_dac(aux_dac_t which, double volts) override; // pga gain control - void set_tx_pga_gain(double); - double get_tx_pga_gain(void); - void set_rx_pga_gain(double, char); - double get_rx_pga_gain(char); + void set_tx_pga_gain(double) override; + double get_tx_pga_gain(void) override; + void set_rx_pga_gain(double, char) override; + double get_rx_pga_gain(char) override; private: spi_iface::sptr _iface; diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp index 238dbd95e..a55e5fc70 100644 --- a/host/lib/usrp/dboard/db_dbsrx.cpp +++ b/host/lib/usrp/dboard/db_dbsrx.cpp @@ -56,7 +56,7 @@ class dbsrx : public rx_dboard_base { public: dbsrx(ctor_args_t args); - virtual ~dbsrx(void); + ~dbsrx(void) override; private: double _lo_freq; diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp index 19c058ada..7635327b1 100644 --- a/host/lib/usrp/dboard/db_dbsrx2.cpp +++ b/host/lib/usrp/dboard/db_dbsrx2.cpp @@ -50,7 +50,7 @@ class dbsrx2 : public rx_dboard_base { public: dbsrx2(ctor_args_t args); - virtual ~dbsrx2(void); + ~dbsrx2(void) override; private: double _lo_freq; diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 05f5c9a0e..f4de7ccaa 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -63,7 +63,7 @@ class rfx_xcvr : public xcvr_dboard_base public: rfx_xcvr( ctor_args_t args, const freq_range_t& freq_range, bool rx_div2, bool tx_div2); - virtual ~rfx_xcvr(void); + ~rfx_xcvr(void) override; private: const freq_range_t _freq_range; diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp index c9a940d15..60a019a2e 100644 --- a/host/lib/usrp/dboard/db_tvrx.cpp +++ b/host/lib/usrp/dboard/db_tvrx.cpp @@ -187,7 +187,7 @@ class tvrx : public rx_dboard_base { public: tvrx(ctor_args_t args); - virtual ~tvrx(void); + ~tvrx(void) override; private: uhd::dict<std::string, double> _gains; diff --git a/host/lib/usrp/dboard/db_tvrx2.cpp b/host/lib/usrp/dboard/db_tvrx2.cpp index 0f1673633..cc1249dee 100644 --- a/host/lib/usrp/dboard/db_tvrx2.cpp +++ b/host/lib/usrp/dboard/db_tvrx2.cpp @@ -763,7 +763,7 @@ class tvrx2 : public rx_dboard_base { public: tvrx2(ctor_args_t args); - virtual ~tvrx2(void); + ~tvrx2(void) override; private: double _freq_scalar; diff --git a/host/lib/usrp/dboard/db_ubx.cpp b/host/lib/usrp/dboard/db_ubx.cpp index 733a4b8e2..d36347b86 100644 --- a/host/lib/usrp/dboard/db_ubx.cpp +++ b/host/lib/usrp/dboard/db_ubx.cpp @@ -560,7 +560,7 @@ public: .set(0); } - virtual ~ubx_xcvr(void) + ~ubx_xcvr(void) override { UHD_SAFE_CALL( // Shutdown synthesizers diff --git a/host/lib/usrp/dboard/db_wbx_simple.cpp b/host/lib/usrp/dboard/db_wbx_simple.cpp index 35675a081..4fbaa738e 100644 --- a/host/lib/usrp/dboard/db_wbx_simple.cpp +++ b/host/lib/usrp/dboard/db_wbx_simple.cpp @@ -39,7 +39,7 @@ class wbx_simple : public wbx_base { public: wbx_simple(ctor_args_t args); - virtual ~wbx_simple(void); + ~wbx_simple(void) override; private: void set_rx_ant(const std::string& ant); diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index d42a56562..26c0d5950 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -93,7 +93,7 @@ class xcvr2450 : public xcvr_dboard_base { public: xcvr2450(ctor_args_t args); - virtual ~xcvr2450(void); + ~xcvr2450(void) override; private: double _lo_freq; diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp index 879885640..3881c9285 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp @@ -104,8 +104,10 @@ magnesium_radio_control_impl::magnesium_radio_control_impl(make_args_ptr make_ar RFNOC_LOG_TRACE("Entering magnesium_radio_control_impl ctor..."); UHD_ASSERT_THROW(get_block_id().get_block_count() < 2); - _tx_gain_profile_api = std::make_shared<rf_control::enumerated_gain_profile>(MAGNESIUM_GP_OPTIONS, "default", MAGNESIUM_NUM_CHANS); - _rx_gain_profile_api = std::make_shared<rf_control::enumerated_gain_profile>(MAGNESIUM_GP_OPTIONS, "default", MAGNESIUM_NUM_CHANS); + _tx_gain_profile_api = std::make_shared<rf_control::enumerated_gain_profile>( + MAGNESIUM_GP_OPTIONS, "default", MAGNESIUM_NUM_CHANS); + _rx_gain_profile_api = std::make_shared<rf_control::enumerated_gain_profile>( + MAGNESIUM_GP_OPTIONS, "default", MAGNESIUM_NUM_CHANS); const char radio_slot_name[2] = {'A', 'B'}; _radio_slot = radio_slot_name[get_block_id().get_block_count()]; @@ -256,16 +258,17 @@ double magnesium_radio_control_impl::set_tx_frequency( double coerced_if_freq = 0; if (_map_freq_to_tx_band(_tx_band_map, freq) == tx_band::LOWBAND) { - _is_low_band[TX_DIRECTION] = true; - coerced_if_freq = - this->_set_tx_lo_freq(adf4351_source, MAGNESIUM_LO2, MAGNESIUM_TX_IF_FREQ, chan); + _is_low_band[TX_DIRECTION] = true; + coerced_if_freq = this->_set_tx_lo_freq( + adf4351_source, MAGNESIUM_LO2, MAGNESIUM_TX_IF_FREQ, chan); RFNOC_LOG_TRACE("coerced_if_freq = " << coerced_if_freq); } else { _is_low_band[TX_DIRECTION] = false; _lo_disable(_tx_lo); } // external LO required to tune at 2xdesired_frequency. - const double lo1_freq = (ad9371_source == "internal" ? 1 : 2) * (coerced_if_freq + freq); + const double lo1_freq = + (ad9371_source == "internal" ? 1 : 2) * (coerced_if_freq + freq); this->_set_tx_lo_freq(ad9371_source, MAGNESIUM_LO1, lo1_freq, chan); this->_update_freq(chan, TX_DIRECTION); @@ -324,16 +327,17 @@ double magnesium_radio_control_impl::set_rx_frequency( double coerced_if_freq = 0; if (_map_freq_to_rx_band(_rx_band_map, freq) == rx_band::LOWBAND) { - _is_low_band[RX_DIRECTION] = true; - coerced_if_freq = - this->_set_rx_lo_freq(adf4351_source, MAGNESIUM_LO2, MAGNESIUM_RX_IF_FREQ, chan); + _is_low_band[RX_DIRECTION] = true; + coerced_if_freq = this->_set_rx_lo_freq( + adf4351_source, MAGNESIUM_LO2, MAGNESIUM_RX_IF_FREQ, chan); RFNOC_LOG_TRACE("coerced_if_freq = " << coerced_if_freq); } else { _is_low_band[RX_DIRECTION] = false; _lo_disable(_rx_lo); } // external LO required to tune at 2xdesired_frequency. - const double lo1_freq = (ad9371_source == "internal" ? 1 : 2) * coerced_if_freq + freq; + const double lo1_freq = + (ad9371_source == "internal" ? 1 : 2) * coerced_if_freq + freq; this->_set_rx_lo_freq(ad9371_source, MAGNESIUM_LO1, lo1_freq, chan); @@ -714,14 +718,14 @@ meta_range_t magnesium_radio_control_impl::get_rx_bandwidth_range(size_t) const *****************************************************************************/ std::vector<std::string> magnesium_radio_control_impl::get_rx_lo_names( const size_t /*chan*/ - ) const +) const { return std::vector<std::string>{MAGNESIUM_LO1, MAGNESIUM_LO2}; } std::vector<std::string> magnesium_radio_control_impl::get_rx_lo_sources( const std::string& name, const size_t /*chan*/ - ) const +) const { if (name == MAGNESIUM_LO2) { return std::vector<std::string>{"internal"}; @@ -734,7 +738,7 @@ std::vector<std::string> magnesium_radio_control_impl::get_rx_lo_sources( freq_range_t magnesium_radio_control_impl::get_rx_lo_freq_range( const std::string& name, const size_t /*chan*/ - ) const +) const { if (name == MAGNESIUM_LO1) { return freq_range_t{ADF4351_MIN_FREQ, ADF4351_MAX_FREQ}; @@ -763,7 +767,7 @@ void magnesium_radio_control_impl::set_rx_lo_source( const std::string magnesium_radio_control_impl::get_rx_lo_source( const std::string& name, const size_t /*chan*/ - ) const +) const { if (name == MAGNESIUM_LO1) { // TODO: should we use this from cache? @@ -832,14 +836,14 @@ double magnesium_radio_control_impl::get_rx_lo_freq( // TX LO std::vector<std::string> magnesium_radio_control_impl::get_tx_lo_names( const size_t /*chan*/ - ) const +) const { return std::vector<std::string>{MAGNESIUM_LO1, MAGNESIUM_LO2}; } std::vector<std::string> magnesium_radio_control_impl::get_tx_lo_sources( const std::string& name, const size_t /*chan*/ - ) const +) const { if (name == MAGNESIUM_LO2) { return std::vector<std::string>{"internal"}; diff --git a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp index c337af2f9..29ab194be 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp @@ -156,19 +156,19 @@ public: commit(); } - ~twinrx_ctrl_impl() + ~twinrx_ctrl_impl() override { UHD_SAFE_CALL(boost::lock_guard<boost::mutex> lock(_mutex); _gpio_iface->set_field(twinrx_gpio::FIELD_SWPS_EN, 0);) } - void commit() + void commit() override { boost::lock_guard<boost::mutex> lock(_mutex); _commit(); } - void set_chan_enabled(channel_t ch, bool enabled, bool commit = true) + void set_chan_enabled(channel_t ch, bool enabled, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { @@ -189,7 +189,7 @@ public: _commit(); } - void set_preamp1(channel_t ch, preamp_state_t value, bool commit = true) + void set_preamp1(channel_t ch, preamp_state_t value, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { @@ -216,7 +216,7 @@ public: _commit(); } - void set_preamp2(channel_t ch, bool enabled, bool commit = true) + void set_preamp2(channel_t ch, bool enabled, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { @@ -233,7 +233,8 @@ public: _commit(); } - void set_lb_preamp_preselector(channel_t ch, bool enabled, bool commit = true) + void set_lb_preamp_preselector( + channel_t ch, bool enabled, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { @@ -248,7 +249,7 @@ public: _commit(); } - void set_signal_path(channel_t ch, signal_path_t path, bool commit = true) + void set_signal_path(channel_t ch, signal_path_t path, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { @@ -295,7 +296,8 @@ public: _commit(); } - void set_lb_preselector(channel_t ch, preselector_path_t path, bool commit = true) + void set_lb_preselector( + channel_t ch, preselector_path_t path, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); uint32_t sw7val = 0, sw8val = 0; @@ -331,7 +333,8 @@ public: _commit(); } - void set_hb_preselector(channel_t ch, preselector_path_t path, bool commit = true) + void set_hb_preselector( + channel_t ch, preselector_path_t path, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); uint32_t sw9ch1val = 0, sw10ch1val = 0, sw9ch2val = 0, sw10ch2val = 0; @@ -375,7 +378,7 @@ public: _commit(); } - void set_input_atten(channel_t ch, uint8_t atten, bool commit = true) + void set_input_atten(channel_t ch, uint8_t atten, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { @@ -388,7 +391,7 @@ public: _commit(); } - void set_lb_atten(channel_t ch, uint8_t atten, bool commit = true) + void set_lb_atten(channel_t ch, uint8_t atten, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { @@ -401,7 +404,7 @@ public: _commit(); } - void set_hb_atten(channel_t ch, uint8_t atten, bool commit = true) + void set_hb_atten(channel_t ch, uint8_t atten, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { @@ -414,7 +417,7 @@ public: _commit(); } - void set_lo1_source(channel_t ch, lo_source_t source, bool commit = true) + void set_lo1_source(channel_t ch, lo_source_t source, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { @@ -442,7 +445,7 @@ public: _commit(); } - void set_lo2_source(channel_t ch, lo_source_t source, bool commit = true) + void set_lo2_source(channel_t ch, lo_source_t source, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { @@ -467,7 +470,7 @@ public: _commit(); } - void set_lo1_export_source(lo_export_source_t source, bool commit = true) + void set_lo1_export_source(lo_export_source_t source, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); // SW22 may conflict with the cal switch but this attr takes priority and we @@ -481,7 +484,7 @@ public: _commit(); } - void set_lo2_export_source(lo_export_source_t source, bool commit = true) + void set_lo2_export_source(lo_export_source_t source, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); _cpld_regs->if0_reg7.set( @@ -496,7 +499,7 @@ public: _commit(); } - void set_antenna_mapping(antenna_mapping_t mapping, bool commit = true) + void set_antenna_mapping(antenna_mapping_t mapping, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); @@ -543,7 +546,7 @@ public: _commit(); } - void set_crossover_cal_mode(cal_mode_t cal_mode, bool commit = true) + void set_crossover_cal_mode(cal_mode_t cal_mode, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); if (_lo1_export == LO_CH1_SYNTH && cal_mode == CAL_CH2) { @@ -560,7 +563,7 @@ public: _commit(); } - double set_lo1_synth_freq(channel_t ch, double freq, bool commit = true) + double set_lo1_synth_freq(channel_t ch, double freq, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); @@ -581,7 +584,7 @@ public: return coerced_freq; } - double set_lo2_synth_freq(channel_t ch, double freq, bool commit = true) + double set_lo2_synth_freq(channel_t ch, double freq, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); @@ -600,7 +603,7 @@ public: return coerced_freq; } - double set_lo1_charge_pump(channel_t ch, double current, bool commit = true) + double set_lo1_charge_pump(channel_t ch, double current, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); double coerced_current = 0.0; @@ -619,7 +622,7 @@ public: return coerced_current; } - double set_lo2_charge_pump(channel_t ch, double current, bool commit = true) + double set_lo2_charge_pump(channel_t ch, double current, bool commit = true) override { boost::lock_guard<boost::mutex> lock(_mutex); double coerced_current = 0.0; @@ -638,19 +641,19 @@ public: return coerced_current; } - uhd::meta_range_t get_lo1_charge_pump_range() + uhd::meta_range_t get_lo1_charge_pump_range() override { // assume that both channels have the same range return _lo1_iface[size_t(CH1)]->get_charge_pump_current_range(); } - uhd::meta_range_t get_lo2_charge_pump_range() + uhd::meta_range_t get_lo2_charge_pump_range() override { // assume that both channels have the same range return _lo2_iface[size_t(CH1)]->get_charge_pump_current_range(); } - bool read_lo1_locked(channel_t ch) + bool read_lo1_locked(channel_t ch) override { boost::lock_guard<boost::mutex> lock(_mutex); @@ -666,7 +669,7 @@ public: return locked; } - bool read_lo2_locked(channel_t ch) + bool read_lo2_locked(channel_t ch) override { boost::lock_guard<boost::mutex> lock(_mutex); diff --git a/host/lib/usrp/mpmd/mpmd_image_loader.cpp b/host/lib/usrp/mpmd/mpmd_image_loader.cpp index 497fa14d1..145ad70c9 100644 --- a/host/lib/usrp/mpmd/mpmd_image_loader.cpp +++ b/host/lib/usrp/mpmd/mpmd_image_loader.cpp @@ -201,7 +201,7 @@ static std::string get_fpga_path( if (!dev_addr.has_key("product")) { throw uhd::runtime_error("Found a device but could not " "auto-generate an image filename."); - } else if (fpga_type == "") { + } else if (fpga_type.empty()) { return find_image_path( "usrp_" + boost::algorithm::to_lower_copy(dev_addr["product"]) + "_fpga.bit"); } else { diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp index c75b6e03a..ca5503132 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.cpp +++ b/host/lib/usrp/usrp1/codec_ctrl.cpp @@ -39,24 +39,24 @@ class usrp1_codec_ctrl_impl : public usrp1_codec_ctrl public: // structors usrp1_codec_ctrl_impl(spi_iface::sptr iface, int spi_slave); - ~usrp1_codec_ctrl_impl(void); + ~usrp1_codec_ctrl_impl(void) override; // aux adc and dac control - double read_aux_adc(aux_adc_t which); - void write_aux_dac(aux_dac_t which, double volts); + double read_aux_adc(aux_adc_t which) override; + void write_aux_dac(aux_dac_t which, double volts) override; // duc control - void set_duc_freq(double freq, double); - void enable_tx_digital(bool enb); + void set_duc_freq(double freq, double) override; + void enable_tx_digital(bool enb) override; // pga gain control - void set_tx_pga_gain(double); - double get_tx_pga_gain(void); - void set_rx_pga_gain(double, char); - double get_rx_pga_gain(char); + void set_tx_pga_gain(double) override; + double get_tx_pga_gain(void) override; + void set_rx_pga_gain(double, char) override; + double get_rx_pga_gain(char) override; // rx adc buffer control - void bypass_adc_buffers(bool bypass); + void bypass_adc_buffers(bool bypass) override; private: spi_iface::sptr _iface; diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp index 19a7fc1c5..324826dc0 100644 --- a/host/lib/usrp/usrp2/clock_ctrl.cpp +++ b/host/lib/usrp/usrp2/clock_ctrl.cpp @@ -77,7 +77,7 @@ public: this->enable_test_clock(enb_test_clk); } - ~usrp2_clock_ctrl_impl(void) + ~usrp2_clock_ctrl_impl(void) override { UHD_SAFE_CALL( // power down clock outputs @@ -89,7 +89,7 @@ public: this->enable_test_clock(false);) } - void enable_mimo_clock_out(bool enb) + void enable_mimo_clock_out(bool enb) override { // calculate the low and high dividers size_t divider = size_t(this->get_master_clock_rate() / 10e6); @@ -145,7 +145,7 @@ public: } // uses output clock 7 (cmos) - void enable_rx_dboard_clock(bool enb) + void enable_rx_dboard_clock(bool enb) override { switch (_iface->get_rev()) { case usrp2_iface::USRP_N200_R4: @@ -170,7 +170,7 @@ public: } } - void set_rate_rx_dboard_clock(double rate) + void set_rate_rx_dboard_clock(double rate) override { assert_has(get_rates_rx_dboard_clock(), rate, "rx dboard clock rate"); size_t divider = size_t(get_master_clock_rate() / rate); @@ -188,7 +188,7 @@ public: this->update_regs(); } - std::vector<double> get_rates_rx_dboard_clock(void) + std::vector<double> get_rates_rx_dboard_clock(void) override { std::vector<double> rates; for (size_t i = 1; i <= 16 + 16; i++) @@ -198,7 +198,7 @@ public: // uses output clock 6 (cmos) on USRP2, output clock 5 (cmos) on N200/N210 r3, // and output clock 5 (lvds) on N200/N210 r4 - void enable_tx_dboard_clock(bool enb) + void enable_tx_dboard_clock(bool enb) override { switch (_iface->get_rev()) { case usrp2_iface::USRP_N200_R4: @@ -236,7 +236,7 @@ public: this->update_regs(); } - void set_rate_tx_dboard_clock(double rate) + void set_rate_tx_dboard_clock(double rate) override { assert_has(get_rates_tx_dboard_clock(), rate, "tx dboard clock rate"); size_t divider = size_t(get_master_clock_rate() / rate); @@ -269,12 +269,12 @@ public: this->update_regs(); } - std::vector<double> get_rates_tx_dboard_clock(void) + std::vector<double> get_rates_tx_dboard_clock(void) override { return get_rates_rx_dboard_clock(); // same master clock, same dividers... } - void enable_test_clock(bool enb) + void enable_test_clock(bool enb) override { _ad9510_regs.power_down_lvpecl_out0 = enb ? ad9510_regs_t::POWER_DOWN_LVPECL_OUT0_NORMAL @@ -293,7 +293,7 @@ public: * If we are to use an external reference, enable the charge pump. * \param enb true to enable the CP */ - void enable_external_ref(bool enb) + void enable_external_ref(bool enb) override { _ad9510_regs.charge_pump_mode = (enb) ? ad9510_regs_t::CHARGE_PUMP_MODE_NORMAL : ad9510_regs_t::CHARGE_PUMP_MODE_3STATE; @@ -303,12 +303,12 @@ public: this->update_regs(); } - double get_master_clock_rate(void) + double get_master_clock_rate(void) override { return 100e6; } - void set_mimo_clock_delay(double delay) + void set_mimo_clock_delay(double delay) override { // delay_val is a 5-bit value (0-31) for fine control // the equations below determine delay for a given ramp current, # of caps and diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp index 6fe91da9e..bf31daf18 100644 --- a/host/lib/usrp/usrp2/codec_ctrl.cpp +++ b/host/lib/usrp/usrp2/codec_ctrl.cpp @@ -96,7 +96,7 @@ public: } } - ~usrp2_codec_ctrl_impl(void) + ~usrp2_codec_ctrl_impl(void) override { UHD_SAFE_CALL( // power-down dac @@ -124,7 +124,7 @@ public: }) } - void set_tx_mod_mode(int mod_mode) + void set_tx_mod_mode(int mod_mode) override { // set the sign of the frequency shift _ad9777_regs.modulation_form = (mod_mode > 0) @@ -153,7 +153,7 @@ public: this->send_ad9777_reg(0x01); // set the register } - void set_rx_digital_gain(double gain) + void set_rx_digital_gain(double gain) override { // fine digital gain switch (_iface->get_rev()) { case usrp2_iface::USRP_N200: @@ -169,7 +169,7 @@ public: } } - void set_rx_digital_fine_gain(double gain) + void set_rx_digital_fine_gain(double gain) override { // gain correction switch (_iface->get_rev()) { case usrp2_iface::USRP_N200: @@ -185,7 +185,7 @@ public: } } - void set_rx_analog_gain(bool /*gain*/) + void set_rx_analog_gain(bool /*gain*/) override { // turns on/off analog 3.5dB preamp switch (_iface->get_rev()) { case usrp2_iface::USRP_N200: @@ -203,7 +203,7 @@ public: } } - size_t get_tx_interpolation() const + size_t get_tx_interpolation() const override { return 4; } diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp index 55325dafc..649019a91 100644 --- a/host/lib/usrp/usrp2/dboard_iface.cpp +++ b/host/lib/usrp/usrp2/dboard_iface.cpp @@ -31,9 +31,9 @@ public: uhd::i2c_iface::sptr i2c_iface, uhd::spi_iface::sptr spi_iface, usrp2_clock_ctrl::sptr clock_ctrl); - ~usrp2_dboard_iface(void); + ~usrp2_dboard_iface(void) override; - special_props_t get_special_props(void) + special_props_t get_special_props(void) override { special_props_t props; props.soft_clock_divider = false; @@ -41,39 +41,39 @@ public: return props; } - void write_aux_dac(unit_t, aux_dac_t, double); - double read_aux_adc(unit_t, aux_adc_t); + void write_aux_dac(unit_t, aux_dac_t, double) override; + double read_aux_adc(unit_t, aux_adc_t) override; - void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_pin_ctrl(unit_t unit); + void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_pin_ctrl(unit_t unit) override; void set_atr_reg( - unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_atr_reg(unit_t unit, atr_reg_t reg); - void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_gpio_ddr(unit_t unit); - void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff); - uint32_t get_gpio_out(unit_t unit); - uint32_t read_gpio(unit_t unit); - - void set_command_time(const uhd::time_spec_t& t); - uhd::time_spec_t get_command_time(void); - - void write_i2c(uint16_t, const byte_vector_t&); - byte_vector_t read_i2c(uint16_t, size_t); - - void set_clock_rate(unit_t, double); - double get_clock_rate(unit_t); - std::vector<double> get_clock_rates(unit_t); - void set_clock_enabled(unit_t, bool); - double get_codec_rate(unit_t); + unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_atr_reg(unit_t unit, atr_reg_t reg) override; + void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_gpio_ddr(unit_t unit) override; + void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffffffff) override; + uint32_t get_gpio_out(unit_t unit) override; + uint32_t read_gpio(unit_t unit) override; + + void set_command_time(const uhd::time_spec_t& t) override; + uhd::time_spec_t get_command_time(void) override; + + void write_i2c(uint16_t, const byte_vector_t&) override; + byte_vector_t read_i2c(uint16_t, size_t) override; + + void set_clock_rate(unit_t, double) override; + double get_clock_rate(unit_t) override; + std::vector<double> get_clock_rates(unit_t) override; + void set_clock_enabled(unit_t, bool) override; + double get_codec_rate(unit_t) override; void set_fe_connection( - unit_t unit, const std::string&, const fe_connection_t& fe_conn); + unit_t unit, const std::string&, const fe_connection_t& fe_conn) override; void write_spi( - unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits); + unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) override; uint32_t read_write_spi( - unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits); + unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) override; private: timed_wb_iface::sptr _wb_iface; diff --git a/host/lib/usrp/x300/x300_adc_ctrl.cpp b/host/lib/usrp/x300/x300_adc_ctrl.cpp index 26c1d85ff..afc581ce6 100644 --- a/host/lib/usrp/x300/x300_adc_ctrl.cpp +++ b/host/lib/usrp/x300/x300_adc_ctrl.cpp @@ -70,12 +70,12 @@ public: this->send_ads62p48_reg(0x76); } - void reset() + void reset() override { init(); } - double set_gain(const double& gain) + double set_gain(const double& gain) override { const meta_range_t gain_range = meta_range_t(0, 6.0, 0.5); const int gain_bits = int((gain_range.clip(gain) * 2.0) + 0.5); @@ -86,8 +86,9 @@ public: return gain_bits / 2; } - void set_test_word( - const std::string& patterna, const std::string& patternb, const uint32_t num) + void set_test_word(const std::string& patterna, + const std::string& patternb, + const uint32_t num) override { _ads62p48_regs.custom_pattern_low = num & 0xff; _ads62p48_regs.custom_pattern_high = num >> 8; @@ -117,7 +118,7 @@ public: this->send_ads62p48_reg(0x75); } - ~x300_adc_ctrl_impl(void) + ~x300_adc_ctrl_impl(void) override { _ads62p48_regs.power_down = ads62p48_regs_t::POWER_DOWN_GLOBAL; UHD_SAFE_CALL(this->send_ads62p48_reg(0x40);) diff --git a/host/lib/usrp/x300/x300_clock_ctrl.cpp b/host/lib/usrp/x300/x300_clock_ctrl.cpp index 9b54b001b..6452df365 100644 --- a/host/lib/usrp/x300/x300_clock_ctrl.cpp +++ b/host/lib/usrp/x300/x300_clock_ctrl.cpp @@ -70,7 +70,7 @@ x300_clock_ctrl::~x300_clock_ctrl(void) class x300_clock_ctrl_impl : public x300_clock_ctrl { public: - ~x300_clock_ctrl_impl(void) {} + ~x300_clock_ctrl_impl(void) override {} x300_clock_ctrl_impl(uhd::spi_iface::sptr spiface, const size_t slaveno, @@ -88,7 +88,7 @@ public: init(); } - void reset_clocks() + void reset_clocks() override { _lmk04816_regs.RESET = lmk04816_regs_t::RESET_RESET; this->write_regs(0); @@ -113,23 +113,23 @@ public: this->write_regs(11); } - double get_master_clock_rate(void) + double get_master_clock_rate(void) override { return _master_clock_rate; } - double get_sysref_clock_rate(void) + double get_sysref_clock_rate(void) override { return _system_ref_rate; } - double get_refout_clock_rate(void) + double get_refout_clock_rate(void) override { // We support only one reference output rate return X300_REF_CLK_OUT_RATE; } - void set_dboard_rate(const x300_clock_which_t which, double rate) + void set_dboard_rate(const x300_clock_which_t which, double rate) override { uint16_t div = uint16_t(_vco_freq / rate); uint16_t* reg = NULL; @@ -174,7 +174,7 @@ public: sync_clocks(); } - double get_dboard_rate(const x300_clock_which_t which) + double get_dboard_rate(const x300_clock_which_t which) override { double rate = 0.0; switch (which) { @@ -192,7 +192,7 @@ public: return rate; } - std::vector<double> get_dboard_rates(const x300_clock_which_t) + std::vector<double> get_dboard_rates(const x300_clock_which_t) override { std::vector<double> rates; for (size_t div = size_t(_vco_freq / _master_clock_rate); @@ -202,7 +202,7 @@ public: return rates; } - void enable_dboard_clock(const x300_clock_which_t which, const bool enable) + void enable_dboard_clock(const x300_clock_which_t which, const bool enable) override { switch (which) { case X300_CLOCK_WHICH_DB0_RX: @@ -250,7 +250,7 @@ public: } } - void set_ref_out(const bool enable) + void set_ref_out(const bool enable) override { // TODO Implement divider configuration to allow for configurable output // rates @@ -267,8 +267,9 @@ public: _spiface->write_spi(_slaveno, spi_config_t::EDGE_RISE, data, 32); } - double set_clock_delay( - const x300_clock_which_t which, const double delay_ns, const bool resync = true) + double set_clock_delay(const x300_clock_which_t which, + const double delay_ns, + const bool resync = true) override { // All dividers have are delayed by 5 taps by default. The delay // set by this function is relative to the 5 tap delay @@ -461,7 +462,7 @@ public: return coerced_delay; } - double get_clock_delay(const x300_clock_which_t which) + double get_clock_delay(const x300_clock_which_t which) override { switch (which) { case X300_CLOCK_WHICH_FPGA: diff --git a/host/lib/usrp/x300/x300_radio_control.cpp b/host/lib/usrp/x300/x300_radio_control.cpp index 36813d044..3ab60e661 100644 --- a/host/lib/usrp/x300/x300_radio_control.cpp +++ b/host/lib/usrp/x300/x300_radio_control.cpp @@ -219,7 +219,7 @@ public: } } /* ctor */ - ~x300_radio_control_impl() + ~x300_radio_control_impl() override { // nop } @@ -227,7 +227,7 @@ public: /************************************************************************** * Radio API calls *************************************************************************/ - double set_rate(double rate) + double set_rate(double rate) override { // On X3x0, tick rate can't actually be changed at runtime const double actual_rate = get_rate(); @@ -239,7 +239,7 @@ public: return actual_rate; } - void set_tx_antenna(const std::string& ant, const size_t chan) + void set_tx_antenna(const std::string& ant, const size_t chan) override { // Antenna changes may result in a change of streaming mode for LF/Basic dboards if (_basic_lf_tx) { @@ -256,14 +256,14 @@ public: .set(ant); } - std::string get_tx_antenna(const size_t chan) const + std::string get_tx_antenna(const size_t chan) const override { return get_tree() ->access<std::string>(get_db_path("tx", chan) / "antenna" / "value") .get(); } - std::vector<std::string> get_tx_antennas(size_t chan) const + std::vector<std::string> get_tx_antennas(size_t chan) const override { return get_tree() ->access<std::vector<std::string>>( @@ -271,7 +271,7 @@ public: .get(); } - void set_rx_antenna(const std::string& ant, const size_t chan) + void set_rx_antenna(const std::string& ant, const size_t chan) override { // Antenna changes may result in a change of streaming mode for LF/Basic dboards if (_basic_lf_rx) { @@ -290,14 +290,14 @@ public: .set(ant); } - std::string get_rx_antenna(const size_t chan) const + std::string get_rx_antenna(const size_t chan) const override { return get_tree() ->access<std::string>(get_db_path("rx", chan) / "antenna" / "value") .get(); } - std::vector<std::string> get_rx_antennas(size_t chan) const + std::vector<std::string> get_rx_antennas(size_t chan) const override { return get_tree() ->access<std::vector<std::string>>( @@ -305,7 +305,7 @@ public: .get(); } - double set_tx_frequency(const double freq, const size_t chan) + double set_tx_frequency(const double freq, const size_t chan) override { return get_tree() ->access<double>(get_db_path("tx", chan) / "freq" / "value") @@ -313,7 +313,7 @@ public: .get(); } - void set_tx_tune_args(const uhd::device_addr_t& tune_args, const size_t chan) + void set_tx_tune_args(const uhd::device_addr_t& tune_args, const size_t chan) override { if (get_tree()->exists(get_db_path("tx", chan) / "tune_args")) { get_tree() @@ -322,14 +322,14 @@ public: } } - double get_tx_frequency(const size_t chan) + double get_tx_frequency(const size_t chan) override { return get_tree() ->access<double>(get_db_path("tx", chan) / "freq" / "value") .get(); } - double set_rx_frequency(const double freq, const size_t chan) + double set_rx_frequency(const double freq, const size_t chan) override { RFNOC_LOG_TRACE( "set_rx_frequency(freq=" << (freq / 1e6) << " MHz, chan=" << chan << ")"); @@ -339,7 +339,7 @@ public: .get(); } - void set_rx_tune_args(const uhd::device_addr_t& tune_args, const size_t chan) + void set_rx_tune_args(const uhd::device_addr_t& tune_args, const size_t chan) override { if (get_tree()->exists(get_db_path("rx", chan) / "tune_args")) { get_tree() @@ -348,21 +348,21 @@ public: } } - double get_rx_frequency(const size_t chan) + double get_rx_frequency(const size_t chan) override { return get_tree() ->access<double>(get_db_path("rx", chan) / "freq" / "value") .get(); } - uhd::freq_range_t get_tx_frequency_range(const size_t chan) const + uhd::freq_range_t get_tx_frequency_range(const size_t chan) const override { return get_tree() ->access<uhd::freq_range_t>(get_db_path("tx", chan) / "freq" / "range") .get(); } - uhd::freq_range_t get_rx_frequency_range(const size_t chan) const + uhd::freq_range_t get_rx_frequency_range(const size_t chan) const override { return get_tree() ->access<uhd::meta_range_t>(get_db_path("rx", chan) / "freq" / "range") @@ -370,7 +370,7 @@ public: } /*** Bandwidth-Related APIs************************************************/ - double set_rx_bandwidth(const double bandwidth, const size_t chan) + double set_rx_bandwidth(const double bandwidth, const size_t chan) override { return get_tree() ->access<double>(get_db_path("rx", chan) / "bandwidth" / "value") @@ -378,21 +378,21 @@ public: .get(); } - double get_rx_bandwidth(const size_t chan) + double get_rx_bandwidth(const size_t chan) override { return get_tree() ->access<double>(get_db_path("rx", chan) / "bandwidth" / "value") .get(); } - uhd::meta_range_t get_rx_bandwidth_range(size_t chan) const + uhd::meta_range_t get_rx_bandwidth_range(size_t chan) const override { return get_tree() ->access<uhd::meta_range_t>(get_db_path("rx", chan) / "bandwidth" / "range") .get(); } - double set_tx_bandwidth(const double bandwidth, const size_t chan) + double set_tx_bandwidth(const double bandwidth, const size_t chan) override { return get_tree() ->access<double>(get_db_path("tx", chan) / "bandwidth" / "value") @@ -400,14 +400,14 @@ public: .get(); } - double get_tx_bandwidth(const size_t chan) + double get_tx_bandwidth(const size_t chan) override { return get_tree() ->access<double>(get_db_path("tx", chan) / "bandwidth" / "value") .get(); } - uhd::meta_range_t get_tx_bandwidth_range(size_t chan) const + uhd::meta_range_t get_tx_bandwidth_range(size_t chan) const override { return get_tree() ->access<uhd::meta_range_t>(get_db_path("tx", chan) / "bandwidth" / "range") @@ -415,12 +415,13 @@ public: } /*** Gain-Related APIs ***************************************************/ - double set_tx_gain(const double gain, const size_t chan) + double set_tx_gain(const double gain, const size_t chan) override { return set_tx_gain(gain, ALL_GAINS, chan); } - double set_tx_gain(const double gain, const std::string& name, const size_t chan) + double set_tx_gain( + const double gain, const std::string& name, const size_t chan) override { _tx_pwr_mgr.at(chan)->set_tracking_mode(pwr_cal_mgr::tracking_mode::TRACK_GAIN); if (_tx_gain_groups.count(chan)) { @@ -431,12 +432,13 @@ public: return radio_control_impl::set_tx_gain(0.0, chan); } - double set_rx_gain(const double gain, const size_t chan) + double set_rx_gain(const double gain, const size_t chan) override { return set_rx_gain(gain, ALL_GAINS, chan); } - double set_rx_gain(const double gain, const std::string& name, const size_t chan) + double set_rx_gain( + const double gain, const std::string& name, const size_t chan) override { _rx_pwr_mgr.at(chan)->set_tracking_mode(pwr_cal_mgr::tracking_mode::TRACK_GAIN); auto& gg = _rx_gain_groups.at(chan); @@ -444,42 +446,43 @@ public: return radio_control_impl::set_rx_gain(gg->get_value(name), chan); } - double get_rx_gain(const size_t chan) + double get_rx_gain(const size_t chan) override { return get_rx_gain(ALL_GAINS, chan); } - double get_rx_gain(const std::string& name, const size_t chan) + double get_rx_gain(const std::string& name, const size_t chan) override { return _rx_gain_groups.at(chan)->get_value(name); } - double get_tx_gain(const size_t chan) + double get_tx_gain(const size_t chan) override { return get_tx_gain(ALL_GAINS, chan); } - double get_tx_gain(const std::string& name, const size_t chan) + double get_tx_gain(const std::string& name, const size_t chan) override { return _tx_gain_groups.at(chan)->get_value(name); } - std::vector<std::string> get_tx_gain_names(const size_t chan) const + std::vector<std::string> get_tx_gain_names(const size_t chan) const override { return _tx_gain_groups.at(chan)->get_names(); } - std::vector<std::string> get_rx_gain_names(const size_t chan) const + std::vector<std::string> get_rx_gain_names(const size_t chan) const override { return _rx_gain_groups.at(chan)->get_names(); } - uhd::gain_range_t get_tx_gain_range(const size_t chan) const + uhd::gain_range_t get_tx_gain_range(const size_t chan) const override { return get_tx_gain_range(ALL_GAINS, chan); } - uhd::gain_range_t get_tx_gain_range(const std::string& name, const size_t chan) const + uhd::gain_range_t get_tx_gain_range( + const std::string& name, const size_t chan) const override { if (!_tx_gain_groups.count(chan)) { throw uhd::index_error( @@ -488,12 +491,13 @@ public: return _tx_gain_groups.at(chan)->get_range(name); } - uhd::gain_range_t get_rx_gain_range(const size_t chan) const + uhd::gain_range_t get_rx_gain_range(const size_t chan) const override { return get_rx_gain_range(ALL_GAINS, chan); } - uhd::gain_range_t get_rx_gain_range(const std::string& name, const size_t chan) const + uhd::gain_range_t get_rx_gain_range( + const std::string& name, const size_t chan) const override { if (!_rx_gain_groups.count(chan)) { throw uhd::index_error( @@ -502,7 +506,7 @@ public: return _rx_gain_groups.at(chan)->get_range(name); } - std::vector<std::string> get_tx_gain_profile_names(const size_t chan) const + std::vector<std::string> get_tx_gain_profile_names(const size_t chan) const override { return get_tree() ->access<std::vector<std::string>>( @@ -510,7 +514,7 @@ public: .get(); } - std::vector<std::string> get_rx_gain_profile_names(const size_t chan) const + std::vector<std::string> get_rx_gain_profile_names(const size_t chan) const override { return get_tree() ->access<std::vector<std::string>>( @@ -519,14 +523,14 @@ public: } - void set_tx_gain_profile(const std::string& profile, const size_t chan) + void set_tx_gain_profile(const std::string& profile, const size_t chan) override { get_tree() ->access<std::string>(get_db_path("tx", chan) / "gains/all/profile/value") .set(profile); } - void set_rx_gain_profile(const std::string& profile, const size_t chan) + void set_rx_gain_profile(const std::string& profile, const size_t chan) override { get_tree() ->access<std::string>(get_db_path("rx", chan) / "gains/all/profile/value") @@ -534,14 +538,14 @@ public: } - std::string get_tx_gain_profile(const size_t chan) const + std::string get_tx_gain_profile(const size_t chan) const override { return get_tree() ->access<std::string>(get_db_path("tx", chan) / "gains/all/profile/value") .get(); } - std::string get_rx_gain_profile(const size_t chan) const + std::string get_rx_gain_profile(const size_t chan) const override { return get_tree() ->access<std::string>(get_db_path("rx", chan) / "gains/all/profile/value") @@ -551,7 +555,7 @@ public: /************************************************************************** * LO controls *************************************************************************/ - std::vector<std::string> get_rx_lo_names(const size_t chan) const + std::vector<std::string> get_rx_lo_names(const size_t chan) const override { fs_path rx_fe_fe_root = get_db_path("rx", chan); std::vector<std::string> lo_names; @@ -564,7 +568,7 @@ public: } std::vector<std::string> get_rx_lo_sources( - const std::string& name, const size_t chan) const + const std::string& name, const size_t chan) const override { fs_path rx_fe_fe_root = get_db_path("rx", chan); @@ -597,7 +601,7 @@ public: } void set_rx_lo_source( - const std::string& src, const std::string& name, const size_t chan) + const std::string& src, const std::string& name, const size_t chan) override { fs_path rx_fe_fe_root = get_db_path("rx", chan); @@ -631,7 +635,8 @@ public: } } - const std::string get_rx_lo_source(const std::string& name, const size_t chan) + const std::string get_rx_lo_source( + const std::string& name, const size_t chan) override { fs_path rx_fe_fe_root = get_db_path("rx", chan); @@ -659,7 +664,7 @@ public: } void set_rx_lo_export_enabled( - bool enabled, const std::string& name, const size_t chan) + bool enabled, const std::string& name, const size_t chan) override { fs_path rx_fe_fe_root = get_db_path("rx", chan); @@ -691,7 +696,8 @@ public: } } - bool get_rx_lo_export_enabled(const std::string& name, const size_t chan) const + bool get_rx_lo_export_enabled( + const std::string& name, const size_t chan) const override { fs_path rx_fe_fe_root = get_db_path("rx", chan); @@ -716,7 +722,8 @@ public: } } - double set_rx_lo_freq(double freq, const std::string& name, const size_t chan) + double set_rx_lo_freq( + double freq, const std::string& name, const size_t chan) override { fs_path rx_fe_fe_root = get_db_path("rx", chan); @@ -742,7 +749,7 @@ public: } } - double get_rx_lo_freq(const std::string& name, const size_t chan) + double get_rx_lo_freq(const std::string& name, const size_t chan) override { fs_path rx_fe_fe_root = get_db_path("rx", chan); @@ -765,7 +772,8 @@ public: } } - freq_range_t get_rx_lo_freq_range(const std::string& name, const size_t chan) const + freq_range_t get_rx_lo_freq_range( + const std::string& name, const size_t chan) const override { fs_path rx_fe_fe_root = get_db_path("rx", chan); @@ -792,7 +800,7 @@ public: } /*** Calibration API *****************************************************/ - void set_tx_dc_offset(const std::complex<double>& offset, size_t chan) + void set_tx_dc_offset(const std::complex<double>& offset, size_t chan) override { const fs_path dc_offset_path = get_fe_path("tx", chan) / "dc_offset" / "value"; if (get_tree()->exists(dc_offset_path)) { @@ -802,7 +810,7 @@ public: } } - meta_range_t get_tx_dc_offset_range(size_t chan) const + meta_range_t get_tx_dc_offset_range(size_t chan) const override { const fs_path range_path = get_fe_path("tx", chan) / "dc_offset" / "range"; if (get_tree()->exists(range_path)) { @@ -814,7 +822,7 @@ public: } } - void set_tx_iq_balance(const std::complex<double>& correction, size_t chan) + void set_tx_iq_balance(const std::complex<double>& correction, size_t chan) override { const fs_path iq_balance_path = get_fe_path("tx", chan) / "iq_balance" / "value"; if (get_tree()->exists(iq_balance_path)) { @@ -824,7 +832,7 @@ public: } } - void set_rx_dc_offset(const bool enb, size_t chan) + void set_rx_dc_offset(const bool enb, size_t chan) override { const fs_path dc_offset_path = get_fe_path("rx", chan) / "dc_offset" / "enable"; if (get_tree()->exists(dc_offset_path)) { @@ -835,7 +843,7 @@ public: } } - void set_rx_dc_offset(const std::complex<double>& offset, size_t chan) + void set_rx_dc_offset(const std::complex<double>& offset, size_t chan) override { const fs_path dc_offset_path = get_fe_path("rx", chan) / "dc_offset" / "value"; if (get_tree()->exists(dc_offset_path)) { @@ -845,7 +853,7 @@ public: } } - meta_range_t get_rx_dc_offset_range(size_t chan) const + meta_range_t get_rx_dc_offset_range(size_t chan) const override { const fs_path range_path = get_fe_path("rx", chan) / "dc_offset" / "range"; if (get_tree()->exists(range_path)) { @@ -857,7 +865,7 @@ public: } } - void set_rx_iq_balance(const bool enb, size_t chan) + void set_rx_iq_balance(const bool enb, size_t chan) override { const fs_path iq_balance_path = get_fe_path("rx", chan) / "iq_balance" / "enable"; if (get_tree()->exists(iq_balance_path)) { @@ -867,7 +875,7 @@ public: } } - void set_rx_iq_balance(const std::complex<double>& correction, size_t chan) + void set_rx_iq_balance(const std::complex<double>& correction, size_t chan) override { const fs_path iq_balance_path = get_fe_path("rx", chan) / "iq_balance" / "value"; if (get_tree()->exists(iq_balance_path)) { @@ -878,13 +886,13 @@ public: } /*** GPIO API ************************************************************/ - std::vector<std::string> get_gpio_banks() const + std::vector<std::string> get_gpio_banks() const override { return {"RX", "TX", "FP0"}; } void set_gpio_attr( - const std::string& bank, const std::string& attr, const uint32_t value) + const std::string& bank, const std::string& attr, const uint32_t value) override { if (bank == "FP0") { _fp_gpio->set_gpio_attr(usrp::gpio_atr::gpio_attr_rev_map.at(attr), value); @@ -921,7 +929,7 @@ public: << "'. Ignoring call to set_gpio_attr() to retain backward compatibility."); } - uint32_t get_gpio_attr(const std::string& bank, const std::string& attr) + uint32_t get_gpio_attr(const std::string& bank, const std::string& attr) override { if (bank == "FP0") { return _fp_gpio->get_attr_reg(usrp::gpio_atr::gpio_attr_rev_map.at(attr)); @@ -959,7 +967,7 @@ public: /************************************************************************** * Sensor API *************************************************************************/ - std::vector<std::string> get_rx_sensor_names(size_t chan) const + std::vector<std::string> get_rx_sensor_names(size_t chan) const override { const fs_path sensor_path = get_db_path("rx", chan) / "sensors"; if (get_tree()->exists(sensor_path)) { @@ -968,14 +976,14 @@ public: return {}; } - uhd::sensor_value_t get_rx_sensor(const std::string& name, size_t chan) + uhd::sensor_value_t get_rx_sensor(const std::string& name, size_t chan) override { return get_tree() ->access<uhd::sensor_value_t>(get_db_path("rx", chan) / "sensors" / name) .get(); } - std::vector<std::string> get_tx_sensor_names(size_t chan) const + std::vector<std::string> get_tx_sensor_names(size_t chan) const override { const fs_path sensor_path = get_db_path("tx", chan) / "sensors"; if (get_tree()->exists(sensor_path)) { @@ -984,7 +992,7 @@ public: return {}; } - uhd::sensor_value_t get_tx_sensor(const std::string& name, size_t chan) + uhd::sensor_value_t get_tx_sensor(const std::string& name, size_t chan) override { return get_tree() ->access<uhd::sensor_value_t>(get_db_path("tx", chan) / "sensors" / name) @@ -994,7 +1002,7 @@ public: /************************************************************************** * EEPROM API *************************************************************************/ - void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom) + void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom) override { const std::string key_prefix = db_eeprom.count("rx_id") ? "rx_" : "tx_"; const std::string id_key = key_prefix + "id"; @@ -1021,7 +1029,7 @@ public: } - uhd::eeprom_map_t get_db_eeprom() + uhd::eeprom_map_t get_db_eeprom() override { uhd::eeprom_map_t result; if (get_tree()->exists(DB_PATH / "rx_eeprom")) { @@ -1044,13 +1052,13 @@ public: /************************************************************************** * Radio Identification API Calls *************************************************************************/ - std::string get_slot_name() const + std::string get_slot_name() const override { return _radio_type == PRIMARY ? "A" : "B"; } size_t get_chan_from_dboard_fe( - const std::string& fe, const uhd::direction_t direction) const + const std::string& fe, const uhd::direction_t direction) const override { switch (direction) { case uhd::TX_DIRECTION: @@ -1063,7 +1071,7 @@ public: } std::string get_dboard_fe_from_chan( - const size_t chan, const uhd::direction_t direction) const + const size_t chan, const uhd::direction_t direction) const override { switch (direction) { case uhd::TX_DIRECTION: @@ -1075,7 +1083,8 @@ public: } } - std::string get_fe_name(const size_t chan, const uhd::direction_t direction) const + std::string get_fe_name( + const size_t chan, const uhd::direction_t direction) const override { fs_path name_path = get_db_path(direction == uhd::RX_DIRECTION ? "rx" : "tx", chan) / "name"; @@ -1087,7 +1096,7 @@ public: } - virtual void set_command_time(uhd::time_spec_t time, const size_t chan) + void set_command_time(uhd::time_spec_t time, const size_t chan) override { node_t::set_command_time(time, chan); // This is for TwinRX only: @@ -1100,30 +1109,31 @@ public: /************************************************************************** * MB Interface API Calls *************************************************************************/ - uint32_t get_adc_rx_word() + uint32_t get_adc_rx_word() override { return regs().peek32(regmap::RADIO_BASE_ADDR + regmap::REG_RX_DATA); } - void set_adc_test_word(const std::string& patterna, const std::string& patternb) + void set_adc_test_word( + const std::string& patterna, const std::string& patternb) override { _adc->set_test_word(patterna, patternb); } - void set_adc_checker_enabled(const bool enb) + void set_adc_checker_enabled(const bool enb) override { _regs->misc_outs_reg.write( radio_regmap_t::misc_outs_reg_t::ADC_CHECKER_ENABLED, enb ? 1 : 0); } - bool get_adc_checker_locked(const bool I) + bool get_adc_checker_locked(const bool I) override { return bool(_regs->misc_ins_reg.read( I ? radio_regmap_t::misc_ins_reg_t::ADC_CHECKER1_I_LOCKED : radio_regmap_t::misc_ins_reg_t::ADC_CHECKER1_Q_LOCKED)); } - uint32_t get_adc_checker_error_code(const bool I) + uint32_t get_adc_checker_error_code(const bool I) override { return _regs->misc_ins_reg.get( I ? radio_regmap_t::misc_ins_reg_t::ADC_CHECKER1_I_ERROR @@ -1131,7 +1141,7 @@ public: } // Documented in x300_radio_mbc_iface.hpp - void self_test_adc(const uint32_t ramp_time_ms) + void self_test_adc(const uint32_t ramp_time_ms) override { RFNOC_LOG_DEBUG("Running ADC self-cal..."); // Bypass all front-end corrections @@ -1208,12 +1218,12 @@ public: } } - void sync_dac() + void sync_dac() override { _dac->sync(); } - void set_dac_sync(const bool enb, const uhd::time_spec_t& time) + void set_dac_sync(const bool enb, const uhd::time_spec_t& time) override { if (time != uhd::time_spec_t(0.0)) { set_command_time(time, 0); @@ -1225,7 +1235,7 @@ public: } } - void dac_verify_sync() + void dac_verify_sync() override { _dac->verify_sync(); } @@ -1816,7 +1826,7 @@ private: //! Safely shut down all peripherals // // Reminder: After this is called, no peeks and pokes are allowed! - void deinit() + void deinit() override { RFNOC_LOG_TRACE("deinit()"); // Reset daughterboard @@ -1840,7 +1850,7 @@ private: } bool check_topology(const std::vector<size_t>& connected_inputs, - const std::vector<size_t>& connected_outputs) + const std::vector<size_t>& connected_outputs) override { RFNOC_LOG_TRACE("check_topology()"); if (!node_t::check_topology(connected_inputs, connected_outputs)) { diff --git a/host/tests/rf_control_gain_profile_test.cpp b/host/tests/rf_control_gain_profile_test.cpp index 90260be1c..292983cee 100644 --- a/host/tests/rf_control_gain_profile_test.cpp +++ b/host/tests/rf_control_gain_profile_test.cpp @@ -12,12 +12,11 @@ using namespace uhd::rfnoc::rf_control; void test_profile_invariant(gain_profile_iface& gain_profile) { - BOOST_CHECK(gain_profile.get_gain_profile_names(0).size() > 0); - for (auto& profile : gain_profile.get_gain_profile_names(0)) - { - gain_profile.set_gain_profile(profile, 0); - BOOST_CHECK(gain_profile.get_gain_profile(0) == profile); - } + BOOST_CHECK(!gain_profile.get_gain_profile_names(0).empty()); + for (auto& profile : gain_profile.get_gain_profile_names(0)) { + gain_profile.set_gain_profile(profile, 0); + BOOST_CHECK(gain_profile.get_gain_profile(0) == profile); + } } BOOST_AUTO_TEST_CASE(test_default_profile_get_set) |