diff options
author | michael-west <michael.west@ettus.com> | 2015-10-14 11:57:15 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2015-12-10 14:21:49 -0800 |
commit | c21c5ee6fe6c0e30ac803b308d74ec77317a456f (patch) | |
tree | 141d27b1a889b8c593a2ac6bb6e0ee5d60bdd462 /host/lib/usrp/x300 | |
parent | f90b62f3871fb701a8d9cb7c91c1a7f3421fced9 (diff) | |
download | uhd-c21c5ee6fe6c0e30ac803b308d74ec77317a456f.tar.gz uhd-c21c5ee6fe6c0e30ac803b308d74ec77317a456f.tar.bz2 uhd-c21c5ee6fe6c0e30ac803b308d74ec77317a456f.zip |
E300/X300: Add VITA time synchronization on internal signal
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_impl.hpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_regs.hpp | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 1e424414e..ebb9bf3a6 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -764,8 +764,8 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) //////////////////////////////////////////////////////////////////// _tree->create<time_spec_t>(mb_path / "time" / "now") .publish(boost::bind(&time_core_3000::get_time_now, mb.radio_perifs[0].time64)) - .subscribe(boost::bind(&time_core_3000::set_time_now, mb.radio_perifs[0].time64, _1)) - .subscribe(boost::bind(&time_core_3000::set_time_now, mb.radio_perifs[1].time64, _1)); + .subscribe(boost::bind(&x300_impl::sync_times, this, mb, _1)) + .set(0.0); _tree->create<time_spec_t>(mb_path / "time" / "pps") .publish(boost::bind(&time_core_3000::get_time_last_pps, mb.radio_perifs[0].time64)) .subscribe(boost::bind(&time_core_3000::set_time_next_pps, mb.radio_perifs[0].time64, _1)) @@ -1457,6 +1457,14 @@ void x300_impl::update_time_source(mboard_members_t &mb, const std::string &sour */ } +void x300_impl::sync_times(mboard_members_t &mb, const uhd::time_spec_t& t) +{ + BOOST_FOREACH(radio_perifs_t &perif, mb.radio_perifs) + perif.time64->set_time_sync(t); + mb.fw_regmap->clock_ctrl_reg.write(fw_regmap_t::clk_ctrl_reg_t::TIME_SYNC, 1); + mb.fw_regmap->clock_ctrl_reg.write(fw_regmap_t::clk_ctrl_reg_t::TIME_SYNC, 0); +} + bool x300_impl::wait_for_clk_locked(mboard_members_t& mb, boost::uint32_t which, double timeout) { boost::system_time timeout_time = boost::get_system_time() + boost::posix_time::milliseconds(timeout * 1000.0); diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index 1630047af..67afa77ee 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -354,6 +354,7 @@ private: void set_time_source_out(mboard_members_t&, const bool); void update_clock_source(mboard_members_t&, const std::string &); void update_time_source(mboard_members_t&, const std::string &); + void sync_times(mboard_members_t&, const uhd::time_spec_t&); uhd::sensor_value_t get_ref_locked(mboard_members_t& mb); bool wait_for_clk_locked(mboard_members_t& mb, boost::uint32_t which, double timeout); diff --git a/host/lib/usrp/x300/x300_regs.hpp b/host/lib/usrp/x300/x300_regs.hpp index eba30abb5..3e0966c83 100644 --- a/host/lib/usrp/x300/x300_regs.hpp +++ b/host/lib/usrp/x300/x300_regs.hpp @@ -209,6 +209,7 @@ namespace uhd { namespace usrp { namespace x300 { UHD_DEFINE_SOFT_REG_FIELD(PPS_OUT_EN, /*width*/ 1, /*shift*/ 4); //[4] UHD_DEFINE_SOFT_REG_FIELD(TCXO_EN, /*width*/ 1, /*shift*/ 5); //[5] UHD_DEFINE_SOFT_REG_FIELD(GPSDO_PWR_EN, /*width*/ 1, /*shift*/ 6); //[6] + UHD_DEFINE_SOFT_REG_FIELD(TIME_SYNC, /*width*/ 1, /*shift*/ 7); //[7] static const boost::uint32_t SRC_EXTERNAL = 0x0; static const boost::uint32_t SRC_INTERNAL = 0x2; @@ -221,6 +222,7 @@ namespace uhd { namespace usrp { namespace x300 { set(PPS_OUT_EN, 0); set(TCXO_EN, 1); set(GPSDO_PWR_EN, 1); //GPSDO power always ON + set(TIME_SYNC, 0); } } clock_ctrl_reg; |