diff options
author | Josh Blum <josh@joshknows.com> | 2011-08-17 17:09:55 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-08-18 10:22:12 -0700 |
commit | e033fc3d7f6d3baad76af9c5aa9f7f3aaeffab39 (patch) | |
tree | 9f99d7a2dd0ccbf41467f79cc92073396f688054 /host/lib | |
parent | d934e68d6ca44e23ba6137a19642890fe91c7b4b (diff) | |
download | uhd-e033fc3d7f6d3baad76af9c5aa9f7f3aaeffab39.tar.gz uhd-e033fc3d7f6d3baad76af9c5aa9f7f3aaeffab39.tar.bz2 uhd-e033fc3d7f6d3baad76af9c5aa9f7f3aaeffab39.zip |
usrp: use the frontend BW to clip the overall tune range
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 49cbe522f..d0141108e 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -65,6 +65,18 @@ static void do_tune_freq_warning_message( } } +static meta_range_t make_overall_tune_range( + const meta_range_t &fe_range, + const meta_range_t &dsp_range, + const double bw +){ + return meta_range_t( + fe_range.start() + std::max(dsp_range.start(), -bw), + fe_range.stop() + std::min(dsp_range.stop(), bw), + dsp_range.step() + ); +} + /*********************************************************************** * Gain helper functions **********************************************************************/ @@ -442,9 +454,11 @@ public: } freq_range_t get_rx_freq_range(size_t chan){ - meta_range_t range = _tree->access<meta_range_t>(rx_rf_fe_root(chan) / "freq" / "range").get(); - meta_range_t dsp_range = _tree->access<meta_range_t>(rx_dsp_root(chan) / "freq" / "range").get(); - return meta_range_t(range.start() + dsp_range.start(), range.stop() + dsp_range.stop(), dsp_range.step()); + return make_overall_tune_range( + _tree->access<meta_range_t>(rx_rf_fe_root(chan) / "freq" / "range").get(), + _tree->access<meta_range_t>(rx_dsp_root(chan) / "freq" / "range").get(), + this->get_rx_bandwidth(chan) + ); } void set_rx_gain(double gain, const std::string &name, size_t chan){ @@ -550,9 +564,11 @@ public: } freq_range_t get_tx_freq_range(size_t chan){ - meta_range_t range = _tree->access<meta_range_t>(tx_rf_fe_root(chan) / "freq" / "range").get(); - meta_range_t dsp_range = _tree->access<meta_range_t>(tx_dsp_root(chan) / "freq" / "range").get(); - return meta_range_t(range.start() + dsp_range.start(), range.stop() + dsp_range.stop(), dsp_range.step()); + return make_overall_tune_range( + _tree->access<meta_range_t>(tx_rf_fe_root(chan) / "freq" / "range").get(), + _tree->access<meta_range_t>(tx_dsp_root(chan) / "freq" / "range").get(), + this->get_tx_bandwidth(chan) + ); } void set_tx_gain(double gain, const std::string &name, size_t chan){ |