aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-10-27 10:45:15 -0700
committerJosh Blum <josh@joshknows.com>2010-10-27 10:45:15 -0700
commit211e190619652be145fdcd79cd54eda0e84d3313 (patch)
tree8bcf74b1086e166d3dbaf3ebfc3cf2a48c2fc3ec
parenta7840ebb3f7d7f807d05059e2809eb45cff04899 (diff)
downloaduhd-211e190619652be145fdcd79cd54eda0e84d3313.tar.gz
uhd-211e190619652be145fdcd79cd54eda0e84d3313.tar.bz2
uhd-211e190619652be145fdcd79cd54eda0e84d3313.zip
usrp: added a time sync check for multi usrp
-rw-r--r--host/include/uhd/usrp/multi_usrp.hpp8
-rw-r--r--host/lib/usrp/multi_usrp.cpp9
2 files changed, 17 insertions, 0 deletions
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp
index 5380d177d..98ba07fc0 100644
--- a/host/include/uhd/usrp/multi_usrp.hpp
+++ b/host/include/uhd/usrp/multi_usrp.hpp
@@ -145,6 +145,14 @@ public:
virtual void set_time_unknown_pps(const time_spec_t &time_spec) = 0;
/*!
+ * Are the times across all motherboards in this configuration synchronized?
+ * Checks that all time registers are approximately close but not exact,
+ * given that the RTT may varying for a control packet transaction.
+ * \return true when all motherboards time registers are in sync
+ */
+ virtual bool get_time_synchronized(void) = 0;
+
+ /*!
* Issue a stream command to the usrp device.
* This tells the usrp to send samples into the host.
* See the documentation for stream_cmd_t for more info.
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 024a6152d..876f1a3fc 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -154,6 +154,15 @@ public:
}
}
+ bool get_time_synchronized(void){
+ for (size_t m = 1; m < get_num_mboards(); m++){
+ time_spec_t time_0 = _mboard(0)[MBOARD_PROP_TIME_NOW].as<time_spec_t>();
+ time_spec_t time_i = _mboard(m)[MBOARD_PROP_TIME_NOW].as<time_spec_t>();
+ if (time_i < time_0 or (time_i - time_0) > time_spec_t(0.01)) return false;
+ }
+ return true;
+ }
+
void issue_stream_cmd(const stream_cmd_t &stream_cmd){
for (size_t m = 0; m < get_num_mboards(); m++){
_mboard(m)[MBOARD_PROP_STREAM_CMD] = stream_cmd;