diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-11-12 12:14:08 +0100 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-01-11 15:34:51 -0600 |
commit | 084e00c425ed6c861885ca704086825f28fe48c4 (patch) | |
tree | 5d9ef7cfbf1fa6d8644281be6713d28c0f6fc5ec /host/lib/usrp | |
parent | 57635b69e165b01ababfa064c5f0ccf405582f31 (diff) | |
download | uhd-084e00c425ed6c861885ca704086825f28fe48c4.tar.gz uhd-084e00c425ed6c861885ca704086825f28fe48c4.tar.bz2 uhd-084e00c425ed6c861885ca704086825f28fe48c4.zip |
x300: clang-format
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/x300/x300_clock_ctrl.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_device_args.hpp | 24 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_eth_mgr.cpp | 24 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_image_loader.cpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_mb_controller.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_mb_controller.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_mb_eeprom.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_mb_iface.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_pcie_mgr.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_radio_control.cpp | 37 |
10 files changed, 65 insertions, 61 deletions
diff --git a/host/lib/usrp/x300/x300_clock_ctrl.cpp b/host/lib/usrp/x300/x300_clock_ctrl.cpp index 004c5df3c..e80335d9b 100644 --- a/host/lib/usrp/x300/x300_clock_ctrl.cpp +++ b/host/lib/usrp/x300/x300_clock_ctrl.cpp @@ -207,7 +207,7 @@ public: case X300_CLOCK_WHICH_DB0_RX: if (enable != (_lmk04816_regs.CLKout2_TYPE - == lmk04816_regs_t::CLKOUT2_TYPE_LVPECL_700MVPP)) { + == lmk04816_regs_t::CLKOUT2_TYPE_LVPECL_700MVPP)) { _lmk04816_regs.CLKout2_TYPE = enable ? lmk04816_regs_t::CLKOUT2_TYPE_LVPECL_700MVPP : lmk04816_regs_t::CLKOUT2_TYPE_P_DOWN; @@ -217,7 +217,7 @@ public: case X300_CLOCK_WHICH_DB1_RX: if (enable != (_lmk04816_regs.CLKout3_TYPE - == lmk04816_regs_t::CLKOUT3_TYPE_LVPECL_700MVPP)) { + == lmk04816_regs_t::CLKOUT3_TYPE_LVPECL_700MVPP)) { _lmk04816_regs.CLKout3_TYPE = enable ? lmk04816_regs_t::CLKOUT3_TYPE_LVPECL_700MVPP : lmk04816_regs_t::CLKOUT3_TYPE_P_DOWN; @@ -227,7 +227,7 @@ public: case X300_CLOCK_WHICH_DB0_TX: if (enable != (_lmk04816_regs.CLKout5_TYPE - == lmk04816_regs_t::CLKOUT5_TYPE_LVPECL_700MVPP)) { + == lmk04816_regs_t::CLKOUT5_TYPE_LVPECL_700MVPP)) { _lmk04816_regs.CLKout5_TYPE = enable ? lmk04816_regs_t::CLKOUT5_TYPE_LVPECL_700MVPP : lmk04816_regs_t::CLKOUT5_TYPE_P_DOWN; @@ -237,7 +237,7 @@ public: case X300_CLOCK_WHICH_DB1_TX: if (enable != (_lmk04816_regs.CLKout4_TYPE - == lmk04816_regs_t::CLKOUT4_TYPE_LVPECL_700MVPP)) { + == lmk04816_regs_t::CLKOUT4_TYPE_LVPECL_700MVPP)) { _lmk04816_regs.CLKout4_TYPE = enable ? lmk04816_regs_t::CLKOUT4_TYPE_LVPECL_700MVPP : lmk04816_regs_t::CLKOUT4_TYPE_P_DOWN; @@ -698,8 +698,8 @@ private: _lmk04816_regs.MODE = lmk04816_regs_t::MODE_DUAL_INT; // PLL1 - 2 MHz compare frequency - _lmk04816_regs.PLL1_N_28 = 48; - _lmk04816_regs.PLL1_R_27 = 5; + _lmk04816_regs.PLL1_N_28 = 48; + _lmk04816_regs.PLL1_R_27 = 5; // Since this is not a zero-dealy mode, it is not intended for phase // synchronization. The charge pump current for PLL1 is lowered to // reduce phase noise. diff --git a/host/lib/usrp/x300/x300_device_args.hpp b/host/lib/usrp/x300/x300_device_args.hpp index 3a620f7de..4b8696ac2 100644 --- a/host/lib/usrp/x300/x300_device_args.hpp +++ b/host/lib/usrp/x300/x300_device_args.hpp @@ -154,29 +154,29 @@ public: + _master_clock_rate.to_string() + ", " + _dboard_clock_rate.to_string() + ", " + (_system_ref_rate.get() != DEFAULT_SYSREF_RATE - ? (_system_ref_rate.to_string() + ", ") - : "") + ? (_system_ref_rate.to_string() + ", ") + : "") + (_time_source.get() != DEFAULT_TIME_SOURCE - ? (_time_source.to_string() + ", ") - : "") + ? (_time_source.to_string() + ", ") + : "") + (_clock_source.get() != DEFAULT_CLOCK_SOURCE - ? (_clock_source.to_string() + ", ") - : "") + ? (_clock_source.to_string() + ", ") + : "") + (_resource.get().empty() ? "" : (_resource.to_string() + ", ")) + (_self_cal_adc_delay.get() ? (_self_cal_adc_delay.to_string() + ", ") : "") + (_ext_adc_self_test.get() ? (_ext_adc_self_test.to_string() + ", ") : "") + (_ext_adc_self_test.get() - && (_ext_adc_self_test_duration.get() - != DEFAULT_EXT_ADC_SELF_TEST_DURATION) - ? (_ext_adc_self_test.to_string() + ", ") - : "") + && (_ext_adc_self_test_duration.get() + != DEFAULT_EXT_ADC_SELF_TEST_DURATION) + ? (_ext_adc_self_test.to_string() + ", ") + : "") + (_recover_mb_eeprom.get() ? (_recover_mb_eeprom.to_string() + ", ") : "") + (_ignore_cal_file.get() ? (_ignore_cal_file.to_string() + ", ") : "") + ((!_resource.get().empty() && _niusrprio_rpc_port.get() != NIUSRPRIO_DEFAULT_RPC_PORT) - ? (_niusrprio_rpc_port.to_string() + ", ") - : "") + ? (_niusrprio_rpc_port.to_string() + ", ") + : "") + (_has_fw_file.get() ? _fw_file.to_string() + ", " : "") + (_enable_tx_dual_eth.get() ? (_enable_tx_dual_eth.to_string() + ", ") : "") diff --git a/host/lib/usrp/x300/x300_eth_mgr.cpp b/host/lib/usrp/x300/x300_eth_mgr.cpp index 34890ba1c..9cddd2996 100644 --- a/host/lib/usrp/x300/x300_eth_mgr.cpp +++ b/host/lib/usrp/x300/x300_eth_mgr.cpp @@ -44,11 +44,11 @@ namespace asio = boost::asio; namespace { -constexpr size_t XGE_DATA_FRAME_SEND_SIZE = x300::DATA_FRAME_MAX_SIZE; -constexpr size_t XGE_DATA_FRAME_RECV_SIZE = x300::DATA_FRAME_MAX_SIZE; -constexpr size_t GE_DATA_FRAME_SEND_SIZE = 1472; -constexpr size_t GE_DATA_FRAME_RECV_SIZE = 1472; -constexpr size_t ETH_MSG_NUM_FRAMES = 64; +constexpr size_t XGE_DATA_FRAME_SEND_SIZE = x300::DATA_FRAME_MAX_SIZE; +constexpr size_t XGE_DATA_FRAME_RECV_SIZE = x300::DATA_FRAME_MAX_SIZE; +constexpr size_t GE_DATA_FRAME_SEND_SIZE = 1472; +constexpr size_t GE_DATA_FRAME_RECV_SIZE = 1472; +constexpr size_t ETH_MSG_NUM_FRAMES = 64; // Default for num data frames is set to a value that will work well when send // or recv offload is enabled, or when using DPDK. @@ -200,8 +200,8 @@ eth_manager::eth_manager( // Once we read the EEPROM, we use it to map IP to its interface // In discover_eth(), we'll check and enable the other IP address, if given x300_eth_conn_t init = x300_eth_conn_t(); - init.addr = args.get_first_addr(); - auto device_id = allocate_device_id(); + init.addr = args.get_first_addr(); + auto device_id = allocate_device_id(); _local_device_ids.push_back(device_id); eth_conns[device_id] = init; @@ -245,15 +245,15 @@ both_links_t eth_manager::get_links(link_type_t link_type, default_link_params.recv_frame_size = conn.link_rate == MAX_RATE_1GIGE ? GE_DATA_FRAME_RECV_SIZE : XGE_DATA_FRAME_RECV_SIZE; - default_link_params.send_buff_size = conn.link_rate / 50; - default_link_params.recv_buff_size = std::max(conn.link_rate / 50, + default_link_params.send_buff_size = conn.link_rate / 50; + default_link_params.recv_buff_size = std::max(conn.link_rate / 50, ETH_MSG_NUM_FRAMES * ETH_MSG_FRAME_SIZE); // enough to hold greater of 20 ms or // number of msg frames #ifdef HAVE_DPDK - if(_args.get_use_dpdk()) { - default_link_params.num_recv_frames = default_link_params.recv_buff_size / - default_link_params.recv_frame_size; + if (_args.get_use_dpdk()) { + default_link_params.num_recv_frames = + default_link_params.recv_buff_size / default_link_params.recv_frame_size; } #endif diff --git a/host/lib/usrp/x300/x300_image_loader.cpp b/host/lib/usrp/x300/x300_image_loader.cpp index a6ebbe800..7514d3901 100644 --- a/host/lib/usrp/x300/x300_image_loader.cpp +++ b/host/lib/usrp/x300/x300_image_loader.cpp @@ -241,13 +241,12 @@ static void x300_setup_session(x300_session_t& session, throw uhd::runtime_error( "Found a device but could not auto-generate an image filename."); } else { - session.filepath = - find_image_path("usrp_" + sanitized_product_name + - "_fpga_" + session.fpga_type + ".bit"); + session.filepath = find_image_path( + "usrp_" + sanitized_product_name + "_fpga_" + session.fpga_type + ".bit"); } } else { session.fpga_type = ""; - session.filepath = filepath; + session.filepath = filepath; } /* @@ -292,7 +291,7 @@ static UHD_INLINE bool x300_recv_ok(const x300_fpga_update_data_t* pkt_in, size_ { return (len > 0 and ((ntohl(pkt_in->flags) & X300_FPGA_PROG_FLAGS_ERROR) - != X300_FPGA_PROG_FLAGS_ERROR)); + != X300_FPGA_PROG_FLAGS_ERROR)); } // Image data needs to be bitswapped diff --git a/host/lib/usrp/x300/x300_mb_controller.cpp b/host/lib/usrp/x300/x300_mb_controller.cpp index 268cd9bd2..ccbd7c20e 100644 --- a/host/lib/usrp/x300/x300_mb_controller.cpp +++ b/host/lib/usrp/x300/x300_mb_controller.cpp @@ -634,7 +634,7 @@ bool x300_mb_controller::is_pps_present() std::this_thread::sleep_for(100ms); if (pps_detect != _fw_regmap->clock_status_reg.read( - fw_regmap_t::clk_status_reg_t::PPS_DETECT)) + fw_regmap_t::clk_status_reg_t::PPS_DETECT)) return true; } return false; @@ -647,10 +647,10 @@ bool x300_mb_controller::get_ref_locked() == 1) && (_fw_regmap->clock_status_reg.get( fw_regmap_t::clk_status_reg_t::RADIO_CLK_LOCK) - == 1) + == 1) && (_fw_regmap->clock_status_reg.get( fw_regmap_t::clk_status_reg_t::IDELAYCTRL_LOCK) - == 1); + == 1); } void x300_mb_controller::self_cal_adc_xfer_delay(bool apply_delay) diff --git a/host/lib/usrp/x300/x300_mb_controller.hpp b/host/lib/usrp/x300/x300_mb_controller.hpp index a0ffb0654..900a6aa58 100644 --- a/host/lib/usrp/x300/x300_mb_controller.hpp +++ b/host/lib/usrp/x300/x300_mb_controller.hpp @@ -11,11 +11,11 @@ #include "x300_device_args.hpp" #include "x300_radio_mbc_iface.hpp" #include "x300_regs.hpp" -#include <uhdlib/features/discoverable_feature_registry.hpp> #include <uhd/rfnoc/mb_controller.hpp> #include <uhd/types/sensors.hpp> #include <uhd/types/wb_iface.hpp> #include <uhd/usrp/gps_ctrl.hpp> +#include <uhdlib/features/discoverable_feature_registry.hpp> #include <unordered_set> namespace uhd { namespace rfnoc { diff --git a/host/lib/usrp/x300/x300_mb_eeprom.cpp b/host/lib/usrp/x300/x300_mb_eeprom.cpp index 54505a43d..0b810be8f 100644 --- a/host/lib/usrp/x300/x300_mb_eeprom.cpp +++ b/host/lib/usrp/x300/x300_mb_eeprom.cpp @@ -124,7 +124,7 @@ void uhd::usrp::x300::set_mb_eeprom( if (check_for_duplicates<uhd::mac_addr_t>( "X300", mb_eeprom, curr_eeprom, "MAC address", mac_keys) or check_for_duplicates<boost::asio::ip::address_v4>( - "X300", mb_eeprom, curr_eeprom, "IP address", ip_keys)) { + "X300", mb_eeprom, curr_eeprom, "IP address", ip_keys)) { throw uhd::value_error( "Duplicate values not permitted - write to EEPROM aborted"); } diff --git a/host/lib/usrp/x300/x300_mb_iface.cpp b/host/lib/usrp/x300/x300_mb_iface.cpp index a351864df..1be56ddf3 100644 --- a/host/lib/usrp/x300/x300_mb_iface.cpp +++ b/host/lib/usrp/x300/x300_mb_iface.cpp @@ -116,7 +116,7 @@ uhd::rfnoc::chdr_ctrl_xport::sptr x300_impl::x300_mb_iface::make_ctrl_transport( auto io_srv = get_io_srv_mgr()->connect_links(recv_link, send_link, link_type_t::CTRL); auto io_srv_mgr = this->get_io_srv_mgr(); - auto xport = chdr_ctrl_xport::make(io_srv, + auto xport = chdr_ctrl_xport::make(io_srv, send_link, recv_link, _pkt_factory, diff --git a/host/lib/usrp/x300/x300_pcie_mgr.cpp b/host/lib/usrp/x300/x300_pcie_mgr.cpp index 64ce5df55..1f794b9e6 100644 --- a/host/lib/usrp/x300/x300_pcie_mgr.cpp +++ b/host/lib/usrp/x300/x300_pcie_mgr.cpp @@ -358,8 +358,12 @@ both_links_t pcie_manager::get_links(link_type_t link_type, // PCIe: Lossless, and little endian size_t recv_buff_size, send_buff_size; - auto link = - nirio_link::make(_rio_fpga_interface, dma_channel_num, link_params, link_args, recv_buff_size, send_buff_size); + auto link = nirio_link::make(_rio_fpga_interface, + dma_channel_num, + link_params, + link_args, + recv_buff_size, + send_buff_size); return std::make_tuple(link, send_buff_size, diff --git a/host/lib/usrp/x300/x300_radio_control.cpp b/host/lib/usrp/x300/x300_radio_control.cpp index ab56adb07..3bbadf7d6 100644 --- a/host/lib/usrp/x300/x300_radio_control.cpp +++ b/host/lib/usrp/x300/x300_radio_control.cpp @@ -77,7 +77,7 @@ size_t _get_chan_from_map(std::unordered_map<size_t, map_type> map, const std::s str(boost::format("Invalid daughterboard frontend name: %s") % fe)); } -constexpr double DEFAULT_RATE = 200e6; +constexpr double DEFAULT_RATE = 200e6; constexpr char HW_GAIN_STAGE[] = "hw"; } // namespace @@ -151,8 +151,7 @@ public: // FP-GPIO (the gpio_atr_3000 ctor will initialize default values) RFNOC_LOG_TRACE("Creating FP-GPIO interface..."); _fp_gpio = gpio_atr::gpio_atr_3000::make(_wb_iface, - gpio_atr::gpio_atr_offsets::make_default( - x300_regs::SR_FP_GPIO, + gpio_atr::gpio_atr_offsets::make_default(x300_regs::SR_FP_GPIO, x300_regs::RB_FP_GPIO, x300_regs::PERIPH_REG_OFFSET)); // Create the GPIO banks and attributes, and populate them with some default @@ -174,7 +173,7 @@ public: // LEDs are technically valid for both RX and TX, but let's put them // here - _leds = gpio_atr::gpio_atr_3000::make(_wb_iface, + _leds = gpio_atr::gpio_atr_3000::make(_wb_iface, gpio_atr::gpio_atr_offsets::make_write_only( x300_regs::SR_LEDS, x300_regs::PERIPH_REG_OFFSET)); _leds->set_atr_mode( @@ -909,7 +908,7 @@ public: const std::string name = bank.substr(2); const dboard_iface::unit_t unit = (bank[0] == 'R') ? dboard_iface::UNIT_RX : dboard_iface::UNIT_TX; - constexpr uint16_t mask = 0xFFFF; + constexpr uint16_t mask = 0xFFFF; if (attr == "CTRL") { _db_iface->set_pin_ctrl(unit, value, mask); } else if (attr == "DDR") { @@ -1522,8 +1521,7 @@ private: // create a new dboard interface x300_dboard_iface_config_t db_config; db_config.gpio = gpio_atr::db_gpio_atr_3000::make(_wb_iface, - gpio_atr::gpio_atr_offsets::make_default( - x300_regs::SR_DB_GPIO, + gpio_atr::gpio_atr_offsets::make_default(x300_regs::SR_DB_GPIO, x300_regs::RB_DB_GPIO, x300_regs::PERIPH_REG_OFFSET)); db_config.spi = _spi; @@ -1532,11 +1530,11 @@ private: db_config.i2c = zpu_i2c; db_config.clock = clock; db_config.which_rx_clk = (_radio_type == PRIMARY) ? X300_CLOCK_WHICH_DB0_RX - : X300_CLOCK_WHICH_DB1_RX; - db_config.which_tx_clk = (_radio_type == PRIMARY) ? X300_CLOCK_WHICH_DB0_TX - : X300_CLOCK_WHICH_DB1_TX; - db_config.dboard_slot = (_radio_type == PRIMARY) ? 0 : 1; - db_config.cmd_time_ctrl = _wb_iface; + : X300_CLOCK_WHICH_DB1_RX; + db_config.which_tx_clk = (_radio_type == PRIMARY) ? X300_CLOCK_WHICH_DB0_TX + : X300_CLOCK_WHICH_DB1_TX; + db_config.dboard_slot = (_radio_type == PRIMARY) ? 0 : 1; + db_config.cmd_time_ctrl = _wb_iface; // create a new dboard manager RFNOC_LOG_TRACE("Creating DB interface..."); @@ -1576,8 +1574,8 @@ private: // here. if (num_rx_frontends == 2 && boost::starts_with( - get_tree()->access<std::string>(DB_PATH / "rx_frontends/0/name").get(), - "TwinRX")) { + get_tree()->access<std::string>(DB_PATH / "rx_frontends/0/name").get(), + "TwinRX")) { _twinrx = true; set_num_input_ports(0); } @@ -1775,9 +1773,12 @@ private: // The "RX1" port is used by TwinRX and the "TX/RX" port is used by all // other full-duplex dboards. We need to handle both here. const bool is_txrx = (rx_ant == "TX/RX" or rx_ant == "RX1"); - const int TXRX_RX = (1 << 0); - const int TXRX_TX = (1 << 1); - const int RX2_RX = (1 << 2); + // Green LED on TX/RX port (left SMA) + constexpr int TXRX_RX = (1 << 0); + // Red LED on TX/RX port (left SMA) + constexpr int TXRX_TX = (1 << 1); + // Green LED on RX2 port (right SMA) + constexpr int RX2_RX = (1 << 2); _leds->set_atr_reg(gpio_atr::ATR_REG_IDLE, 0); _leds->set_atr_reg(gpio_atr::ATR_REG_RX_ONLY, is_txrx ? TXRX_RX : RX2_RX); _leds->set_atr_reg(gpio_atr::ATR_REG_TX_ONLY, TXRX_TX); @@ -1988,7 +1989,7 @@ private: bool _basic_lf_rx = false; bool _basic_lf_tx = false; - bool _twinrx = false; + bool _twinrx = false; std::unordered_map<size_t, rx_fe_perif> _rx_fe_map; std::unordered_map<size_t, tx_fe_perif> _tx_fe_map; |