From 549a0170a409904f123a4eef975362978ca62bf3 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 4 Jul 2010 20:21:09 -0700 Subject: uhd: added get time now call to simple and mimo usrp --- host/include/uhd/usrp/mimo_usrp.hpp | 6 ++++++ host/include/uhd/usrp/simple_usrp.hpp | 6 ++++++ host/lib/usrp/mimo_usrp.cpp | 10 +++++----- host/lib/usrp/simple_usrp.cpp | 4 ++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/host/include/uhd/usrp/mimo_usrp.hpp b/host/include/uhd/usrp/mimo_usrp.hpp index a3cbde483..e85c06046 100644 --- a/host/include/uhd/usrp/mimo_usrp.hpp +++ b/host/include/uhd/usrp/mimo_usrp.hpp @@ -70,6 +70,12 @@ public: /******************************************************************* * Misc ******************************************************************/ + /*! + * Gets the current time in the usrp time registers. + * \return a timespec representing current usrp time + */ + virtual time_spec_t get_time_now(void) = 0; + /*! * Set the time registers on the usrp at the next pps tick. * The values will not be latched in until the pulse occurs. diff --git a/host/include/uhd/usrp/simple_usrp.hpp b/host/include/uhd/usrp/simple_usrp.hpp index 1d817e030..1d9136f08 100644 --- a/host/include/uhd/usrp/simple_usrp.hpp +++ b/host/include/uhd/usrp/simple_usrp.hpp @@ -63,6 +63,12 @@ public: /******************************************************************* * Misc ******************************************************************/ + /*! + * Gets the current time in the usrp time registers. + * \return a timespec representing current usrp time + */ + virtual time_spec_t get_time_now(void) = 0; + /*! * Sets the time registers on the usrp immediately. * \param time_spec the time to latch into the usrp device diff --git a/host/lib/usrp/mimo_usrp.cpp b/host/lib/usrp/mimo_usrp.cpp index bd7753d09..440aaf9f6 100644 --- a/host/lib/usrp/mimo_usrp.cpp +++ b/host/lib/usrp/mimo_usrp.cpp @@ -63,11 +63,6 @@ public: BOOST_FOREACH(wax::obj mboard, _mboards){ mboard[MBOARD_PROP_CLOCK_CONFIG] = clock_config; } - - //set the times to zero at the next pps and sleep - this->set_time_next_pps(time_spec_t(0, 0)); - sleep(1); - } ~mimo_usrp_impl(void){ @@ -115,6 +110,11 @@ public: /******************************************************************* * Misc ******************************************************************/ + time_spec_t get_time_now(void){ + //the time on the first mboard better be the same on all + return _mboards.front()[MBOARD_PROP_TIME_NOW].as(); + } + void set_time_next_pps(const time_spec_t &time_spec){ BOOST_FOREACH(wax::obj mboard, _mboards){ mboard[MBOARD_PROP_TIME_NEXT_PPS] = time_spec; diff --git a/host/lib/usrp/simple_usrp.cpp b/host/lib/usrp/simple_usrp.cpp index 4a5171cf7..56e82d7ee 100644 --- a/host/lib/usrp/simple_usrp.cpp +++ b/host/lib/usrp/simple_usrp.cpp @@ -86,6 +86,10 @@ public: /******************************************************************* * Misc ******************************************************************/ + time_spec_t get_time_now(void){ + return _mboard[MBOARD_PROP_TIME_NOW].as(); + } + void set_time_now(const time_spec_t &time_spec){ _mboard[MBOARD_PROP_TIME_NOW] = time_spec; } -- cgit v1.2.3