diff options
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/b200/b200_impl.cpp | 15 | ||||
-rw-r--r-- | host/lib/usrp/b200/b200_impl.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/b200/b200_io_impl.cpp | 34 |
3 files changed, 29 insertions, 22 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index f3307dc4d..de61db610 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -208,7 +208,8 @@ UHD_STATIC_BLOCK(register_b200_device) * Structors **********************************************************************/ b200_impl::b200_impl(const device_addr_t &device_addr) : - _tick_rate(0.0) // Forces a clock initialization at startup + _tick_rate(0.0), // Forces a clock initialization at startup + _revision(0) { _tree = property_tree::make(); _type = device::USRP; @@ -305,6 +306,9 @@ b200_impl::b200_impl(const device_addr_t &device_addr) : product_name = "B200?"; _b200_type = B200; } + if (not mb_eeprom["revision"].empty()) { + _revision = boost::lexical_cast<size_t>(mb_eeprom["revision"]); + } //////////////////////////////////////////////////////////////////// // Set up frontend mapping @@ -323,13 +327,10 @@ b200_impl::b200_impl(const device_addr_t &device_addr) : _fe2 = 0; _gpio_state.swap_atr = 1; // Unswapped setup: - if (_b200_type == B200 and - not mb_eeprom["revision"].empty() and - boost::lexical_cast<size_t>(mb_eeprom["revision"]) >= 5) - { + if (_b200_type == B200 and _revision >= 5) { _fe1 = 0; //map radio0 to FE1 _fe2 = 1; //map radio1 to FE2 - _gpio_state.swap_atr = 0; //map radio0 ATR pins to FE2 + _gpio_state.swap_atr = 0; // ATRs for radio0 are mapped to FE1 } //////////////////////////////////////////////////////////////////// @@ -503,9 +504,11 @@ b200_impl::b200_impl(const device_addr_t &device_addr) : _tree->create<std::vector<size_t> >(mb_path / "rx_chan_dsp_mapping").set(default_map); _tree->create<std::vector<size_t> >(mb_path / "tx_chan_dsp_mapping").set(default_map); _tree->create<subdev_spec_t>(mb_path / "rx_subdev_spec") + .coerce(boost::bind(&b200_impl::coerce_subdev_spec, this, _1)) .set(subdev_spec_t()) .subscribe(boost::bind(&b200_impl::update_subdev_spec, this, "rx", _1)); _tree->create<subdev_spec_t>(mb_path / "tx_subdev_spec") + .coerce(boost::bind(&b200_impl::coerce_subdev_spec, this, _1)) .set(subdev_spec_t()) .subscribe(boost::bind(&b200_impl::update_subdev_spec, this, "tx", _1)); diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index 4dd45baee..f5a7b62e9 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -108,6 +108,7 @@ public: private: b200_type_t _b200_type; + size_t _revision; //controllers b200_iface::sptr _iface; @@ -145,6 +146,7 @@ private: void set_mb_eeprom(const uhd::usrp::mboard_eeprom_t &); void check_fw_compat(void); void check_fpga_compat(void); + uhd::usrp::subdev_spec_t coerce_subdev_spec(const uhd::usrp::subdev_spec_t &); void update_subdev_spec(const std::string &tx_rx, const uhd::usrp::subdev_spec_t &); void update_time_source(const std::string &); void update_clock_source(const std::string &); diff --git a/host/lib/usrp/b200/b200_io_impl.cpp b/host/lib/usrp/b200/b200_io_impl.cpp index 52a90a623..61bcc5f64 100644 --- a/host/lib/usrp/b200/b200_io_impl.cpp +++ b/host/lib/usrp/b200/b200_io_impl.cpp @@ -245,29 +245,31 @@ void b200_impl::update_tx_samp_rate(const size_t dspno, const double rate) /*********************************************************************** * frontend selection **********************************************************************/ +uhd::usrp::subdev_spec_t b200_impl::coerce_subdev_spec(const uhd::usrp::subdev_spec_t &spec_) +{ + uhd::usrp::subdev_spec_t spec = spec_; + // Because of the confusing nature of the subdevs on B200 + // with different revs, we provide a convenience override, + // where both A:A and A:B are mapped to A:A. + // + // Any other spec is probably illegal and will be caught by + // validate_subdev_spec(). + if (spec.size() and _b200_type == B200 and spec[0].sd_name == "B") { + spec[0].sd_name = "A"; + } + return spec; +} + void b200_impl::update_subdev_spec(const std::string &tx_rx, const uhd::usrp::subdev_spec_t &spec) { //sanity checking - if (spec.size()) validate_subdev_spec(_tree, spec, tx_rx); - UHD_ASSERT_THROW(spec.size() <= _radio_perifs.size()); - - if (spec.size() >= 1) - { - UHD_ASSERT_THROW(spec[0].db_name == "A"); - UHD_ASSERT_THROW(spec[0].sd_name == "A" or spec[0].sd_name == "B"); - } - if (spec.size() == 2) - { - UHD_ASSERT_THROW(spec[1].db_name == "A"); - UHD_ASSERT_THROW( - (spec[0].sd_name == "A" and spec[1].sd_name == "B") or - (spec[0].sd_name == "B" and spec[1].sd_name == "A") - ); + if (spec.size()) { + validate_subdev_spec(_tree, spec, tx_rx); } std::vector<size_t> chan_to_dsp_map(spec.size(), 0); for (size_t i = 0; i < spec.size(); i++) { - chan_to_dsp_map[i] = (spec[i].sd_name == "A") ? 0 : 1; + chan_to_dsp_map[i] = (spec[i].sd_name == "A") ? 0 : 1; } _tree->access<std::vector<size_t> >("/mboards/0" / (tx_rx + "_chan_dsp_mapping")).set(chan_to_dsp_map); |