summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-uhd/grc/gen_uhd_usrp_blocks.py43
-rw-r--r--gr-uhd/include/gr_uhd_usrp_sink.h48
-rw-r--r--gr-uhd/include/gr_uhd_usrp_source.h48
-rw-r--r--gr-uhd/lib/gr_uhd_usrp_sink.cc48
-rw-r--r--gr-uhd/lib/gr_uhd_usrp_source.cc48
5 files changed, 220 insertions, 15 deletions
diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py
index 2a9e2e4ec..b57a6cfbe 100644
--- a/gr-uhd/grc/gen_uhd_usrp_blocks.py
+++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py
@@ -43,19 +43,12 @@ self.\$(id).set_clock_rate(\$clock_rate, uhd.ALL_MBOARDS)
\#end if
#for $m in range($max_mboards)
########################################################################
-\#if \$num_mboards() > $m and \$ref_source$(m)() == 'external'
-self.\$(id).set_clock_config(uhd.clock_config.external(), $m)
+\#if \$num_mboards() > $m and \$clock_source$(m)()
+self.\$(id).set_clock_source(\$clock_source$(m), $m)
\#end if
########################################################################
-\#if \$num_mboards() > $m and \$ref_source$(m)() == 'internal'
-self.\$(id).set_clock_config(uhd.clock_config.internal(), $m)
-\#end if
-########################################################################
-\#if \$num_mboards() > $m and \$ref_source$(m)() == 'mimo'
-_config = uhd.clock_config()
-_config.ref_source = uhd.clock_config.REF_MIMO
-_config.pps_source = uhd.clock_config.PPS_MIMO
-self.\$(id).set_clock_config(_config, $m)
+\#if \$num_mboards() > $m and \$time_source$(m)()
+self.\$(id).set_time_source(\$time_source$(m), $m)
\#end if
########################################################################
\#if \$num_mboards() > $m and \$sd_spec$(m)()
@@ -221,14 +214,14 @@ self.\$(id).set_bandwidth(\$bw$(n), $n)
</param>
#for $m in range($max_mboards)
<param>
- <name>Mb$(m): Ref Source</name>
- <key>ref_source$(m)</key>
+ <name>Mb$(m): Clock Source</name>
+ <key>clock_source$(m)</key>
<value></value>
- <type>enum</type>
+ <type>string</type>
<hide>
\#if not \$num_mboards() > $m
all
- \#elif \$ref_source$(m)()
+ \#elif \$clock_source$(m)()
none
\#else
part
@@ -238,6 +231,26 @@ self.\$(id).set_bandwidth(\$bw$(n), $n)
<option><name>Internal</name><key>internal</key></option>
<option><name>External</name><key>external</key></option>
<option><name>MIMO Cable</name><key>mimo</key></option>
+ <option><name>O/B GPSDO</name><key>gpsdo</key></option>
+ </param>
+ <param>
+ <name>Mb$(m): Time Source</name>
+ <key>time_source$(m)</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ \#if not \$num_mboards() > $m
+ all
+ \#elif \$time_source$(m)()
+ none
+ \#else
+ part
+ \#end if
+ </hide>
+ <option><name>Default</name><key></key></option>
+ <option><name>External</name><key>external</key></option>
+ <option><name>MIMO Cable</name><key>mimo</key></option>
+ <option><name>O/B GPSDO</name><key>gpsdo</key></option>
</param>
<param>
<name>Mb$(m): Subdev Spec</name>
diff --git a/gr-uhd/include/gr_uhd_usrp_sink.h b/gr-uhd/include/gr_uhd_usrp_sink.h
index 4ddb51920..8c1056a79 100644
--- a/gr-uhd/include/gr_uhd_usrp_sink.h
+++ b/gr-uhd/include/gr_uhd_usrp_sink.h
@@ -291,12 +291,60 @@ public:
/*!
* Set the clock configuration.
+ * DEPRECATED for set_time/clock_source.
* \param clock_config the new configuration
* \param mboard the motherboard index 0 to M-1
*/
virtual void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard = 0) = 0;
/*!
+ * Set the time source for the usrp device.
+ * This sets the method of time synchronization,
+ * typically a pulse per second or an encoded time.
+ * Typical options for source: external, MIMO.
+ * \param source a string representing the time source
+ * \param mboard which motherboard to set the config
+ */
+ virtual void set_time_source(const std::string &source, const size_t mboard = 0) = 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(const size_t mboard) = 0;
+
+ /*!
+ * Get a list of possible time sources.
+ * \param mboard which motherboard to get the list
+ * \return a vector of strings for possible settings
+ */
+ virtual std::vector<std::string> get_time_sources(const size_t mboard) = 0;
+
+ /*!
+ * Set the clock source for the usrp device.
+ * This sets the source for a 10 Mhz reference clock.
+ * Typical options for source: internal, external, MIMO.
+ * \param source a string representing the clock source
+ * \param mboard which motherboard to set the config
+ */
+ virtual void set_clock_source(const std::string &source, const size_t mboard = 0) = 0;
+
+ /*!
+ * Get the currently set clock source.
+ * \param mboard which motherboard to get the config
+ * \return the string representing the clock source
+ */
+ virtual std::string get_clock_source(const size_t mboard) = 0;
+
+ /*!
+ * Get a list of possible clock sources.
+ * \param mboard which motherboard to get the list
+ * \return a vector of strings for possible settings
+ */
+ virtual std::vector<std::string> get_clock_sources(const size_t mboard) = 0;
+
+ /*!
* Get the master clock rate.
* \param mboard the motherboard index 0 to M-1
* \return the clock rate in Hz
diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h
index e0c2cfe50..7a861e315 100644
--- a/gr-uhd/include/gr_uhd_usrp_source.h
+++ b/gr-uhd/include/gr_uhd_usrp_source.h
@@ -283,11 +283,59 @@ public:
/*!
* Set the clock configuration.
+ * DEPRECATED for set_time/clock_source.
* \param clock_config the new configuration
* \param mboard the motherboard index 0 to M-1
*/
virtual void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard = 0) = 0;
+ /*!
+ * Set the time source for the usrp device.
+ * This sets the method of time synchronization,
+ * typically a pulse per second or an encoded time.
+ * Typical options for source: external, MIMO.
+ * \param source a string representing the time source
+ * \param mboard which motherboard to set the config
+ */
+ virtual void set_time_source(const std::string &source, const size_t mboard = 0) = 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(const size_t mboard) = 0;
+
+ /*!
+ * Get a list of possible time sources.
+ * \param mboard which motherboard to get the list
+ * \return a vector of strings for possible settings
+ */
+ virtual std::vector<std::string> get_time_sources(const size_t mboard) = 0;
+
+ /*!
+ * Set the clock source for the usrp device.
+ * This sets the source for a 10 Mhz reference clock.
+ * Typical options for source: internal, external, MIMO.
+ * \param source a string representing the clock source
+ * \param mboard which motherboard to set the config
+ */
+ virtual void set_clock_source(const std::string &source, const size_t mboard = 0) = 0;
+
+ /*!
+ * Get the currently set clock source.
+ * \param mboard which motherboard to get the config
+ * \return the string representing the clock source
+ */
+ virtual std::string get_clock_source(const size_t mboard) = 0;
+
+ /*!
+ * Get a list of possible clock sources.
+ * \param mboard which motherboard to get the list
+ * \return a vector of strings for possible settings
+ */
+ virtual std::vector<std::string> get_clock_sources(const size_t mboard) = 0;
+
/*!
* Get the master clock rate.
* \param mboard the motherboard index 0 to M-1
diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc
index 82352c7d4..cd40dac20 100644
--- a/gr-uhd/lib/gr_uhd_usrp_sink.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc
@@ -162,6 +162,54 @@ public:
return _dev->set_clock_config(clock_config, mboard);
}
+ void set_time_source(const std::string &source, const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->set_time_source(source, mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
+ std::string get_time_source(const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->get_time_source(mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
+ std::vector<std::string> get_time_sources(const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->get_time_sources(mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
+ void set_clock_source(const std::string &source, const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->set_clock_source(source, mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
+ std::string get_clock_source(const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->get_clock_source(mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
+ std::vector<std::string> get_clock_sources(const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->get_clock_sources(mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
double get_clock_rate(size_t mboard){
return _dev->get_master_clock_rate(mboard);
}
diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc
index 207e049d8..4f46fce79 100644
--- a/gr-uhd/lib/gr_uhd_usrp_source.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_source.cc
@@ -166,6 +166,54 @@ public:
return _dev->set_clock_config(clock_config, mboard);
}
+ void set_time_source(const std::string &source, const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->set_time_source(source, mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
+ std::string get_time_source(const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->get_time_source(mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
+ std::vector<std::string> get_time_sources(const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->get_time_sources(mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
+ void set_clock_source(const std::string &source, const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->set_clock_source(source, mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
+ std::string get_clock_source(const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->get_clock_source(mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
+ std::vector<std::string> get_clock_sources(const size_t mboard){
+ #ifdef UHD_USRP_MULTI_USRP_REF_SOURCES_API
+ return _dev->get_clock_sources(mboard);
+ #else
+ throw std::runtime_error("not implemented in this version");
+ #endif
+ }
+
double get_clock_rate(size_t mboard){
return _dev->get_master_clock_rate(mboard);
}