aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/multi_usrp.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-01-04 16:49:34 -0800
committerJosh Blum <josh@joshknows.com>2011-01-04 16:49:34 -0800
commitfabfa8d9dd6670afb9c621b9ee12f8d602d7ccda (patch)
tree107e43e35008e6df0d33b0e8a8f5f52d28a91493 /host/lib/usrp/multi_usrp.cpp
parent4711829f03ee2fcd1c4e9dc2a353af0e35497180 (diff)
parent7b0b2924d52bbbcb4660cad5d8070074426011ce (diff)
downloaduhd-fabfa8d9dd6670afb9c621b9ee12f8d602d7ccda.tar.gz
uhd-fabfa8d9dd6670afb9c621b9ee12f8d602d7ccda.tar.bz2
uhd-fabfa8d9dd6670afb9c621b9ee12f8d602d7ccda.zip
Merge branch 'cordic_policy' into next
Conflicts: host/lib/usrp/usrp2/usrp2_regs.cpp host/lib/usrp/usrp2/usrp2_regs.hpp
Diffstat (limited to 'host/lib/usrp/multi_usrp.cpp')
-rw-r--r--host/lib/usrp/multi_usrp.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 876f1a3fc..5610bcd3f 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -117,26 +117,31 @@ public:
return _mboard(0)[MBOARD_PROP_TIME_NOW].as<time_spec_t>();
}
+ time_spec_t get_time_last_pps(void){
+ return _mboard(0)[MBOARD_PROP_TIME_PPS].as<time_spec_t>();
+ }
+
void set_time_next_pps(const time_spec_t &time_spec){
for (size_t m = 0; m < get_num_mboards(); m++){
- _mboard(m)[MBOARD_PROP_TIME_NEXT_PPS] = time_spec;
+ _mboard(m)[MBOARD_PROP_TIME_PPS] = time_spec;
}
}
void set_time_unknown_pps(const time_spec_t &time_spec){
- std::cout << "Set time with unknown pps edge:" << std::endl;
- std::cout << " 1) set times next pps (race condition)" << std::endl;
- set_time_next_pps(time_spec);
- boost::this_thread::sleep(boost::posix_time::seconds(1));
-
- std::cout << " 2) catch seconds rollover at pps edge" << std::endl;
- time_t last_secs = 0, curr_secs = 0;
- while(curr_secs == last_secs){
- last_secs = curr_secs;
- curr_secs = get_time_now().get_full_secs();
+ std::cout << " 1) catch time transition at pps edge" << std::endl;
+ time_spec_t time_start = get_time_now();
+ time_spec_t time_start_last_pps = get_time_last_pps();
+ while(true){
+ if (get_time_last_pps() != time_start_last_pps) break;
+ if ((get_time_now() - time_start) > time_spec_t(1.1)){
+ throw std::runtime_error(
+ "Board 0 may not be getting a PPS signal.\n"
+ "The time at the last PPS has not changed.\n"
+ );
+ }
}
- std::cout << " 3) set times next pps (synchronously)" << std::endl;
+ std::cout << " 2) set times next pps (synchronously)" << std::endl;
set_time_next_pps(time_spec);
boost::this_thread::sleep(boost::posix_time::seconds(1));