aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-03-28 14:39:30 -0700
committerMartin Braun <martin.braun@ettus.com>2018-04-03 17:03:14 -0700
commit1d0c25ef7d9fc9f0a2e1d171ade1adf56abaf03c (patch)
tree5e108702c0245da675b876f6085f759eac097bb8
parentd110e64f82fe4413393f8078d82ae0468cef283a (diff)
downloaduhd-1d0c25ef7d9fc9f0a2e1d171ade1adf56abaf03c.tar.gz
uhd-1d0c25ef7d9fc9f0a2e1d171ade1adf56abaf03c.tar.bz2
uhd-1d0c25ef7d9fc9f0a2e1d171ade1adf56abaf03c.zip
multi_usrp: Add API call to query the clock rate range
-rw-r--r--host/include/uhd/usrp/multi_usrp.hpp20
-rw-r--r--host/lib/usrp/multi_usrp.cpp17
2 files changed, 37 insertions, 0 deletions
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp
index 2490cc7f8..c70448c3f 100644
--- a/host/include/uhd/usrp/multi_usrp.hpp
+++ b/host/include/uhd/usrp/multi_usrp.hpp
@@ -181,6 +181,26 @@ public:
*/
virtual double get_master_clock_rate(size_t mboard = 0) = 0;
+ /*! Return the range within which the master clock rate can be set for this
+ * session
+ *
+ * Note that many USRPs do not actually support setting the master clock
+ * rate during a running session. In this case, the range will consist of
+ * a single value, which is the current master clock rate.
+ * Values from this range are valid/sensible inputs to
+ * set_master_clock_rate(), although keep in mind that the latter coerces.
+ *
+ * Examples:
+ * - The B200 series' master clock rate can be changed at runtime and
+ * will report the true range of supported values
+ * - The X300 series has _two_ discrete options for the clock rate, but will
+ * always return the clock rate which the USRP was initialized to because
+ * it cannot be changed at runtime
+ * - The N200 series does not have a configurable clock rate, and will
+ * always return the same single value as a range
+ */
+ virtual meta_range_t get_master_clock_rate_range(const size_t mboard = 0) = 0;
+
/*!
* Get a printable summary for this USRP configuration.
* \return a printable string
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 3af762c82..f9509b7f3 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -465,6 +465,23 @@ public:
return _tree->access<double>(mb_root(mboard) / "tick_rate").get();
}
+ meta_range_t get_master_clock_rate_range(const size_t mboard)
+ {
+ if (_tree->exists(mb_root(mboard) / "tick_rate/range")) {
+ return _tree->access<meta_range_t>(
+ mb_root(mboard) / "tick_rate/range"
+ ).get();
+ }
+ // The USRP may not have a range defined, in which case we create a
+ // fake range with a single value:
+ const double tick_rate = get_master_clock_rate(mboard);
+ return meta_range_t(
+ tick_rate,
+ tick_rate,
+ 0
+ );
+ }
+
std::string get_pp_string(void){
std::string buff = str(boost::format(
"%s USRP:\n"