diff options
Diffstat (limited to 'host/lib/usrp/common')
-rw-r--r-- | host/lib/usrp/common/ad9361_ctrl.cpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/common/ad9361_ctrl.hpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/common/ad9361_driver/ad9361_device.cpp | 17 | ||||
-rw-r--r-- | host/lib/usrp/common/ad9361_driver/ad9361_device.h | 3 |
4 files changed, 29 insertions, 3 deletions
diff --git a/host/lib/usrp/common/ad9361_ctrl.cpp b/host/lib/usrp/common/ad9361_ctrl.cpp index bedd2eb32..65e8e2df9 100644 --- a/host/lib/usrp/common/ad9361_ctrl.cpp +++ b/host/lib/usrp/common/ad9361_ctrl.cpp @@ -149,6 +149,15 @@ public: return _device.tune(direction, value); } + //! get the current frequency for the given frontend + double get_freq(const std::string &which) + { + boost::lock_guard<boost::mutex> lock(_mutex); + + ad9361_device_t::direction_t direction = _get_direction_from_antenna(which); + return _device.get_freq(direction); + } + //! turn on/off data port loopback void data_port_loopback(const bool on) { diff --git a/host/lib/usrp/common/ad9361_ctrl.hpp b/host/lib/usrp/common/ad9361_ctrl.hpp index c5718302f..b7d7b8e26 100644 --- a/host/lib/usrp/common/ad9361_ctrl.hpp +++ b/host/lib/usrp/common/ad9361_ctrl.hpp @@ -95,6 +95,9 @@ public: //! tune the given frontend, return the exact value virtual double tune(const std::string &which, const double value) = 0; + //! get the current frequency for the given frontend + virtual double get_freq(const std::string &which) = 0; + //! turn on/off data port loopback virtual void data_port_loopback(const bool on) = 0; diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp index 413ec75a2..e63460730 100644 --- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp +++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp @@ -1050,7 +1050,7 @@ double ad9361_device_t::_tune_bbvco(const double rate) const double vcomin = 672e6; double vcorate; int vcodiv; - + /* Iterate over VCO dividers until appropriate divider is found. */ int i = 1; for (; i <= 6; i++) { @@ -1855,10 +1855,21 @@ double ad9361_device_t::tune(direction_t direction, const double value) return tune_freq; } +/* Get the current RX or TX frequency. */ +double ad9361_device_t::get_freq(direction_t direction) +{ + boost::lock_guard<boost::recursive_mutex> lock(_mutex); + + if (direction == RX) + return _rx_freq; + else + return _tx_freq; +} + /* Set the gain of RX1, RX2, TX1, or TX2. * - * Note that the 'value' passed to this function is the gain index - * for RX. Also note that the RX chains are done in terms of gain, and + * Note that the 'value' passed to this function is the gain index + * for RX. Also note that the RX chains are done in terms of gain, and * the TX chains are done in terms of attenuation. */ double ad9361_device_t::set_gain(direction_t direction, chain_t chain, const double value) { diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.h b/host/lib/usrp/common/ad9361_driver/ad9361_device.h index a42c5ac9a..71ce78da7 100644 --- a/host/lib/usrp/common/ad9361_driver/ad9361_device.h +++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.h @@ -49,6 +49,9 @@ public: * After tuning, it runs any appropriate calibrations. */ double tune(direction_t direction, const double value); + /* Get the current RX or TX frequency. */ + double get_freq(direction_t direction); + /* Set the gain of RX1, RX2, TX1, or TX2. * * Note that the 'value' passed to this function is the actual gain value, |