aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBalint Seeber <balint@ettus.com>2015-07-24 12:15:30 -0700
committerMartin Braun <martin.braun@ettus.com>2015-07-27 18:16:14 -0700
commit586a3d39181bf7f75e4a0503a76096ee0153fc62 (patch)
treee60c369cf7eaffa63c534cae26c5009578583821
parent760f993592e804ad425db4619b085fbcdf347262 (diff)
downloaduhd-586a3d39181bf7f75e4a0503a76096ee0153fc62.tar.gz
uhd-586a3d39181bf7f75e4a0503a76096ee0153fc62.tar.bz2
uhd-586a3d39181bf7f75e4a0503a76096ee0153fc62.zip
ks: wait one second with GPSDO for time to latch, checker thread for ref_locked
-rw-r--r--tools/kitchen_sink/CMakeLists.txt9
-rw-r--r--tools/kitchen_sink/kitchen_sink.cpp35
2 files changed, 44 insertions, 0 deletions
diff --git a/tools/kitchen_sink/CMakeLists.txt b/tools/kitchen_sink/CMakeLists.txt
index b28a9e411..edbc33bd0 100644
--- a/tools/kitchen_sink/CMakeLists.txt
+++ b/tools/kitchen_sink/CMakeLists.txt
@@ -17,6 +17,15 @@
cmake_minimum_required(VERSION 2.8)
+###############################################################################
+
+#select the release build type by default to get optimization flags
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+ message(STATUS "Build type not specified: defaulting to release.")
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
+
### Set up build environment ##################################################
#### Set up Boost:
set(BOOST_REQUIRED_COMPONENTS
diff --git a/tools/kitchen_sink/kitchen_sink.cpp b/tools/kitchen_sink/kitchen_sink.cpp
index f350f4516..e17ee6437 100644
--- a/tools/kitchen_sink/kitchen_sink.cpp
+++ b/tools/kitchen_sink/kitchen_sink.cpp
@@ -269,6 +269,33 @@ static void msg_handler(uhd::msg::type_t type, const std::string& msg)
}
/***********************************************************************
+ * Checker thread
+ **********************************************************************/
+
+void check_thread(uhd::usrp::multi_usrp::sptr usrp)
+{
+ {
+ std::stringstream ss;
+ ss << "(" << get_stringified_time() << ") Checker running..." << std::endl;
+ std::cout << ss.str();
+ }
+
+ while (running)
+ {
+ uhd::sensor_value_t ref_locked = usrp->get_mboard_sensor("ref_locked");
+ if (ref_locked.to_bool() == false) {
+ std::stringstream ss;
+ ss << HEADER_WARN"(" << get_stringified_time() << ") " << boost::format("ref_locked: unlocked") << std::endl;
+ std::cout << ss.str();
+ }
+
+ boost::this_thread::sleep(boost::posix_time::seconds(0) + boost::posix_time::microseconds(1000 * 500)); // MAGIC
+ }
+
+ std::cout << "Checker exiting..." << std::endl;
+}
+
+/***********************************************************************
* Benchmark RX Rate
**********************************************************************/
@@ -1511,6 +1538,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
}
}
+ if (usrp->get_time_source(0) == "gpsdo")
+ {
+ std::cout << boost::format(HEADER "Waiting for GPSDO time to latch") << std::endl;
+ sleep(1);
+ }
+
uhd::time_spec_t time_start = usrp->get_time_now(); // Usually DSP #0 on mboard #0
std::cout << boost::format(HEADER "Time now: %f seconds (%llu ticks)") % time_start.get_real_secs() % time_start.to_ticks(usrp->get_master_clock_rate()) << std::endl;
@@ -1755,6 +1788,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
running = true;
std::cout << HEADER "Begin..." << std::endl;
+ thread_group.create_thread(boost::bind(&check_thread, usrp));
+
if (tx_channel_nums.size() > 0)
tx_thread_begin.wait(l_tx);
if (rx_channel_nums.size() > 0)