From adac03ceb88dc9d11f9bc29afbbd49c4981c48ea Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 19 May 2015 13:44:21 -0700 Subject: ad9361: Minor clarifications on req_rate and baseband_bw --- host/lib/usrp/common/ad9361_driver/ad9361_device.cpp | 6 ++++-- host/lib/usrp/common/ad9361_driver/ad9361_device.h | 11 +++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp index e3139cd39..413ec75a2 100644 --- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp +++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp @@ -1247,7 +1247,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 @@ -1629,7 +1629,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 diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.h b/host/lib/usrp/common/ad9361_driver/ad9361_device.h index bd4ad368f..a42c5ac9a 100644 --- a/host/lib/usrp/common/ad9361_driver/ad9361_device.h +++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.h @@ -112,8 +112,15 @@ private: //Members ad9361_io::sptr _io_iface; //Intermediate state double _rx_freq, _tx_freq, _req_rx_freq, _req_tx_freq; - double _baseband_bw, _bbpll_freq, _adcclock_freq; - 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; -- cgit v1.2.3