diff options
author | Martin Braun <martin.braun@ettus.com> | 2016-12-01 16:36:59 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2016-12-06 11:55:43 -0800 |
commit | eb2ba5ea16445c1cef1fb8dbef72d78dcf8c68a3 (patch) | |
tree | 4c18d2ca5aebdb27e3d0efe11b3fb10bf395edbc /host | |
parent | 5de7ab51086f161882c3ca4050a8e50c2c341132 (diff) | |
download | uhd-eb2ba5ea16445c1cef1fb8dbef72d78dcf8c68a3.tar.gz uhd-eb2ba5ea16445c1cef1fb8dbef72d78dcf8c68a3.tar.bz2 uhd-eb2ba5ea16445c1cef1fb8dbef72d78dcf8c68a3.zip |
x300: Adding warning for sampling rate coercion
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/x300/x300_radio_ctrl_impl.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp index 4bb9c9fb5..bb17eb2ec 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp @@ -26,6 +26,7 @@ #include <uhd/usrp/dboard_iface.hpp> #include <uhd/rfnoc/node_ctrl_base.hpp> #include <uhd/transport/chdr.hpp> +#include <uhd/utils/math.hpp> #include <boost/algorithm/string.hpp> #include <boost/make_shared.hpp> #include <boost/date_time/posix_time/posix_time_io.hpp> @@ -167,10 +168,14 @@ x300_radio_ctrl_impl::~x300_radio_ctrl_impl() /**************************************************************************** * API calls ***************************************************************************/ -double x300_radio_ctrl_impl::set_rate(double /* rate */) +double x300_radio_ctrl_impl::set_rate(double rate) { + const double actual_rate = get_rate(); + if (not uhd::math::frequencies_are_equal(rate, actual_rate)) { + UHD_MSG(warning) << "[X300 Radio] Requesting invalid sampling rate from device: " << rate/1e6 << " MHz. Actual rate is: " << actual_rate/1e6 << " MHz." << std::endl; + } // On X3x0, tick rate can't actually be changed at runtime - return get_rate(); + return actual_rate; } void x300_radio_ctrl_impl::set_fe_cmd_time(const time_spec_t &time, const size_t chan) |