From f90b62f3871fb701a8d9cb7c91c1a7f3421fced9 Mon Sep 17 00:00:00 2001 From: michael-west Date: Wed, 7 Oct 2015 13:10:01 -0700 Subject: B210: Add VITA time synchronization on internal signal --- host/lib/usrp/cores/time_core_3000.cpp | 13 +++++++++++-- host/lib/usrp/cores/time_core_3000.hpp | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp/cores') diff --git a/host/lib/usrp/cores/time_core_3000.cpp b/host/lib/usrp/cores/time_core_3000.cpp index ffae5dc0d..694edf31c 100644 --- a/host/lib/usrp/cores/time_core_3000.cpp +++ b/host/lib/usrp/cores/time_core_3000.cpp @@ -24,8 +24,9 @@ #define REG_TIME_LO _base + 4 #define REG_TIME_CTRL _base + 8 -#define CTRL_LATCH_TIME_PPS (1 << 1) -#define CTRL_LATCH_TIME_NOW (1 << 0) +#define CTRL_LATCH_TIME_NOW (1 << 0) +#define CTRL_LATCH_TIME_PPS (1 << 1) +#define CTRL_LATCH_TIME_SYNC (1 << 2) using namespace uhd; @@ -99,6 +100,14 @@ struct time_core_3000_impl : time_core_3000 _iface->poke32(REG_TIME_CTRL, CTRL_LATCH_TIME_NOW); } + void set_time_sync(const uhd::time_spec_t &time) + { + const boost::uint64_t ticks = time.to_ticks(_tick_rate); + _iface->poke32(REG_TIME_HI, boost::uint32_t(ticks >> 32)); + _iface->poke32(REG_TIME_LO, boost::uint32_t(ticks >> 0)); + _iface->poke32(REG_TIME_CTRL, CTRL_LATCH_TIME_SYNC); + } + void set_time_next_pps(const uhd::time_spec_t &time) { const boost::uint64_t ticks = time.to_ticks(_tick_rate); diff --git a/host/lib/usrp/cores/time_core_3000.hpp b/host/lib/usrp/cores/time_core_3000.hpp index 7463386ba..7dde4e797 100644 --- a/host/lib/usrp/cores/time_core_3000.hpp +++ b/host/lib/usrp/cores/time_core_3000.hpp @@ -53,6 +53,8 @@ public: virtual void set_time_now(const uhd::time_spec_t &time) = 0; + virtual void set_time_sync(const uhd::time_spec_t &time) = 0; + virtual void set_time_next_pps(const uhd::time_spec_t &time) = 0; }; -- cgit v1.2.3