From 1d1976c48e8ca698d9c35636823c8ea39dc69129 Mon Sep 17 00:00:00 2001 From: mcrymble Date: Fri, 6 Feb 2015 16:10:24 -0600 Subject: b200: Bugfix#692: b200_find now returns an empty device vector when hint contains addr0/resource0/etc style keys. --- host/lib/usrp/b200/b200_impl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 355d12d12..13169a5ed 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -86,7 +86,9 @@ static device_addrs_t b200_find(const device_addr_t &hint) //Return an empty list of addresses when an address or resource is specified, //since an address and resource is intended for a different, non-USB, device. - if (hint.has_key("addr") || hint.has_key("resource")) return b200_addrs; + BOOST_FOREACH(device_addr_t hint_i, separate_device_addr(hint)) { + if (hint_i.has_key("addr") || hint_i.has_key("resource")) return b200_addrs; + } boost::uint16_t vid, pid; -- cgit v1.2.3 From 06bdef36dd5cfafe0d4c72a1d12488cd5599fca1 Mon Sep 17 00:00:00 2001 From: michael-west Date: Wed, 11 Feb 2015 16:32:27 -0800 Subject: UBX: Serialize SPI transactions --- host/lib/usrp/dboard/db_ubx.cpp | 58 ++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/dboard/db_ubx.cpp b/host/lib/usrp/dboard/db_ubx.cpp index dd30cf534..45817f599 100644 --- a/host/lib/usrp/dboard/db_ubx.cpp +++ b/host/lib/usrp/dboard/db_ubx.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include using namespace uhd; @@ -691,7 +692,7 @@ static const ubx_gpio_field_info_t ubx_v1_gpio_info[] = { }; /*********************************************************************** - * Macros and helper functions for routing and writing SPI registers + * Macros for routing and writing SPI registers **********************************************************************/ #define ROUTE_SPI(iface, dest) \ iface->set_gpio_out(dboard_iface::UNIT_TX, dest, 0x7); @@ -699,19 +700,6 @@ static const ubx_gpio_field_info_t ubx_v1_gpio_info[] = { #define WRITE_SPI(iface, val) \ iface->write_spi(dboard_iface::UNIT_TX, spi_config_t::EDGE_RISE, val, 32); -UHD_INLINE void write_spi_reg(dboard_iface::sptr iface, spi_dest_t dest, boost::uint32_t value) -{ - ROUTE_SPI(iface, dest); - WRITE_SPI(iface, value); -} - -UHD_INLINE void write_spi_regs(dboard_iface::sptr iface, spi_dest_t dest, std::vector values) -{ - ROUTE_SPI(iface, dest); - for (size_t i = 0; i < values.size(); i++) - WRITE_SPI(iface, values[i]); -} - /*********************************************************************** * UBX Class Definition **********************************************************************/ @@ -813,17 +801,17 @@ public: // Initialize LOs if (_rev == 0) { - _txlo1.reset(new max2870(boost::bind(&write_spi_regs, _iface, TXLO1, _1))); - _txlo2.reset(new max2870(boost::bind(&write_spi_regs, _iface, TXLO2, _1))); - _rxlo1.reset(new max2870(boost::bind(&write_spi_regs, _iface, RXLO1, _1))); - _rxlo2.reset(new max2870(boost::bind(&write_spi_regs, _iface, RXLO2, _1))); + _txlo1.reset(new max2870(boost::bind(&ubx_xcvr::write_spi_regs, this, TXLO1, _1))); + _txlo2.reset(new max2870(boost::bind(&ubx_xcvr::write_spi_regs, this, TXLO2, _1))); + _rxlo1.reset(new max2870(boost::bind(&ubx_xcvr::write_spi_regs, this, RXLO1, _1))); + _rxlo2.reset(new max2870(boost::bind(&ubx_xcvr::write_spi_regs, this, RXLO2, _1))); } else if (_rev == 1) { - _txlo1.reset(new max2871(boost::bind(&write_spi_regs, _iface, TXLO1, _1))); - _txlo2.reset(new max2871(boost::bind(&write_spi_regs, _iface, TXLO2, _1))); - _rxlo1.reset(new max2871(boost::bind(&write_spi_regs, _iface, RXLO1, _1))); - _rxlo2.reset(new max2871(boost::bind(&write_spi_regs, _iface, RXLO2, _1))); + _txlo1.reset(new max2871(boost::bind(&ubx_xcvr::write_spi_regs, this, TXLO1, _1))); + _txlo2.reset(new max2871(boost::bind(&ubx_xcvr::write_spi_regs, this, TXLO2, _1))); + _rxlo1.reset(new max2871(boost::bind(&ubx_xcvr::write_spi_regs, this, RXLO1, _1))); + _rxlo2.reset(new max2871(boost::bind(&ubx_xcvr::write_spi_regs, this, RXLO2, _1))); } else { @@ -918,10 +906,10 @@ public: ~ubx_xcvr(void) { // Shutdown synthesizers - _txlo1->shutdown(); - _txlo2->shutdown(); - _rxlo1->shutdown(); - _rxlo2->shutdown(); + _txlo1.reset(); + _txlo2.reset(); + _rxlo1.reset(); + _rxlo2.reset(); // Reset CPLD values _cpld_reg.value = 0; @@ -948,6 +936,21 @@ private: /*********************************************************************** * Helper Functions **********************************************************************/ + void write_spi_reg(spi_dest_t dest, boost::uint32_t value) + { + boost::mutex::scoped_lock lock(_spi_lock); + ROUTE_SPI(_iface, dest); + WRITE_SPI(_iface, value); + } + + void write_spi_regs(spi_dest_t dest, std::vector values) + { + boost::mutex::scoped_lock lock(_spi_lock); + ROUTE_SPI(_iface, dest); + BOOST_FOREACH(boost::uint32_t value, values) + WRITE_SPI(_iface, value); + } + void set_cpld_field(ubx_cpld_field_id_t id, boost::uint32_t value) { _cpld_reg.set_field(id, value); @@ -955,7 +958,7 @@ private: void write_cpld_reg() { - write_spi_reg(_iface, CPLD, _cpld_reg.value); + write_spi_reg(CPLD, _cpld_reg.value); } void set_gpio_field(ubx_gpio_field_id_t id, boost::uint32_t value) @@ -1389,6 +1392,7 @@ private: * Variables **********************************************************************/ dboard_iface::sptr _iface; + boost::mutex _spi_lock; ubx_cpld_reg_t _cpld_reg; boost::shared_ptr _txlo1; boost::shared_ptr _txlo2; -- cgit v1.2.3 From 956bf82d2800c346afe057e8c1ecf230900ee356 Mon Sep 17 00:00:00 2001 From: michael-west Date: Fri, 13 Feb 2015 17:49:48 -0800 Subject: UBX: Revert LO shutdown method in ubx_xcvr destructor --- host/lib/usrp/dboard/db_ubx.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/dboard/db_ubx.cpp b/host/lib/usrp/dboard/db_ubx.cpp index 45817f599..b6cc1421c 100644 --- a/host/lib/usrp/dboard/db_ubx.cpp +++ b/host/lib/usrp/dboard/db_ubx.cpp @@ -906,10 +906,10 @@ public: ~ubx_xcvr(void) { // Shutdown synthesizers - _txlo1.reset(); - _txlo2.reset(); - _rxlo1.reset(); - _rxlo2.reset(); + _txlo1->shutdown(); + _txlo2->shutdown(); + _rxlo1->shutdown(); + _rxlo2->shutdown(); // Reset CPLD values _cpld_reg.value = 0; -- cgit v1.2.3 From 8ec775e936b15404b34d34fd08cc5b3b3489055b Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Fri, 13 Feb 2015 08:40:50 -0800 Subject: usrp2: fixed image compatibility error message * Point to usrp2_card_burner_gui.py instead of usrp2_card_burner.py --- host/lib/usrp/usrp2/usrp2_iface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 65cf90a17..2f2c345be 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -387,7 +387,7 @@ public: //create the burner commands if (this->get_rev() == USRP2_REV3 or this->get_rev() == USRP2_REV4){ - const std::string card_burner = (fs::path(uhd::get_pkg_path()) / UHD_LIB_DIR / "uhd" / "utils" / "usrp2_card_burner.py").string(); + const std::string card_burner = (fs::path(uhd::get_pkg_path()) / UHD_LIB_DIR / "uhd" / "utils" / "usrp2_card_burner_gui.py").string(); const std::string card_burner_cmd = str(boost::format("\"%s%s\" %s--fpga=\"%s\" %s--fw=\"%s\"") % sudo % card_burner % ml % fpga_image_path % ml % fw_image_path); return str(boost::format("%s\n%s") % print_utility_error("uhd_images_downloader.py") % card_burner_cmd); } -- cgit v1.2.3