aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-04-27 10:09:04 -0700
committerMartin Braun <martin.braun@ettus.com>2015-04-27 16:17:01 -0700
commit0e1bba1ae05aa3edff65eddfc174d98d64fa1f42 (patch)
tree02672d537fcd036aa1308240fc578bae67fe6937
parent925bd26d3a66de434f32ac69599564dc2f5bc69d (diff)
downloaduhd-0e1bba1ae05aa3edff65eddfc174d98d64fa1f42.tar.gz
uhd-0e1bba1ae05aa3edff65eddfc174d98d64fa1f42.tar.bz2
uhd-0e1bba1ae05aa3edff65eddfc174d98d64fa1f42.zip
b200: Added convenience subdev override for consistent subdev experience
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp15
-rw-r--r--host/lib/usrp/b200/b200_impl.hpp2
-rw-r--r--host/lib/usrp/b200/b200_io_impl.cpp34
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 84153309e..d66920bd9 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -205,7 +205,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;
@@ -265,6 +266,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
@@ -283,13 +287,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
}
////////////////////////////////////////////////////////////////////
@@ -462,9 +463,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 f3d3d0e98..bc49595b9 100644
--- a/host/lib/usrp/b200/b200_impl.hpp
+++ b/host/lib/usrp/b200/b200_impl.hpp
@@ -102,6 +102,7 @@ public:
private:
b200_type_t _b200_type;
+ size_t _revision;
//controllers
b200_iface::sptr _iface;
@@ -139,6 +140,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 3e156f9bb..1e11e7ff6 100644
--- a/host/lib/usrp/b200/b200_io_impl.cpp
+++ b/host/lib/usrp/b200/b200_io_impl.cpp
@@ -122,29 +122,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);