diff options
Diffstat (limited to 'host/lib/usrp/usrp1')
| -rw-r--r-- | host/lib/usrp/usrp1/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | host/lib/usrp/usrp1/mboard_impl.cpp | 33 | ||||
| -rw-r--r-- | host/lib/usrp/usrp1/usrp1_iface.cpp | 4 | ||||
| -rw-r--r-- | host/lib/usrp/usrp1/usrp1_iface.hpp | 3 | ||||
| -rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 13 | 
5 files changed, 28 insertions, 27 deletions
| diff --git a/host/lib/usrp/usrp1/CMakeLists.txt b/host/lib/usrp/usrp1/CMakeLists.txt index 67487f99e..022015231 100644 --- a/host/lib/usrp/usrp1/CMakeLists.txt +++ b/host/lib/usrp/usrp1/CMakeLists.txt @@ -40,7 +40,7 @@ ENDIF(ENABLE_USRP1 AND NOT HAVE_USB_SUPPORT)  IF(ENABLE_USRP1)      MESSAGE(STATUS "  Building USRP1 support.") -    INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../firmware/fx2/include) +    INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../firmware/fx2/common)      LIBUHD_APPEND_SOURCES(          ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/clock_ctrl.cpp diff --git a/host/lib/usrp/usrp1/mboard_impl.cpp b/host/lib/usrp/usrp1/mboard_impl.cpp index 669b20efa..86f78a7a9 100644 --- a/host/lib/usrp/usrp1/mboard_impl.cpp +++ b/host/lib/usrp/usrp1/mboard_impl.cpp @@ -262,24 +262,10 @@ void usrp1_impl::mboard_get(const wax::obj &key_, wax::obj &val)  {      named_prop_t key = named_prop_t::extract(key_); -    if(key_.type() == typeid(std::string)) { -      if(key.as<std::string>() == "serial") { -        uhd::byte_vector_t buf; -        buf.insert(buf.begin(), 248); -        boost::this_thread::sleep(boost::posix_time::milliseconds(100)); -        _iface->write_i2c(I2C_DEV_EEPROM, buf); -        boost::this_thread::sleep(boost::posix_time::milliseconds(100)); -        buf = _iface->read_i2c(I2C_DEV_EEPROM, 8); -        val = std::string(buf.begin(), buf.end()); -      } - -      return; -   	} -      //handle the get request conditioned on the key      switch(key.as<mboard_prop_t>()){      case MBOARD_PROP_NAME: -        val = std::string("usrp1 mboard - " + (*_mboard_proxy)[std::string("serial")].as<std::string>()); +        val = std::string("usrp1 mboard - " + _iface->mb_eeprom["serial"]);          return;      case MBOARD_PROP_OTHERS: @@ -336,6 +322,10 @@ void usrp1_impl::mboard_get(const wax::obj &key_, wax::obj &val)          val = _tx_subdev_spec;          return; +    case MBOARD_PROP_EEPROM_MAP: +        val = _iface->mb_eeprom; +        return; +      default: UHD_THROW_PROP_GET_ERROR();      }  } @@ -351,14 +341,6 @@ void usrp1_impl::mboard_set(const wax::obj &key, const wax::obj &val)          std::cout << "USRP1 EEPROM image: " << usrp1_eeprom_image << std::endl;          _ctrl_transport->usrp_load_eeprom(val.as<std::string>());        } - -      if(key.as<std::string>() == "serial") { -        std::string sernum = val.as<std::string>(); -        uhd::byte_vector_t buf(sernum.begin(), sernum.end()); -        buf.insert(buf.begin(), 248); -        _iface->write_i2c(I2C_DEV_EEPROM, buf); -      } -        return;     	} @@ -395,6 +377,11 @@ void usrp1_impl::mboard_set(const wax::obj &key, const wax::obj &val)          _iface->poke32(FR_TX_MUX, calc_tx_mux(_tx_subdev_spec, _mboard_proxy->get_link()));          return; +    case MBOARD_PROP_EEPROM_MAP: +        _iface->mb_eeprom = val.as<mboard_eeprom_t>(); +        _iface->mb_eeprom.commit(*_iface, mboard_eeprom_t::MAP_BXXX); +        return; +      default: UHD_THROW_PROP_SET_ERROR();      }  } diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index 64ced2905..dcba3e819 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -25,6 +25,7 @@  #include <iomanip>  using namespace uhd; +using namespace uhd::usrp;  using namespace uhd::transport;  static const bool iface_debug = false; @@ -36,7 +37,8 @@ public:       ******************************************************************/      usrp1_iface_impl(usrp_ctrl::sptr ctrl_transport)      { -        _ctrl_transport = ctrl_transport;  +        _ctrl_transport = ctrl_transport; +        mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_BXXX);      }      ~usrp1_iface_impl(void) diff --git a/host/lib/usrp/usrp1/usrp1_iface.hpp b/host/lib/usrp/usrp1/usrp1_iface.hpp index 3f608584a..34a2330b5 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.hpp +++ b/host/lib/usrp/usrp1/usrp1_iface.hpp @@ -18,6 +18,7 @@  #ifndef INCLUDED_USRP1_IFACE_HPP  #define INCLUDED_USRP1_IFACE_HPP +#include <uhd/usrp/mboard_eeprom.hpp>  #include <uhd/types/serial.hpp>  #include <boost/shared_ptr.hpp>  #include <boost/utility.hpp> @@ -81,6 +82,8 @@ public:                                     boost::uint16_t index,                                     unsigned char* buff,                                     boost::uint16_t length) = 0; + +    uhd::usrp::mboard_eeprom_t mb_eeprom;  };  #endif /* INCLUDED_USRP1_IFACE_HPP */ diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index bc478c7fb..6016b0979 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -56,6 +56,10 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)      //return an empty list of addresses when type is set to non-usrp1      if (hint.has_key("type") and hint["type"] != "usrp1") return usrp1_addrs; +    //Return an empty list of addresses when an address is specified, +    //since an address is intended for a different, non-USB, device. +    if (hint.has_key("addr")) return usrp1_addrs; +      //extract the firmware path for the USRP1      std::string usrp1_fw_image;      try{ @@ -89,11 +93,16 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)      pid = USRP1_PRODUCT_ID;      BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) { +        usrp1_iface::sptr iface = usrp1_iface::make(usrp_ctrl::make(usb_control::make(handle)));          device_addr_t new_addr;          new_addr["type"] = "usrp1"; +        new_addr["name"] = iface->mb_eeprom["name"];          new_addr["serial"] = handle->get_serial(); -        //this is a found usrp1 when a hint serial is not specified or it matches -        if (not hint.has_key("serial") or hint["serial"] == new_addr["serial"]){ +        //this is a found usrp1 when the hint serial and name match or blank +        if ( +            (not hint.has_key("name")   or hint["name"]   == new_addr["name"]) and +            (not hint.has_key("serial") or hint["serial"] == new_addr["serial"]) +        ){              usrp1_addrs.push_back(new_addr);          }      } | 
