aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2014-02-21 13:58:14 +0100
committerMartin Braun <martin.braun@ettus.com>2014-03-10 11:46:02 +0100
commit2047b85cf090f0c978da24e4c14bb674d2803bcd (patch)
tree790aa97e89097297b8de38103077eaf7d5b5c496 /host/lib/usrp/x300
parent81f9036788edbdb3498ac3b60b3e37791aab3e2b (diff)
downloaduhd-2047b85cf090f0c978da24e4c14bb674d2803bcd.tar.gz
uhd-2047b85cf090f0c978da24e4c14bb674d2803bcd.tar.bz2
uhd-2047b85cf090f0c978da24e4c14bb674d2803bcd.zip
x300: merged subdev update routines for tx and rx
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp4
-rw-r--r--host/lib/usrp/x300/x300_impl.hpp9
-rw-r--r--host/lib/usrp/x300/x300_io_impl.cpp59
3 files changed, 26 insertions, 46 deletions
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index b20897fc6..6a3ac5363 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -733,9 +733,9 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
// create frontend mapping
////////////////////////////////////////////////////////////////////
_tree->create<subdev_spec_t>(mb_path / "rx_subdev_spec")
- .subscribe(boost::bind(&x300_impl::update_rx_subdev_spec, this, mb_i, _1));
+ .subscribe(boost::bind(&x300_impl::update_subdev_spec, this, "rx", mb_i, _1));
_tree->create<subdev_spec_t>(mb_path / "tx_subdev_spec")
- .subscribe(boost::bind(&x300_impl::update_tx_subdev_spec, this, mb_i, _1));
+ .subscribe(boost::bind(&x300_impl::update_subdev_spec, this, "tx", mb_i, _1));
////////////////////////////////////////////////////////////////////
// and do the misc mboard sensors
diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp
index 62ec0f83a..ed8d29892 100644
--- a/host/lib/usrp/x300/x300_impl.hpp
+++ b/host/lib/usrp/x300/x300_impl.hpp
@@ -284,8 +284,13 @@ private:
void set_rx_fe_corrections(const uhd::fs_path &mb_path, const std::string &fe_name, const double lo_freq);
- void update_rx_subdev_spec(const size_t, const uhd::usrp::subdev_spec_t &spec);
- void update_tx_subdev_spec(const size_t, const uhd::usrp::subdev_spec_t &spec);
+ /*! Update the IQ MUX settings for the radio peripheral according to given subdev spec
+ *
+ * \param tx_rx "tx" or "rx", depending where you're setting the subdev spec
+ * \param mb_i Mainboard index number.
+ * \param spec Subdev spec
+ */
+ void update_subdev_spec(const std::string &tx_rx, const size_t mb_i, const uhd::usrp::subdev_spec_t &spec);
void set_tick_rate(mboard_members_t &, const double);
void update_tick_rate(mboard_members_t &, const double);
diff --git a/host/lib/usrp/x300/x300_io_impl.cpp b/host/lib/usrp/x300/x300_io_impl.cpp
index 603eb5704..9f4cdde7f 100644
--- a/host/lib/usrp/x300/x300_io_impl.cpp
+++ b/host/lib/usrp/x300/x300_io_impl.cpp
@@ -77,13 +77,14 @@ void x300_impl::update_tx_samp_rate(mboard_members_t &mb, const size_t dspno, co
/***********************************************************************
* Setup dboard muxing for IQ
**********************************************************************/
-void x300_impl::update_rx_subdev_spec(const size_t mb_i, const subdev_spec_t &spec)
+void x300_impl::update_subdev_spec(const std::string &tx_rx, const size_t mb_i, const subdev_spec_t &spec)
{
+ UHD_ASSERT_THROW(tx_rx == "tx" or tx_rx == "rx");
const std::string mb_name = boost::lexical_cast<std::string>(mb_i);
- fs_path root = "/mboards/"+mb_name+"/dboards";
+ fs_path root = "/mboards/" + mb_name + "/dboards";
//sanity checking
- validate_subdev_spec(_tree, spec, "rx", mb_name);
+ validate_subdev_spec(_tree, spec, tx_rx, mb_name);
UHD_ASSERT_THROW(spec.size() <= 2);
if (spec.size() > 0) UHD_ASSERT_THROW(spec[0].db_name == "A");
if (spec.size() > 1) UHD_ASSERT_THROW(spec[1].db_name == "B");
@@ -98,50 +99,24 @@ void x300_impl::update_rx_subdev_spec(const size_t mb_i, const subdev_spec_t &sp
//extract fe name
std::string fe_name;
if (i < spec.size()) fe_name = spec[i].sd_name;
- else fe_name = _tree->list(root / db_name / "rx_frontends").front();
+ else fe_name = _tree->list(root / db_name / (tx_rx + "_frontends")).front();
//extract connection
- const std::string conn = _tree->access<std::string>(root / db_name / "rx_frontends" / fe_name / "connection").get();
-
- //swap condition
- const bool fe_swapped = (conn == "QI" or conn == "Q");
- _mb[mb_i].radio_perifs[i].ddc->set_mux(conn, fe_swapped);
- //see usrp/io_impl.cpp if multiple DSPs share the frontend:
- _mb[mb_i].radio_perifs[i].rx_fe->set_mux(fe_swapped);
+ const std::string conn = _tree->access<std::string>(root / db_name / (tx_rx + "_frontends") / fe_name / "connection").get();
+
+ if (tx_rx == "tx") {
+ //swap condition
+ _mb[mb_i].radio_perifs[i].tx_fe->set_mux(conn);
+ } else {
+ //swap condition
+ const bool fe_swapped = (conn == "QI" or conn == "Q");
+ _mb[mb_i].radio_perifs[i].ddc->set_mux(conn, fe_swapped);
+ //see usrp/io_impl.cpp if multiple DSPs share the frontend:
+ _mb[mb_i].radio_perifs[i].rx_fe->set_mux(fe_swapped);
+ }
}
}
-void x300_impl::update_tx_subdev_spec(const size_t mb_i, const subdev_spec_t &spec)
-{
- const std::string mb_name = boost::lexical_cast<std::string>(mb_i);
- fs_path root = "/mboards/"+mb_name+"/dboards";
-
- //sanity checking
- validate_subdev_spec(_tree, spec, "tx", mb_name);
- UHD_ASSERT_THROW(spec.size() <= 2);
- if (spec.size() > 0) UHD_ASSERT_THROW(spec[0].db_name == "A");
- if (spec.size() > 1) UHD_ASSERT_THROW(spec[1].db_name == "B");
-
- //set the mux for this spec
- for (size_t i = 0; i < 2; i++)
- {
- //extract db name
- const std::string db_name = (i == 0)? "A" : "B";
- if (i < spec.size()) UHD_ASSERT_THROW(spec[i].db_name == db_name);
-
- //extract fe name
- std::string fe_name;
- if (i < spec.size()) fe_name = spec[i].sd_name;
- else fe_name = _tree->list(root / db_name / "tx_frontends").front();
-
- //extract connection
- const std::string conn = _tree->access<std::string>(root / db_name / "tx_frontends" / fe_name / "connection").get();
-
- //swap condition
- _mb[mb_i].radio_perifs[i].tx_fe->set_mux(conn);
-
- }
-}
/***********************************************************************
* VITA stuff