aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/b200
diff options
context:
space:
mode:
authormichael-west <michael.west@ettus.com>2015-10-07 13:10:01 -0700
committerMartin Braun <martin.braun@ettus.com>2015-12-10 14:21:49 -0800
commitf90b62f3871fb701a8d9cb7c91c1a7f3421fced9 (patch)
tree85d85ed9be444df4348e397bdaa707cfbb5d4597 /host/lib/usrp/b200
parent21df150ec873f15c4e85f9564b56586e3fe2afcf (diff)
downloaduhd-f90b62f3871fb701a8d9cb7c91c1a7f3421fced9.tar.gz
uhd-f90b62f3871fb701a8d9cb7c91c1a7f3421fced9.tar.bz2
uhd-f90b62f3871fb701a8d9cb7c91c1a7f3421fced9.zip
B210: Add VITA time synchronization on internal signal
Diffstat (limited to 'host/lib/usrp/b200')
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp22
-rw-r--r--host/lib/usrp/b200/b200_impl.hpp1
-rw-r--r--host/lib/usrp/b200/b200_regs.hpp2
3 files changed, 17 insertions, 8 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index ffce08567..a18e595a6 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -555,7 +555,7 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s
client_settings = boost::make_shared<b200_ad9361_client_t>();
}
_codec_ctrl = ad9361_ctrl::make_spi(client_settings, _spi_iface, AD9361_SLAVENO);
-
+
////////////////////////////////////////////////////////////////////
// create codec control objects
////////////////////////////////////////////////////////////////////
@@ -623,15 +623,15 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s
//register time now and pps onto available radio cores
_tree->create<time_spec_t>(mb_path / "time" / "now")
- .publish(boost::bind(&time_core_3000::get_time_now, _radio_perifs[0].time64));
+ .publish(boost::bind(&time_core_3000::get_time_now, _radio_perifs[0].time64))
+ .subscribe(boost::bind(&b200_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));
- for (size_t i = 0; i < _radio_perifs.size(); i++)
+ BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs)
{
- _tree->access<time_spec_t>(mb_path / "time" / "now")
- .subscribe(boost::bind(&time_core_3000::set_time_now, _radio_perifs[i].time64, _1));
_tree->access<time_spec_t>(mb_path / "time" / "pps")
- .subscribe(boost::bind(&time_core_3000::set_time_next_pps, _radio_perifs[i].time64, _1));
+ .subscribe(boost::bind(&time_core_3000::set_time_next_pps, perif.time64, _1));
}
//setup time source props
@@ -1074,11 +1074,19 @@ void b200_impl::update_time_source(const std::string &source)
throw uhd::key_error("update_time_source: unknown source: " + source);
if (_time_source != value)
{
- _local_ctrl->poke32(TOREG(SR_CORE_PPS_SEL), value);
+ _local_ctrl->poke32(TOREG(SR_CORE_SYNC), value);
_time_source = value;
}
}
+void b200_impl::sync_times(const uhd::time_spec_t& t)
+{
+ BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs)
+ perif.time64->set_time_sync(t);
+ _local_ctrl->poke32(TOREG(SR_CORE_SYNC), 1 << 2 | boost::uint32_t(_time_source));
+ _local_ctrl->poke32(TOREG(SR_CORE_SYNC), _time_source);
+}
+
/***********************************************************************
* GPIO setup
**********************************************************************/
diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp
index 25fef7d4b..f052c55e6 100644
--- a/host/lib/usrp/b200/b200_impl.hpp
+++ b/host/lib/usrp/b200/b200_impl.hpp
@@ -167,6 +167,7 @@ private:
uhd::usrp::subdev_spec_t coerce_subdev_spec(const uhd::usrp::subdev_spec_t &);
void update_subdev_spec(const std::string &tx_rx, const uhd::usrp::subdev_spec_t &);
void update_time_source(const std::string &);
+ void sync_times(const uhd::time_spec_t&);
void update_clock_source(const std::string &);
void update_bandsel(const std::string& which, double freq);
void update_antenna_sel(const size_t which, const std::string &ant);
diff --git a/host/lib/usrp/b200/b200_regs.hpp b/host/lib/usrp/b200/b200_regs.hpp
index 8f2dd03f3..e9ab81bae 100644
--- a/host/lib/usrp/b200/b200_regs.hpp
+++ b/host/lib/usrp/b200/b200_regs.hpp
@@ -28,7 +28,7 @@ localparam SR_CORE_SPI = 8;
localparam SR_CORE_MISC = 16;
localparam SR_CORE_COMPAT = 24;
localparam SR_CORE_GPSDO_ST = 40;
-localparam SR_CORE_PPS_SEL = 48;
+localparam SR_CORE_SYNC = 48;
localparam RB32_CORE_SPI = 8;
localparam RB32_CORE_MISC = 16;
localparam RB32_CORE_STATUS = 20;