diff options
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r-- | host/lib/usrp/x300/x300_defaults.hpp | 23 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_device_args.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_image_loader.cpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_mb_controller.hpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_mb_eeprom_iface.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_pcie_mgr.cpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_prop_tree.cpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_radio_control.cpp | 23 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_regs.hpp | 30 |
10 files changed, 73 insertions, 78 deletions
diff --git a/host/lib/usrp/x300/x300_defaults.hpp b/host/lib/usrp/x300/x300_defaults.hpp index ae10bf243..8b1be15c7 100644 --- a/host/lib/usrp/x300/x300_defaults.hpp +++ b/host/lib/usrp/x300/x300_defaults.hpp @@ -15,21 +15,21 @@ namespace uhd { namespace usrp { namespace x300 { static constexpr size_t NIUSRPRIO_DEFAULT_RPC_PORT = 5444; -static constexpr size_t XB_DST_E0 = 0; -static constexpr size_t XB_DST_E1 = 1; -static constexpr size_t XB_DST_PCI = 2; -static constexpr size_t XB_DST_R0 = 3; // Radio 0 -> Slot A -static constexpr size_t XB_DST_R1 = 4; // Radio 1 -> Slot B -static constexpr size_t XB_DST_CE0 = 5; +static constexpr size_t XB_DST_E0 = 0; +static constexpr size_t XB_DST_E1 = 1; +static constexpr size_t XB_DST_PCI = 2; +static constexpr size_t XB_DST_R0 = 3; // Radio 0 -> Slot A +static constexpr size_t XB_DST_R1 = 4; // Radio 1 -> Slot B +static constexpr size_t XB_DST_CE0 = 5; static constexpr size_t SRC_ADDR0 = 0; static constexpr size_t SRC_ADDR1 = 1; static constexpr size_t DST_ADDR = 2; -static constexpr double DEFAULT_TICK_RATE = 200e6; // Hz -static constexpr double MAX_TICK_RATE = 200e6; // Hz -static constexpr double MIN_TICK_RATE = 184.32e6; // Hz -static constexpr double BUS_CLOCK_RATE = 187.5e6; // Hz +static constexpr double DEFAULT_TICK_RATE = 200e6; // Hz +static constexpr double MAX_TICK_RATE = 200e6; // Hz +static constexpr double MIN_TICK_RATE = 184.32e6; // Hz +static constexpr double BUS_CLOCK_RATE = 187.5e6; // Hz static constexpr double DEFAULT_SYSREF_RATE = 10e6; static const std::string FW_FILE_NAME = "usrp_x300_fw.bin"; @@ -43,8 +43,7 @@ static const std::vector<std::string> CLOCK_SOURCE_OPTIONS{ "internal", "external", "gpsdo"}; static const std::vector<std::string> TIME_SOURCE_OPTIONS{ "internal", "external", "gpsdo"}; -static const std::vector<double> EXTERNAL_FREQ_OPTIONS{ - 10e6, 11.52e6, 23.04e6, 30.72e6}; +static const std::vector<double> EXTERNAL_FREQ_OPTIONS{10e6, 11.52e6, 23.04e6, 30.72e6}; // Limit the number of initialization threads static const size_t MAX_INIT_THREADS = 10; diff --git a/host/lib/usrp/x300/x300_device_args.hpp b/host/lib/usrp/x300/x300_device_args.hpp index 9e9e328a9..6c6680c4f 100644 --- a/host/lib/usrp/x300/x300_device_args.hpp +++ b/host/lib/usrp/x300/x300_device_args.hpp @@ -257,8 +257,8 @@ private: #ifdef HAVE_DPDK _use_dpdk.set(true); #else - UHD_LOG_WARNING("DPDK", - "Detected use_dpdk argument, but DPDK support not built in."); + UHD_LOG_WARNING( + "DPDK", "Detected use_dpdk argument, but DPDK support not built in."); #endif } PARSE_DEFAULT(_recv_frame_size) diff --git a/host/lib/usrp/x300/x300_image_loader.cpp b/host/lib/usrp/x300/x300_image_loader.cpp index ccd3761df..c8690465b 100644 --- a/host/lib/usrp/x300/x300_image_loader.cpp +++ b/host/lib/usrp/x300/x300_image_loader.cpp @@ -233,9 +233,8 @@ static void x300_setup_session(x300_session_t& session, if (fpga_file_type == "ni-2974") { fpga_file_type = "x310"; } - session.filepath = find_image_path( - str(boost::format("usrp_%s_fpga_%s.bit") - % fpga_file_type % session.fpga_type)); + session.filepath = find_image_path(str(boost::format("usrp_%s_fpga_%s.bit") + % fpga_file_type % session.fpga_type)); } } else session.filepath = filepath; diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 273485577..a414fd0f1 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -9,8 +9,8 @@ #include "x300_impl.hpp" #include "x300_claim.hpp" #include "x300_eth_mgr.hpp" -#include "x300_mb_eeprom.hpp" #include "x300_mb_controller.hpp" +#include "x300_mb_eeprom.hpp" #include "x300_mb_eeprom_iface.hpp" #include "x300_mboard_type.hpp" #include "x300_pcie_mgr.hpp" @@ -179,8 +179,7 @@ static void x300_load_fw(wb_iface::sptr fw_reg_ctrl, const std::string& file_nam UHD_LOGGER_INFO("X300") << "Firmware loaded!"; } -x300_impl::x300_impl(const uhd::device_addr_t& dev_addr) - : rfnoc_device() +x300_impl::x300_impl(const uhd::device_addr_t& dev_addr) : rfnoc_device() { UHD_LOGGER_INFO("X300") << "X300 initialization sequence..."; @@ -215,8 +214,8 @@ x300_impl::x300_impl(const uhd::device_addr_t& dev_addr) void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t& dev_addr) { - const fs_path mb_path = fs_path("/mboards") / mb_i; - mboard_members_t& mb = _mb[mb_i]; + const fs_path mb_path = fs_path("/mboards") / mb_i; + mboard_members_t& mb = _mb[mb_i]; mb.args.parse(dev_addr); mb.xport_path = dev_addr.has_key("resource") ? xport_path_t::NIRIO : xport_path_t::ETH; @@ -483,4 +482,3 @@ void x300_impl::check_fpga_compat(const fs_path& mb_path, const mboard_members_t "Using FPGA version: " << compat_major << "." << compat_minor << " git hash: " << git_hash_str); } - diff --git a/host/lib/usrp/x300/x300_mb_controller.hpp b/host/lib/usrp/x300/x300_mb_controller.hpp index 92844f1b9..f33d629c7 100644 --- a/host/lib/usrp/x300/x300_mb_controller.hpp +++ b/host/lib/usrp/x300/x300_mb_controller.hpp @@ -54,17 +54,26 @@ public: } //! Reference to the ZPU peek/poke interface - uhd::wb_iface::sptr get_zpu_ctrl() { return _zpu_ctrl; } + uhd::wb_iface::sptr get_zpu_ctrl() + { + return _zpu_ctrl; + } //! Return reference to LMK clock controller - x300_clock_ctrl::sptr get_clock_ctrl() { return _clock_ctrl; } + x300_clock_ctrl::sptr get_clock_ctrl() + { + return _clock_ctrl; + } void register_reset_codec_cb(std::function<void(void)>&& reset_cb) { _reset_cbs.push_back(std::move(reset_cb)); } - void set_initialization_done() { _initialization_done = true; } + void set_initialization_done() + { + _initialization_done = true; + } void register_radio(uhd::usrp::x300::x300_radio_mbc_iface* radio) { @@ -80,7 +89,8 @@ public: class x300_timekeeper : public mb_controller::timekeeper { public: - x300_timekeeper(const size_t tk_idx, uhd::wb_iface::sptr zpu_ctrl, const double tick_rate) + x300_timekeeper( + const size_t tk_idx, uhd::wb_iface::sptr zpu_ctrl, const double tick_rate) : _tk_idx(tk_idx), _zpu_ctrl(zpu_ctrl) { set_tick_rate(tick_rate); diff --git a/host/lib/usrp/x300/x300_mb_eeprom_iface.hpp b/host/lib/usrp/x300/x300_mb_eeprom_iface.hpp index 2d08d5711..935f6302d 100644 --- a/host/lib/usrp/x300/x300_mb_eeprom_iface.hpp +++ b/host/lib/usrp/x300/x300_mb_eeprom_iface.hpp @@ -11,8 +11,8 @@ #include <uhd/config.hpp> #include <uhd/types/serial.hpp> #include <uhd/types/wb_iface.hpp> -#include <memory> #include <boost/utility.hpp> +#include <memory> class x300_mb_eeprom_iface : public uhd::i2c_iface { diff --git a/host/lib/usrp/x300/x300_pcie_mgr.cpp b/host/lib/usrp/x300/x300_pcie_mgr.cpp index d2aad7e3c..d3f4eba27 100644 --- a/host/lib/usrp/x300/x300_pcie_mgr.cpp +++ b/host/lib/usrp/x300/x300_pcie_mgr.cpp @@ -29,9 +29,9 @@ using namespace uhd::niusrprio; namespace { -//uint32_t extract_sid_from_pkt(void* pkt, size_t) +// uint32_t extract_sid_from_pkt(void* pkt, size_t) //{ - //return uhd::sid_t(uhd::wtohx(static_cast<const uint32_t*>(pkt)[1])).get_dst(); +// return uhd::sid_t(uhd::wtohx(static_cast<const uint32_t*>(pkt)[1])).get_dst(); //} constexpr uint32_t RADIO_DEST_PREFIX_TX = 0; @@ -42,13 +42,13 @@ constexpr uint32_t RADIO_DEST_PREFIX_TX = 0; // 64 frames * 256 bytes each aligns with the typical page size of 4096 bytes. Since most // page sizes are 4096 bytes or some multiple of that, keep the number of frames * frame // size aligned to it. -constexpr size_t PCIE_RX_DATA_FRAME_SIZE = 4096; // bytes -constexpr size_t PCIE_RX_DATA_NUM_FRAMES = 4096; -constexpr size_t PCIE_TX_DATA_FRAME_SIZE = 4096; // bytes -constexpr size_t PCIE_TX_DATA_NUM_FRAMES = 4096; -constexpr size_t PCIE_MSG_FRAME_SIZE = 256; // bytes -constexpr size_t PCIE_MSG_NUM_FRAMES = 64; -constexpr size_t PCIE_MAX_CHANNELS = 6; +constexpr size_t PCIE_RX_DATA_FRAME_SIZE = 4096; // bytes +constexpr size_t PCIE_RX_DATA_NUM_FRAMES = 4096; +constexpr size_t PCIE_TX_DATA_FRAME_SIZE = 4096; // bytes +constexpr size_t PCIE_TX_DATA_NUM_FRAMES = 4096; +constexpr size_t PCIE_MSG_FRAME_SIZE = 256; // bytes +constexpr size_t PCIE_MSG_NUM_FRAMES = 64; +constexpr size_t PCIE_MAX_CHANNELS = 6; // constexpr size_t MAX_RATE_PCIE = 800000000; // bytes/s diff --git a/host/lib/usrp/x300/x300_prop_tree.cpp b/host/lib/usrp/x300/x300_prop_tree.cpp index 21597beea..4f40f3514 100644 --- a/host/lib/usrp/x300/x300_prop_tree.cpp +++ b/host/lib/usrp/x300/x300_prop_tree.cpp @@ -14,8 +14,7 @@ using namespace uhd::rfnoc; namespace uhd { namespace usrp { namespace x300 { -void init_prop_tree( - const size_t mb_idx, x300_mb_controller* mbc, property_tree::sptr pt) +void init_prop_tree(const size_t mb_idx, x300_mb_controller* mbc, property_tree::sptr pt) { const fs_path mb_path = fs_path("/mboards") / mb_idx; try { @@ -42,17 +41,15 @@ void init_prop_tree( //////////////////////////////////////////////////////////////////// pt->create<std::string>(mb_path / "time_source" / "value") .set(mbc->get_time_source()) - .add_coerced_subscriber([mbc](const std::string& time_source) { - mbc->set_time_source(time_source); - }); + .add_coerced_subscriber( + [mbc](const std::string& time_source) { mbc->set_time_source(time_source); }); pt->create<std::vector<std::string>>(mb_path / "time_source" / "options") .set(mbc->get_time_sources()); // setup the time output, default to ON pt->create<bool>(mb_path / "time_source" / "output") - .add_coerced_subscriber([mbc](const bool time_output) { - mbc->set_time_source_out(time_output); - }) + .add_coerced_subscriber( + [mbc](const bool time_output) { mbc->set_time_source_out(time_output); }) .set(true); //////////////////////////////////////////////////////////////////// @@ -69,9 +66,8 @@ void init_prop_tree( // setup external reference options. default to 10 MHz input reference pt->create<std::string>(mb_path / "clock_source" / "external"); - pt - ->create<std::vector<double>>( - mb_path / "clock_source" / "external" / "freq" / "options") + pt->create<std::vector<double>>( + mb_path / "clock_source" / "external" / "freq" / "options") .set(EXTERNAL_FREQ_OPTIONS); pt->create<double>(mb_path / "clock_source" / "external" / "value") .set(mbc->get_clock_ctrl()->get_sysref_clock_rate()) diff --git a/host/lib/usrp/x300/x300_radio_control.cpp b/host/lib/usrp/x300/x300_radio_control.cpp index 48b484467..1bd88164a 100644 --- a/host/lib/usrp/x300/x300_radio_control.cpp +++ b/host/lib/usrp/x300/x300_radio_control.cpp @@ -28,11 +28,11 @@ #include <uhdlib/usrp/cores/spi_core_3000.hpp> #include <uhdlib/usrp/cores/tx_frontend_core_200.hpp> #include <boost/algorithm/string.hpp> -#include <memory> #include <algorithm> #include <chrono> #include <functional> #include <iostream> +#include <memory> #include <thread> using namespace uhd; @@ -869,26 +869,19 @@ public: constexpr uint16_t mask = 0xFFFF; if (attr == "CTRL") { _db_iface->set_pin_ctrl(unit, value, mask); - } - else if (attr == "DDR") { + } else if (attr == "DDR") { _db_iface->set_gpio_ddr(unit, value, mask); - } - else if (attr == "OUT") { + } else if (attr == "OUT") { _db_iface->set_gpio_out(unit, value, mask); - } - else if (attr == "ATR_0X") { + } else if (attr == "ATR_0X") { _db_iface->set_atr_reg(unit, gpio_atr::ATR_REG_IDLE, value, mask); - } - else if (attr == "ATR_RX") { + } else if (attr == "ATR_RX") { _db_iface->set_atr_reg(unit, gpio_atr::ATR_REG_RX_ONLY, value, mask); - } - else if (attr == "ATR_TX") { + } else if (attr == "ATR_TX") { _db_iface->set_atr_reg(unit, gpio_atr::ATR_REG_TX_ONLY, value, mask); - } - else if (attr == "ATR_XX") { + } else if (attr == "ATR_XX") { _db_iface->set_atr_reg(unit, gpio_atr::ATR_REG_FULL_DUPLEX, value, mask); - } - else { + } else { RFNOC_LOG_ERROR("Invalid GPIO attribute name: " << attr); throw uhd::key_error(std::string("Invalid GPIO attribute name: ") + attr); } diff --git a/host/lib/usrp/x300/x300_regs.hpp b/host/lib/usrp/x300/x300_regs.hpp index 86ffd46c4..5e9876507 100644 --- a/host/lib/usrp/x300/x300_regs.hpp +++ b/host/lib/usrp/x300/x300_regs.hpp @@ -27,14 +27,14 @@ static const int BL_DATA = 1; // I2C1 device addresses #define MBOARD_EEPROM_ADDR 0x50 -static const int ZPU_SR_LEDS = 00; -static const int ZPU_SR_SW_RST = 01; -static const int ZPU_SR_CLOCK_CTRL = 02; -static const int ZPU_SR_XB_LOCAL = 03; -static const int ZPU_SR_REF_FREQ = 04; -static const int ZPU_SR_SPI = 32; -static const int ZPU_SR_ETHINT0 = 40; -static const int ZPU_SR_ETHINT1 = 56; +static const int ZPU_SR_LEDS = 00; +static const int ZPU_SR_SW_RST = 01; +static const int ZPU_SR_CLOCK_CTRL = 02; +static const int ZPU_SR_XB_LOCAL = 03; +static const int ZPU_SR_REF_FREQ = 04; +static const int ZPU_SR_SPI = 32; +static const int ZPU_SR_ETHINT0 = 40; +static const int ZPU_SR_ETHINT1 = 56; static const int ZPU_SR_FP_GPIO_SRC = 72; // reset bits @@ -43,13 +43,13 @@ static const int ZPU_SR_FP_GPIO_SRC = 72; #define ZPU_SR_SW_RST_RADIO_CLK_PLL (1 << 2) #define ZPU_SR_SW_RST_ADC_IDELAYCTRL (1 << 3) -static const int ZPU_RB_SPI = 2; -static const int ZPU_RB_CLK_STATUS = 3; -static const int ZPU_RB_COMPAT_NUM = 6; -static const int ZPU_RB_NUM_CE = 7; -static const int ZPU_RB_GIT_HASH = 10; -static const int ZPU_RB_SFP0_TYPE = 4; -static const int ZPU_RB_SFP1_TYPE = 5; +static const int ZPU_RB_SPI = 2; +static const int ZPU_RB_CLK_STATUS = 3; +static const int ZPU_RB_COMPAT_NUM = 6; +static const int ZPU_RB_NUM_CE = 7; +static const int ZPU_RB_GIT_HASH = 10; +static const int ZPU_RB_SFP0_TYPE = 4; +static const int ZPU_RB_SFP1_TYPE = 5; static const int ZPU_RB_FP_GPIO_SRC = 13; static const uint32_t RB_SFP_1G_ETH = 0; |