aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/common/ad9361_ctrl.cpp
diff options
context:
space:
mode:
authorVidush <vidush.vishwanath@ettus.com>2018-04-24 11:21:33 -0700
committerMartin Braun <martin.braun@ettus.com>2018-04-27 11:23:59 -0700
commit2ef60a1b66aded5e967769bf31a97d21c693e805 (patch)
treefdb781a782a6448c73e5c91ab1949a4d2586ed21 /host/lib/usrp/common/ad9361_ctrl.cpp
parentf2e68440d6ebd7e8b0bc0e0bd9562625f295da37 (diff)
downloaduhd-2ef60a1b66aded5e967769bf31a97d21c693e805.tar.gz
uhd-2ef60a1b66aded5e967769bf31a97d21c693e805.tar.bz2
uhd-2ef60a1b66aded5e967769bf31a97d21c693e805.zip
ad9361: Fix bandwidth warnings and ranges
Allows full bandwidth range to user. Reviewed-by: Michael West <michael.west@ettus.com> Reviewed-by: Martin Braun <martin.braun@ettus.com>
Diffstat (limited to 'host/lib/usrp/common/ad9361_ctrl.cpp')
-rw-r--r--host/lib/usrp/common/ad9361_ctrl.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/host/lib/usrp/common/ad9361_ctrl.cpp b/host/lib/usrp/common/ad9361_ctrl.cpp
index ea3fdc416..2b6821fc0 100644
--- a/host/lib/usrp/common/ad9361_ctrl.cpp
+++ b/host/lib/usrp/common/ad9361_ctrl.cpp
@@ -233,10 +233,24 @@ public:
double set_bw_filter(const std::string &which, const double bw)
{
- boost::lock_guard<boost::mutex> lock(_mutex);
-
ad9361_device_t::direction_t direction = _get_direction_from_antenna(which);
- return _device.set_bw_filter(direction, bw);
+ double actual_bw = bw;
+
+ {
+ boost::lock_guard<boost::mutex> lock(_mutex);
+ actual_bw = _device.set_bw_filter(direction, bw);
+ }
+
+ const double min_bw = ad9361_device_t::AD9361_MIN_BW;
+ const double max_bw = ad9361_device_t::AD9361_MAX_BW;
+ if (bw < min_bw or bw > max_bw)
+ {
+ UHD_LOGGER_WARNING("AD936X") << boost::format(
+ "The requested bandwidth %f MHz is out of range (%f - %f MHz).\n"
+ "The bandwidth has been forced to %f MHz.\n"
+ ) % (bw/1e6) % (min_bw/1e6) % (max_bw/1e6) % (actual_bw/1e6);
+ }
+ return actual_bw;
}
std::vector<std::string> get_filter_names(const std::string &which)