aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-03-20 18:11:20 -0700
committerMartin Braun <martin.braun@ettus.com>2017-03-21 14:31:08 -0700
commitaff6165dc938fe072d4872b65be146e6d3f75bec (patch)
treeae396bcb9f01b65ed3b1eb6bcae6436243d4f4bd /host
parent255b04dd50f6aa4330be75c57c661f70f11e50cf (diff)
downloaduhd-aff6165dc938fe072d4872b65be146e6d3f75bec.tar.gz
uhd-aff6165dc938fe072d4872b65be146e6d3f75bec.tar.bz2
uhd-aff6165dc938fe072d4872b65be146e6d3f75bec.zip
rfnoc: Add API calls for time/clock control
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/rfnoc/radio_ctrl.hpp47
-rw-r--r--host/lib/rfnoc/radio_ctrl_impl.cpp31
-rw-r--r--host/lib/rfnoc/radio_ctrl_impl.hpp6
3 files changed, 83 insertions, 1 deletions
diff --git a/host/include/uhd/rfnoc/radio_ctrl.hpp b/host/include/uhd/rfnoc/radio_ctrl.hpp
index fe9636b32..67ea4c069 100644
--- a/host/include/uhd/rfnoc/radio_ctrl.hpp
+++ b/host/include/uhd/rfnoc/radio_ctrl.hpp
@@ -200,6 +200,53 @@ public:
*/
virtual time_spec_t get_time_last_pps() = 0;
+ /*!
+ * Set the time source for this radio.
+ *
+ * May affect other radio blocks.
+ *
+ * \param source A string representing the time source
+ * \throws uhd::value_error if the value can't be applied
+ */
+ virtual void set_time_source(const std::string &source) = 0;
+
+ /*!
+ * Get the currently set time source.
+ * \param mboard which motherboard to get the config
+ * \return the string representing the time source
+ */
+ virtual std::string get_time_source() = 0;
+
+ /*!
+ * Get a list of possible time sources.
+ *
+ * \return a vector of strings for possible settings
+ */
+ virtual std::vector<std::string> get_time_sources() = 0;
+
+ /*!
+ * Set the clock source for the usrp device (for reference clock).
+ *
+ * Typical options for source: internal, external.
+ *
+ * \param source a string representing the clock source
+ */
+ virtual void set_clock_source(const std::string &source) = 0;
+
+ /*!
+ * Get the currently set clock source.
+ *
+ * \return the string representing the clock source
+ */
+ virtual std::string get_clock_source() = 0;
+
+ /*!
+ * Get a list of possible clock sources.
+ *
+ * \return a vector of strings for possible settings
+ */
+ virtual std::vector<std::string> get_clock_sources() = 0;
+
/*! Given a frontend name, return the channel mapping.
*
* E.g.: For a TwinRX board, there's two frontends, '0' and '1', which
diff --git a/host/lib/rfnoc/radio_ctrl_impl.cpp b/host/lib/rfnoc/radio_ctrl_impl.cpp
index 262f1eb73..a143bb248 100644
--- a/host/lib/rfnoc/radio_ctrl_impl.cpp
+++ b/host/lib/rfnoc/radio_ctrl_impl.cpp
@@ -363,7 +363,6 @@ void radio_ctrl_impl::set_time_next_pps(const time_spec_t &time_spec)
_time64->set_time_next_pps(time_spec);
}
-
time_spec_t radio_ctrl_impl::get_time_now()
{
return _time64->get_time_now();
@@ -374,3 +373,33 @@ time_spec_t radio_ctrl_impl::get_time_last_pps()
return _time64->get_time_last_pps();
}
+void radio_ctrl_impl::set_time_source(const std::string &source)
+{
+ _tree->access<std::string>("time_source/value").set(source);
+}
+
+std::string radio_ctrl_impl::get_time_source()
+{
+ return _tree->access<std::string>("time_source/value").get();
+}
+
+std::vector<std::string> radio_ctrl_impl::get_time_sources()
+{
+ return _tree->access<std::vector<std::string>>("time_source/options").get();
+}
+
+void radio_ctrl_impl::set_clock_source(const std::string &source)
+{
+ _tree->access<std::string>("clock_source/value").set(source);
+}
+
+std::string radio_ctrl_impl::get_clock_source()
+{
+ return _tree->access<std::string>("clock_source/value").get();
+}
+
+std::vector<std::string> radio_ctrl_impl::get_clock_sources()
+{
+ return _tree->access<std::vector<std::string>>("clock_source/options").get();
+}
+
diff --git a/host/lib/rfnoc/radio_ctrl_impl.hpp b/host/lib/rfnoc/radio_ctrl_impl.hpp
index 4946827d7..b31239482 100644
--- a/host/lib/rfnoc/radio_ctrl_impl.hpp
+++ b/host/lib/rfnoc/radio_ctrl_impl.hpp
@@ -76,6 +76,12 @@ public:
void set_time_sync(const uhd::time_spec_t &time);
time_spec_t get_time_now();
time_spec_t get_time_last_pps();
+ virtual void set_time_source(const std::string &source);
+ virtual std::string get_time_source();
+ virtual std::vector<std::string> get_time_sources();
+ virtual void set_clock_source(const std::string &source);
+ virtual std::string get_clock_source();
+ virtual std::vector<std::string> get_clock_sources();
/***********************************************************************
* Block control API calls