diff options
| -rw-r--r-- | host/lib/usrp/e100/e100_impl.cpp | 17 | ||||
| -rw-r--r-- | host/lib/usrp/e100/e100_impl.hpp | 1 | 
2 files changed, 14 insertions, 4 deletions
| diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp index d3d9e32e6..052785d4e 100644 --- a/host/lib/usrp/e100/e100_impl.cpp +++ b/host/lib/usrp/e100/e100_impl.cpp @@ -111,8 +111,21 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){      const std::string node = device_addr["node"];      _fpga_ctrl = e100_ctrl::make(node); +    //read the eeprom so we can determine the hardware +    _dev_i2c_iface = e100_ctrl::make_dev_i2c_iface(E100_I2C_DEV_NODE); +    const mboard_eeprom_t mb_eeprom(*_dev_i2c_iface, mboard_eeprom_t::MAP_E100); + +    //determine the model string for this device +    const std::string model = device_addr.get("model", mb_eeprom.get("model", "")); +    if (model.empty()) throw uhd::runtime_error("unable to determine model"); +      //extract the fpga path and compute hash -    const std::string e100_fpga_image = find_image_path(device_addr.get("fpga", E100_FPGA_FILE_NAME)); +    static const uhd::dict<std::string, std::string> model_to_fpga_file_name = boost::assign::map_list_of +        ("E100", "usrp_e100_fpga_v2.bin") +        ("E110", "usrp_e110_fpga.bin") +    ; +    const std::string default_fpga_file_name = model_to_fpga_file_name(model); +    const std::string e100_fpga_image = find_image_path(device_addr.get("fpga", default_fpga_file_name));      const boost::uint32_t file_hash = boost::uint32_t(hash_fpga_file(e100_fpga_image));      //When the hash does not match: @@ -162,7 +175,6 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){      ////////////////////////////////////////////////////////////////////      _fpga_i2c_ctrl = i2c_core_100::make(_fpga_ctrl, E100_REG_SLAVE(3));      _fpga_spi_ctrl = spi_core_100::make(_fpga_ctrl, E100_REG_SLAVE(2)); -    _dev_i2c_iface = e100_ctrl::make_dev_i2c_iface(E100_I2C_DEV_NODE);      _data_transport = e100_make_mmap_zero_copy(_fpga_ctrl);      //////////////////////////////////////////////////////////////////// @@ -176,7 +188,6 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){      ////////////////////////////////////////////////////////////////////      // setup the mboard eeprom      //////////////////////////////////////////////////////////////////// -    const mboard_eeprom_t mb_eeprom(*_dev_i2c_iface, mboard_eeprom_t::MAP_E100);      _tree->create<mboard_eeprom_t>(mb_path / "eeprom")          .set(mb_eeprom)          .subscribe(boost::bind(&e100_impl::set_mb_eeprom, this, _1)); diff --git a/host/lib/usrp/e100/e100_impl.hpp b/host/lib/usrp/e100/e100_impl.hpp index 1800e15b5..86ed76212 100644 --- a/host/lib/usrp/e100/e100_impl.hpp +++ b/host/lib/usrp/e100/e100_impl.hpp @@ -46,7 +46,6 @@ uhd::transport::zero_copy_if::sptr e100_make_mmap_zero_copy(e100_ctrl::sptr ifac  static const double          E100_RX_LINK_RATE_BPS = 166e6/3/2*2;  static const double          E100_TX_LINK_RATE_BPS = 166e6/3/1*2;  static const std::string     E100_I2C_DEV_NODE = "/dev/i2c-3"; -static const std::string     E100_FPGA_FILE_NAME = "usrp_e100_fpga_v2.bin";  static const boost::uint16_t E100_FPGA_COMPAT_NUM = 0x06;  static const boost::uint32_t E100_RX_SID_BASE = 2;  static const boost::uint32_t E100_TX_ASYNC_SID = 1; | 
