From 76c8b7fa24ea6c1bba84d7116b12dc0e4c5cacf6 Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Thu, 30 Dec 2010 16:41:38 -0800
Subject: usrp2: implemented get time last pps

renamed the enum for the pps time
added calls to single and multi wrappers
set time unknown pps now simpler
removed peek64 stuff from host + fw

please test
---
 host/include/uhd/usrp/mboard_props.hpp |  2 +-
 host/include/uhd/usrp/multi_usrp.hpp   | 17 +++++++++++------
 host/include/uhd/usrp/single_usrp.hpp  |  8 +++++++-
 3 files changed, 19 insertions(+), 8 deletions(-)

(limited to 'host/include')

diff --git a/host/include/uhd/usrp/mboard_props.hpp b/host/include/uhd/usrp/mboard_props.hpp
index df94d1678..c82bfc21a 100644
--- a/host/include/uhd/usrp/mboard_props.hpp
+++ b/host/include/uhd/usrp/mboard_props.hpp
@@ -43,7 +43,7 @@ namespace uhd{ namespace usrp{
         MBOARD_PROP_TX_SUBDEV_SPEC  = 'R', //rw, subdev_spec_t
         MBOARD_PROP_CLOCK_CONFIG    = 'C', //rw, clock_config_t
         MBOARD_PROP_TIME_NOW        = 't', //rw, time_spec_t
-        MBOARD_PROP_TIME_NEXT_PPS   = 'T', //wo, time_spec_t
+        MBOARD_PROP_TIME_PPS        = 'T', //wo, time_spec_t
         MBOARD_PROP_STREAM_CMD      = 's', //wo, stream_cmd_t
         MBOARD_PROP_EEPROM_MAP      = 'M'  //wr, mboard_eeprom_t::sptr
     };
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp
index 98ba07fc0..ce99d713e 100644
--- a/host/include/uhd/usrp/multi_usrp.hpp
+++ b/host/include/uhd/usrp/multi_usrp.hpp
@@ -108,11 +108,17 @@ public:
     virtual std::string get_mboard_name(size_t mboard) = 0;
 
     /*!
-     * Gets the current time in the usrp time registers.
+     * Get the current time in the usrp time registers.
      * \return a timespec representing current usrp time
      */
     virtual time_spec_t get_time_now(void) = 0;
 
+    /*!
+     * Get the time when the last pps pulse occured.
+     * \return a timespec representing the last pps
+     */
+    virtual time_spec_t get_time_last_pps(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.
@@ -133,14 +139,13 @@ public:
      * Ex: Host machine is not attached to serial port of GPSDO
      * and can therefore not query the GPSDO for the PPS edge.
      *
-     * This is a 3-step process, and will take at most 3 seconds to complete.
+     * This is a 2-step process, and will take at most 2 seconds to complete.
      * Upon completion, the times will be synchronized to the time provided.
      *
-     * - Step1: set the time at the next pps (potential race condition)
-     * - Step2: wait for the seconds to rollover to catch the pps edge
-     * - Step3: set the time at the next pps (synchronous for all boards)
+     * - Step1: wait for the last pps time to transition to catch the edge
+     * - Step2: set the time at the next pps (synchronous for all boards)
      *
-     * \param time_spec the time to latch into the usrp device
+     * \param time_spec the time to latch at the next pps after catching the edge
      */
     virtual void set_time_unknown_pps(const time_spec_t &time_spec) = 0;
 
diff --git a/host/include/uhd/usrp/single_usrp.hpp b/host/include/uhd/usrp/single_usrp.hpp
index 26303fe10..bfbb90912 100644
--- a/host/include/uhd/usrp/single_usrp.hpp
+++ b/host/include/uhd/usrp/single_usrp.hpp
@@ -77,11 +77,17 @@ public:
     virtual std::string get_mboard_name(void) = 0;
 
     /*!
-     * Gets the current time in the usrp time registers.
+     * Get the current time in the usrp time registers.
      * \return a timespec representing current usrp time
      */
     virtual time_spec_t get_time_now(void) = 0;
 
+    /*!
+     * Get the time when the last pps pulse occured.
+     * \return a timespec representing the last pps
+     */
+    virtual time_spec_t get_time_last_pps(void) = 0;
+
     /*!
      * Sets the time registers on the usrp immediately.
      * \param time_spec the time to latch into the usrp device
-- 
cgit v1.2.3