aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authormichael-west <michael.west@ettus.com>2015-10-14 11:57:15 -0700
committerMartin Braun <martin.braun@ettus.com>2015-12-10 14:21:49 -0800
commitc21c5ee6fe6c0e30ac803b308d74ec77317a456f (patch)
tree141d27b1a889b8c593a2ac6bb6e0ee5d60bdd462 /host
parentf90b62f3871fb701a8d9cb7c91c1a7f3421fced9 (diff)
downloaduhd-c21c5ee6fe6c0e30ac803b308d74ec77317a456f.tar.gz
uhd-c21c5ee6fe6c0e30ac803b308d74ec77317a456f.tar.bz2
uhd-c21c5ee6fe6c0e30ac803b308d74ec77317a456f.zip
E300/X300: Add VITA time synchronization on internal signal
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/e300/e300_impl.cpp19
-rw-r--r--host/lib/usrp/e300/e300_impl.hpp4
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp12
-rw-r--r--host/lib/usrp/x300/x300_impl.hpp1
-rw-r--r--host/lib/usrp/x300/x300_regs.hpp2
5 files changed, 32 insertions, 6 deletions
diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp
index 6d66e83c0..bf108e171 100644
--- a/host/lib/usrp/e300/e300_impl.cpp
+++ b/host/lib/usrp/e300/e300_impl.cpp
@@ -174,7 +174,7 @@ device_addrs_t e300_find(const device_addr_t &multi_dev_hint)
device_addr_t new_hint = hint;
new_hint["addr"] = if_addrs.bcast;
- // call discover with the new hint ad append results
+ // call discover with the new hint and append results
device_addrs_t new_e300_addrs = e300_find(new_hint);
e300_addrs.insert(e300_addrs.begin(),
new_e300_addrs.begin(), new_e300_addrs.end());
@@ -528,8 +528,8 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr)
////////////////////////////////////////////////////////////////////
_tree->create<time_spec_t>(mb_path / "time" / "now")
.publish(boost::bind(&time_core_3000::get_time_now, _radio_perifs[0].time64))
- .subscribe(boost::bind(&time_core_3000::set_time_now, _radio_perifs[0].time64, _1))
- .subscribe(boost::bind(&time_core_3000::set_time_now, _radio_perifs[1].time64, _1));
+ .subscribe(boost::bind(&e300_impl::_sync_times, this, _1))
+ .set(0.0);
_tree->create<time_spec_t>(mb_path / "time" / "pps")
.publish(boost::bind(&time_core_3000::get_time_last_pps, _radio_perifs[0].time64))
.subscribe(boost::bind(&time_core_3000::set_time_next_pps, _radio_perifs[0].time64, _1))
@@ -826,6 +826,16 @@ void e300_impl::_update_time_source(const std::string &source)
_update_gpio_state();
}
+void e300_impl::_sync_times(const uhd::time_spec_t& t)
+{
+ BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs)
+ perif.time64->set_time_sync(t);
+ _misc.time_sync = 1;
+ _update_gpio_state();
+ _misc.time_sync = 0;
+ _update_gpio_state();
+}
+
size_t e300_impl::_get_axi_dma_channel(
boost::uint8_t destination,
boost::uint8_t prefix)
@@ -1111,7 +1121,8 @@ void e300_impl::_update_gpio_state(void)
| (_misc.tx_bandsels << gpio_t::TX_BANDSEL)
| (_misc.rx_bandsel_a << gpio_t::RX_BANDSELA)
| (_misc.rx_bandsel_b << gpio_t::RX_BANDSELB)
- | (_misc.rx_bandsel_c << gpio_t::RX_BANDSELC);
+ | (_misc.rx_bandsel_c << gpio_t::RX_BANDSELC)
+ | (_misc.time_sync << gpio_t::TIME_SYNC);
_global_regs->poke32(global_regs::SR_CORE_MISC, misc_reg);
}
diff --git a/host/lib/usrp/e300/e300_impl.hpp b/host/lib/usrp/e300/e300_impl.hpp
index 8aff51466..1f20726ea 100644
--- a/host/lib/usrp/e300/e300_impl.hpp
+++ b/host/lib/usrp/e300/e300_impl.hpp
@@ -200,6 +200,8 @@ private: // types
boost::uint32_t rx_bandsel_b;
boost::uint32_t rx_bandsel_c;
+ boost::uint32_t time_sync;
+
static const size_t PPS_SEL = 0;
static const size_t MIMO = 2;
static const size_t CODEC_ARST = 3;
@@ -207,6 +209,7 @@ private: // types
static const size_t RX_BANDSELA = 7;
static const size_t RX_BANDSELB = 13;
static const size_t RX_BANDSELC = 17;
+ static const size_t TIME_SYNC = 21;
};
private: // methods
@@ -257,6 +260,7 @@ private: // methods
void _update_time_source(const std::string &source);
void _update_clock_source(const std::string &);
+ void _sync_times(const uhd::time_spec_t&);
void _update_subdev_spec(
const std::string &txrx,
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;