summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-07-03 12:22:53 -0700
committerJosh Blum <josh@joshknows.com>2011-07-03 12:22:53 -0700
commit89989fdb2d92a6072b737a8864b50c9daa5c614a (patch)
treefe6aaa790114a2157da33f34a79ce97b5ebaf67d /host/lib/usrp
parentffde9596bdef76e56d305be9a83401ceb580226f (diff)
downloaduhd-89989fdb2d92a6072b737a8864b50c9daa5c614a.tar.gz
uhd-89989fdb2d92a6072b737a8864b50c9daa5c614a.tar.bz2
uhd-89989fdb2d92a6072b737a8864b50c9daa5c614a.zip
usrp2: accept old db name 0 for backwards compat
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp24
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp4
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp5
3 files changed, 27 insertions, 6 deletions
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index 3a3afff02..ed9a6320e 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -306,7 +306,24 @@ void usrp2_impl::update_tx_samp_rate(const double rate){
_io_impl->send_handler.set_samp_rate(rate);
}
-void usrp2_impl::update_rx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec){
+static subdev_spec_t replace_zero_in_spec(const std::string &type, const subdev_spec_t &spec){
+ subdev_spec_t new_spec;
+ BOOST_FOREACH(const subdev_spec_pair_t &pair, spec){
+ if (pair.db_name == "0"){
+ UHD_MSG(warning)
+ << boost::format("In the %s subdevice specification: %s") % type % spec.to_string() << std::endl
+ << "Accepting dboard slot name \"0\" for backward compatibility." << std::endl
+ << "The official name of the dboard slot on USRP2/N-Series is \"A\"." << std::endl
+ ;
+ new_spec.push_back(subdev_spec_pair_t("A", pair.sd_name));
+ }
+ else new_spec.push_back(pair);
+ }
+ return new_spec;
+}
+
+subdev_spec_t usrp2_impl::update_rx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec_){
+ const subdev_spec_t spec = replace_zero_in_spec("RX", spec_);
boost::mutex::scoped_lock recv_lock = _io_impl->recv_handler.get_scoped_lock();
property_tree::path_type root = "/mboards/" + which_mb + "/dboards";
@@ -336,9 +353,11 @@ void usrp2_impl::update_rx_subdev_spec(const std::string &which_mb, const subdev
));
}
}
+ return spec;
}
-void usrp2_impl::update_tx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec){
+subdev_spec_t usrp2_impl::update_tx_subdev_spec(const std::string &which_mb, const subdev_spec_t &spec_){
+ const subdev_spec_t spec = replace_zero_in_spec("TX", spec_);
boost::mutex::scoped_lock send_lock = _io_impl->send_handler.get_scoped_lock();
property_tree::path_type root = "/mboards/" + which_mb + "/dboards";
@@ -364,6 +383,7 @@ void usrp2_impl::update_tx_subdev_spec(const std::string &which_mb, const subdev
));
}
}
+ return spec;
}
/***********************************************************************
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index a62e6088b..9741bec44 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -431,9 +431,9 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
);
//TODO lots of properties to expose here for frontends
_tree->create<subdev_spec_t>(mb_path / "rx_subdev_spec")
- .subscribe(boost::bind(&usrp2_impl::update_rx_subdev_spec, this, mb, _1));
+ .coerce(boost::bind(&usrp2_impl::update_rx_subdev_spec, this, mb, _1));
_tree->create<subdev_spec_t>(mb_path / "tx_subdev_spec")
- .subscribe(boost::bind(&usrp2_impl::update_tx_subdev_spec, this, mb, _1));
+ .coerce(boost::bind(&usrp2_impl::update_tx_subdev_spec, this, mb, _1));
////////////////////////////////////////////////////////////////
// create rx dsp control objects
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index e0ff4b241..eae7b7dcb 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -124,8 +124,9 @@ private:
void update_tick_rate(const double rate);
void update_rx_samp_rate(const double rate);
void update_tx_samp_rate(const double rate);
- void update_rx_subdev_spec(const std::string &, const uhd::usrp::subdev_spec_t &);
- void update_tx_subdev_spec(const std::string &, const uhd::usrp::subdev_spec_t &);
+ //update spec methods are coercers until we only accept db_name == A
+ uhd::usrp::subdev_spec_t update_rx_subdev_spec(const std::string &, const uhd::usrp::subdev_spec_t &);
+ uhd::usrp::subdev_spec_t update_tx_subdev_spec(const std::string &, const uhd::usrp::subdev_spec_t &);
double set_tx_dsp_freq(const std::string &, const double);
uhd::meta_range_t get_tx_dsp_freq_range(const std::string &);
void update_clock_source(const std::string &, const std::string &);