diff options
author | Josh Blum <josh@joshknows.com> | 2011-08-30 01:44:43 +0000 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-09-01 17:15:40 -0700 |
commit | 18e175d0f1718809ee6b7bedbdbc646a06ef2eca (patch) | |
tree | ebf9efc87d75f7702cdfb0e50ed71bcdc57c392d /host/lib/usrp/e100/e100_impl.cpp | |
parent | 63cecd4b91bfc3db4214451e00a427106437e65d (diff) | |
download | uhd-18e175d0f1718809ee6b7bedbdbc646a06ef2eca.tar.gz uhd-18e175d0f1718809ee6b7bedbdbc646a06ef2eca.tar.bz2 uhd-18e175d0f1718809ee6b7bedbdbc646a06ef2eca.zip |
e100: use model string to determine FPGA image to support E110
Diffstat (limited to 'host/lib/usrp/e100/e100_impl.cpp')
-rw-r--r-- | host/lib/usrp/e100/e100_impl.cpp | 17 |
1 files changed, 14 insertions, 3 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)); |