From c21c5ee6fe6c0e30ac803b308d74ec77317a456f Mon Sep 17 00:00:00 2001 From: michael-west Date: Wed, 14 Oct 2015 11:57:15 -0700 Subject: E300/X300: Add VITA time synchronization on internal signal --- host/lib/usrp/e300/e300_impl.cpp | 19 +++++++++++++++---- host/lib/usrp/e300/e300_impl.hpp | 4 ++++ 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'host/lib/usrp/e300') 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(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(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, -- cgit v1.2.3 From c1e6da087946b522018996267441b8555791dabd Mon Sep 17 00:00:00 2001 From: michael-west Date: Wed, 14 Oct 2015 14:10:25 -0700 Subject: B210/E300: Re-sync times after master clock rate change. --- host/lib/usrp/b200/b200_impl.cpp | 3 +++ host/lib/usrp/e300/e300_impl.cpp | 3 +++ 2 files changed, 6 insertions(+) (limited to 'host/lib/usrp/e300') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index a18e595a6..dae90bbfe 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -626,6 +626,9 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s .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); + //re-sync the times when the tick rate changes + _tree->access(mb_path / "tick_rate") + .subscribe(boost::bind(&b200_impl::sync_times, this, _radio_perifs[0].time64->get_time_now())); _tree->create(mb_path / "time" / "pps") .publish(boost::bind(&time_core_3000::get_time_last_pps, _radio_perifs[0].time64)); BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index bf108e171..5cc274bbb 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -530,6 +530,9 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) .publish(boost::bind(&time_core_3000::get_time_now, _radio_perifs[0].time64)) .subscribe(boost::bind(&e300_impl::_sync_times, this, _1)) .set(0.0); + //re-sync the times when the tick rate changes + _tree->access(mb_path / "tick_rate") + .subscribe(boost::bind(&e300_impl::_sync_times, this, _radio_perifs[0].time64->get_time_now())); _tree->create(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)) -- cgit v1.2.3 From b9b83502771e5caa60fb336441fb0d5ed3fe9f1a Mon Sep 17 00:00:00 2001 From: michael-west Date: Thu, 15 Oct 2015 13:44:00 -0700 Subject: B200/E300: Set time sync on clock rate change to current time of first radio --- host/lib/usrp/b200/b200_impl.cpp | 11 ++++++++--- host/lib/usrp/b200/b200_impl.hpp | 3 ++- host/lib/usrp/e300/e300_impl.cpp | 11 ++++++++--- host/lib/usrp/e300/e300_impl.hpp | 3 ++- 4 files changed, 20 insertions(+), 8 deletions(-) (limited to 'host/lib/usrp/e300') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index dae90bbfe..9a2c65680 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -624,11 +624,11 @@ 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(mb_path / "time" / "now") .publish(boost::bind(&time_core_3000::get_time_now, _radio_perifs[0].time64)) - .subscribe(boost::bind(&b200_impl::sync_times, this, _1)) + .subscribe(boost::bind(&b200_impl::set_time, this, _1)) .set(0.0); //re-sync the times when the tick rate changes _tree->access(mb_path / "tick_rate") - .subscribe(boost::bind(&b200_impl::sync_times, this, _radio_perifs[0].time64->get_time_now())); + .subscribe(boost::bind(&b200_impl::sync_times, this)); _tree->create(mb_path / "time" / "pps") .publish(boost::bind(&time_core_3000::get_time_last_pps, _radio_perifs[0].time64)); BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) @@ -1082,7 +1082,7 @@ void b200_impl::update_time_source(const std::string &source) } } -void b200_impl::sync_times(const uhd::time_spec_t& t) +void b200_impl::set_time(const uhd::time_spec_t& t) { BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) perif.time64->set_time_sync(t); @@ -1090,6 +1090,11 @@ void b200_impl::sync_times(const uhd::time_spec_t& t) _local_ctrl->poke32(TOREG(SR_CORE_SYNC), _time_source); } +void b200_impl::sync_times() +{ + set_time(_radio_perifs[0].time64->get_time_now()); +} + /*********************************************************************** * GPIO setup **********************************************************************/ diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index f052c55e6..4ddb29f0b 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -167,7 +167,8 @@ 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 set_time(const uhd::time_spec_t&); + void sync_times(void); 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/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 5cc274bbb..0003dddb0 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -528,11 +528,11 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) //////////////////////////////////////////////////////////////////// _tree->create(mb_path / "time" / "now") .publish(boost::bind(&time_core_3000::get_time_now, _radio_perifs[0].time64)) - .subscribe(boost::bind(&e300_impl::_sync_times, this, _1)) + .subscribe(boost::bind(&e300_impl::_set_time, this, _1)) .set(0.0); //re-sync the times when the tick rate changes _tree->access(mb_path / "tick_rate") - .subscribe(boost::bind(&e300_impl::_sync_times, this, _radio_perifs[0].time64->get_time_now())); + .subscribe(boost::bind(&e300_impl::_sync_times, this)); _tree->create(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)) @@ -829,7 +829,7 @@ void e300_impl::_update_time_source(const std::string &source) _update_gpio_state(); } -void e300_impl::_sync_times(const uhd::time_spec_t& t) +void e300_impl::_set_time(const uhd::time_spec_t& t) { BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) perif.time64->set_time_sync(t); @@ -839,6 +839,11 @@ void e300_impl::_sync_times(const uhd::time_spec_t& t) _update_gpio_state(); } +void e300_impl::_sync_times() +{ + _set_time(_radio_perifs[0].time64->get_time_now()); +} + size_t e300_impl::_get_axi_dma_channel( boost::uint8_t destination, boost::uint8_t prefix) diff --git a/host/lib/usrp/e300/e300_impl.hpp b/host/lib/usrp/e300/e300_impl.hpp index 1f20726ea..764059c1b 100644 --- a/host/lib/usrp/e300/e300_impl.hpp +++ b/host/lib/usrp/e300/e300_impl.hpp @@ -260,7 +260,8 @@ 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 _set_time(const uhd::time_spec_t&); + void _sync_times(void); void _update_subdev_spec( const std::string &txrx, -- cgit v1.2.3 From 9f9a55e1f59dfd1ff7c6580f4e8c7752ac87775b Mon Sep 17 00:00:00 2001 From: michael-west Date: Mon, 2 Nov 2015 16:05:01 -0800 Subject: Bumped FPGA compat numbers for B200, X300, and E300. --- host/lib/usrp/b200/b200_impl.hpp | 2 +- host/lib/usrp/e300/e300_fpga_defs.hpp | 2 +- host/lib/usrp/x300/x300_fw_common.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'host/lib/usrp/e300') diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index 4ddb29f0b..538ee8cd7 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -49,7 +49,7 @@ #include "recv_packet_demuxer_3000.hpp" static const boost::uint8_t B200_FW_COMPAT_NUM_MAJOR = 8; static const boost::uint8_t B200_FW_COMPAT_NUM_MINOR = 0; -static const boost::uint16_t B200_FPGA_COMPAT_NUM = 11; +static const boost::uint16_t B200_FPGA_COMPAT_NUM = 12; static const boost::uint16_t B205_FPGA_COMPAT_NUM = 2; static const double B200_BUS_CLOCK_RATE = 100e6; static const boost::uint32_t B200_GPSDO_ST_NONE = 0x83; diff --git a/host/lib/usrp/e300/e300_fpga_defs.hpp b/host/lib/usrp/e300/e300_fpga_defs.hpp index a8fa60d9d..3b21468ba 100644 --- a/host/lib/usrp/e300/e300_fpga_defs.hpp +++ b/host/lib/usrp/e300/e300_fpga_defs.hpp @@ -21,7 +21,7 @@ namespace uhd { namespace usrp { namespace e300 { namespace fpga { static const size_t NUM_RADIOS = 2; -static const boost::uint32_t COMPAT_MAJOR = 11; +static const boost::uint32_t COMPAT_MAJOR = 12; static const boost::uint32_t COMPAT_MINOR = 0; }}}} // namespace diff --git a/host/lib/usrp/x300/x300_fw_common.h b/host/lib/usrp/x300/x300_fw_common.h index 1b88db69a..dc9e6eba1 100644 --- a/host/lib/usrp/x300/x300_fw_common.h +++ b/host/lib/usrp/x300/x300_fw_common.h @@ -33,7 +33,7 @@ extern "C" { #define X300_REVISION_MIN 2 #define X300_FW_COMPAT_MAJOR 4 #define X300_FW_COMPAT_MINOR 0 -#define X300_FPGA_COMPAT_MAJOR 15 +#define X300_FPGA_COMPAT_MAJOR 16 //shared memory sections - in between the stack and the program space #define X300_FW_SHMEM_BASE 0x6000 -- cgit v1.2.3 From bf634e1e902f535ca1ddb4f4a25c84c066018b17 Mon Sep 17 00:00:00 2001 From: Ashish Chaudhari Date: Tue, 24 Nov 2015 12:01:37 -0800 Subject: b2xx,e3xx,x300: Bumped FPGA compat numbers after SW time-sync changes - b200: compat 13 - b200mini: compat 4 - e3xx: compat 14 - x3xx: compat 19 --- host/lib/usrp/b200/b200_impl.hpp | 4 ++-- host/lib/usrp/e300/e300_fpga_defs.hpp | 2 +- host/lib/usrp/x300/x300_fw_common.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'host/lib/usrp/e300') diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index 538ee8cd7..041c8bcb2 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -49,8 +49,8 @@ #include "recv_packet_demuxer_3000.hpp" static const boost::uint8_t B200_FW_COMPAT_NUM_MAJOR = 8; static const boost::uint8_t B200_FW_COMPAT_NUM_MINOR = 0; -static const boost::uint16_t B200_FPGA_COMPAT_NUM = 12; -static const boost::uint16_t B205_FPGA_COMPAT_NUM = 2; +static const boost::uint16_t B200_FPGA_COMPAT_NUM = 13; +static const boost::uint16_t B205_FPGA_COMPAT_NUM = 4; static const double B200_BUS_CLOCK_RATE = 100e6; static const boost::uint32_t B200_GPSDO_ST_NONE = 0x83; static const size_t B200_MAX_RATE_USB2 = 53248000; // bytes/s diff --git a/host/lib/usrp/e300/e300_fpga_defs.hpp b/host/lib/usrp/e300/e300_fpga_defs.hpp index 3b21468ba..594461518 100644 --- a/host/lib/usrp/e300/e300_fpga_defs.hpp +++ b/host/lib/usrp/e300/e300_fpga_defs.hpp @@ -21,7 +21,7 @@ namespace uhd { namespace usrp { namespace e300 { namespace fpga { static const size_t NUM_RADIOS = 2; -static const boost::uint32_t COMPAT_MAJOR = 12; +static const boost::uint32_t COMPAT_MAJOR = 14; static const boost::uint32_t COMPAT_MINOR = 0; }}}} // namespace diff --git a/host/lib/usrp/x300/x300_fw_common.h b/host/lib/usrp/x300/x300_fw_common.h index dc9e6eba1..549fc9dfa 100644 --- a/host/lib/usrp/x300/x300_fw_common.h +++ b/host/lib/usrp/x300/x300_fw_common.h @@ -33,7 +33,7 @@ extern "C" { #define X300_REVISION_MIN 2 #define X300_FW_COMPAT_MAJOR 4 #define X300_FW_COMPAT_MINOR 0 -#define X300_FPGA_COMPAT_MAJOR 16 +#define X300_FPGA_COMPAT_MAJOR 19 //shared memory sections - in between the stack and the program space #define X300_FW_SHMEM_BASE 0x6000 -- cgit v1.2.3