aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/common/ad9361_driver
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-06-09 16:17:53 -0700
committerMartin Braun <martin.braun@ettus.com>2015-06-09 16:17:53 -0700
commit533548a681f0045f1194c4b47f857fa16314784d (patch)
treed5dbc598b17605d5c4be85fad08f1c766025bb6c /host/lib/usrp/common/ad9361_driver
parent13f9f07c42c4928ef3adcb1bbee3343198c9ecae (diff)
parent4d0dadb3cc0106c9026bc41d7d74d55918d13b43 (diff)
downloaduhd-533548a681f0045f1194c4b47f857fa16314784d.tar.gz
uhd-533548a681f0045f1194c4b47f857fa16314784d.tar.bz2
uhd-533548a681f0045f1194c4b47f857fa16314784d.zip
Merge branch 'maint'
Conflicts: host/lib/usrp/common/ad9361_ctrl.hpp host/lib/usrp/common/ad9361_driver/ad9361_device.h host/lib/usrp/e300/e300_remote_codec_ctrl.hpp
Diffstat (limited to 'host/lib/usrp/common/ad9361_driver')
-rw-r--r--host/lib/usrp/common/ad9361_driver/ad9361_device.cpp23
-rw-r--r--host/lib/usrp/common/ad9361_driver/ad9361_device.h14
2 files changed, 30 insertions, 7 deletions
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
index 8737837b3..85e81cf97 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
@@ -1140,7 +1140,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++) {
@@ -1337,7 +1337,7 @@ double ad9361_device_t::_setup_rates(const double rate)
/* If we make it into this function, then we are tuning to a new rate.
* Store the new rate. */
_req_clock_rate = rate;
- UHD_LOG << boost::format("[ad9361_device_t::_setup_rates] rate=%d\n") % rate;
+ UHD_LOG << boost::format("[ad9361_device_t::_setup_rates] rate=%.6d\n") % rate;
/* Set the decimation and interpolation values in the RX and TX chains.
* This also switches filters in / out. Note that all transmitters and
@@ -1734,7 +1734,9 @@ double ad9361_device_t::set_clock_rate(const double req_rate)
* starts up. This prevents that, and any bugs in user code that request
* the same rate over and over. */
if (freq_is_nearly_equal(req_rate, _req_clock_rate)) {
- return _baseband_bw; // IJB. Should this not return req_rate?
+ // We return _baseband_bw, because that's closest to the
+ // actual value we're currently running.
+ return _baseband_bw;
}
/* We must be in the SLEEP / WAIT state to do this. If we aren't already
@@ -1966,10 +1968,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 0c7a7e4f7..1c5c97829 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_device.h
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.h
@@ -81,6 +81,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,
@@ -213,10 +216,17 @@ private: //Members
//Intermediate state
double _rx_freq, _tx_freq, _req_rx_freq, _req_tx_freq;
double _last_calibration_freq;
- double _baseband_bw, _bbpll_freq, _adcclock_freq;
double _rx_analog_bw, _tx_analog_bw, _rx_bb_lp_bw, _tx_bb_lp_bw;
double _rx_tia_lp_bw, _tx_sec_lp_bw;
- double _req_clock_rate, _req_coreclk;
+ //! Current baseband sampling rate (this is the actual rate the device is
+ // is running at)
+ double _baseband_bw;
+ double _bbpll_freq, _adcclock_freq;
+ //! This was the last clock rate value that was requested.
+ // It is cached so we don't need to re-set the clock rate
+ // if another call to set_clock_rate() actually has the same value.
+ double _req_clock_rate;
+ double _req_coreclk;
boost::uint16_t _rx_bbf_tunediv;
boost::uint8_t _curr_gain_table;
double _rx1_gain, _rx2_gain, _tx1_gain, _tx2_gain;