diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-05-04 16:35:45 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-05-08 10:43:25 -0700 |
commit | f4b8879064f6090e2233165216e78944070b6a06 (patch) | |
tree | 6169bc46e6dcdf904734de4ceb1e35ca7a5cc6b9 /host/lib | |
parent | 3e10b9ed77fdeee88b8f72442058169afa13d439 (diff) | |
download | uhd-f4b8879064f6090e2233165216e78944070b6a06.tar.gz uhd-f4b8879064f6090e2233165216e78944070b6a06.tar.bz2 uhd-f4b8879064f6090e2233165216e78944070b6a06.zip |
basicrx/lfrx: Enable frontend muxing on X3x0
The selection of frontend modes (AB, A, B, BA) is now enabled on X3x0.
Unlike older USRPs, switching the frontend is done through the antenna
API (e.g., usrp->set_rx_antenna("A")).
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/dboard/db_basic_and_lf.cpp | 62 |
1 files changed, 46 insertions, 16 deletions
diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp index 24051406e..81a7aa534 100644 --- a/host/lib/usrp/dboard/db_basic_and_lf.cpp +++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp @@ -58,6 +58,8 @@ public: virtual ~basic_rx(void); private: + void set_rx_ant(const std::string& ant); + double _max_freq; }; @@ -99,33 +101,49 @@ UHD_STATIC_BLOCK(reg_basic_and_lf_dboards){ /*********************************************************************** * Basic and LF RX dboard **********************************************************************/ -basic_rx::basic_rx(ctor_args_t args, double max_freq) : rx_dboard_base(args){ - _max_freq = max_freq; - //this->get_iface()->set_clock_enabled(dboard_iface::UNIT_RX, true); +basic_rx::basic_rx(ctor_args_t args, double max_freq) + : rx_dboard_base(args), + _max_freq(max_freq) +{ + const std::string fe_name(get_subdev_name()); + const std::string fe_conn(sd_name_to_conn[fe_name]); + const std::string db_name(str( + boost::format("%s (%s)") + % ((get_rx_id() == BASIC_RX_PID) ? "BasicRX" : "LFRX") + % fe_name)); + UHD_LOG_TRACE("BASICRX", + "Initializing driver for: " << db_name << + " IQ connection type: " << fe_conn); + const bool has_fe_conn_settings = + get_iface()->has_set_fe_connection(dboard_iface::UNIT_RX); + UHD_LOG_TRACE("BASICRX", + "Access to FE connection settings: " + << (has_fe_conn_settings ? "Yes" : "No")); + + std::vector<std::string> antenna_options = has_fe_conn_settings + ? sd_name_to_conn.keys() + : std::vector<std::string>(1, ""); //////////////////////////////////////////////////////////////////// // Register properties //////////////////////////////////////////////////////////////////// - if (get_rx_id() == BASIC_RX_PID) { - this->get_rx_subtree()->create<std::string>("name").set( - std::string(str(boost::format("BasicRX (%s)") % get_subdev_name() - ))); - } - else{ - this->get_rx_subtree()->create<std::string>("name").set( - std::string(str(boost::format("LFRX (%s)") % get_subdev_name() - ))); - } - + this->get_rx_subtree()->create<std::string>("name").set(db_name); this->get_rx_subtree()->create<int>("gains"); //phony property so this dir exists this->get_rx_subtree()->create<double>("freq/value") .set_publisher([](){ return 0.0; }); this->get_rx_subtree()->create<meta_range_t>("freq/range") .set(freq_range_t(-_max_freq, +_max_freq)); this->get_rx_subtree()->create<std::string>("antenna/value") - .set(""); + .set(has_fe_conn_settings ? fe_name : ""); + if (has_fe_conn_settings) { + this->get_rx_subtree()->access<std::string>("antenna/value") + .add_coerced_subscriber([this](const std::string& ant){ + this->set_rx_ant(ant); + }) + ; + } this->get_rx_subtree()->create<std::vector<std::string>>("antenna/options") - .set({""}); + .set(antenna_options); this->get_rx_subtree()->create<int>("sensors"); //phony property so this dir exists this->get_rx_subtree()->create<std::string>("connection") .set(sd_name_to_conn[get_subdev_name()]); @@ -153,6 +171,18 @@ basic_rx::~basic_rx(void){ /* NOP */ } +void basic_rx::set_rx_ant(const std::string& ant) +{ + UHD_ASSERT_THROW(get_iface()->has_set_fe_connection(dboard_iface::UNIT_RX)); + UHD_LOG_TRACE("BASICRX", + "Setting antenna value to: " << ant); + get_iface()->set_fe_connection( + dboard_iface::UNIT_RX, + get_subdev_name(), + usrp::fe_connection_t(sd_name_to_conn[ant], 0.0 /* IF */) + ); +} + /*********************************************************************** * Basic and LF TX dboard **********************************************************************/ |