From 83dde40090e0bbd91c304602cc0e3c365f7878bb Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 26 Sep 2017 18:22:25 -0700 Subject: uhd: Changed mboard_eeprom_t interface, refactored MB EEPROM code - uhd::usrp::mboard_eeprom_t is now simply a map. Its commit() method has no utility being a public API call, because the user never gets access to the appropriate I2C object (Minor API breakage) - The central mboard_eeprom.cpp file was broken up and put into many smaller compilation units in every device's implementation folder. - Renamed some of the constants (e.g. B000_* -> USRP1_*, N100_* -> N200_*) - Removed the N000_* EEPROM code, because, well, you know, there's no such device --- host/lib/usrp/e100/e100_impl.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'host/lib/usrp/e100/e100_impl.cpp') diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp index ddb21fc35..7ee9dccbd 100644 --- a/host/lib/usrp/e100/e100_impl.cpp +++ b/host/lib/usrp/e100/e100_impl.cpp @@ -70,7 +70,8 @@ device_addrs_t e100_find(const device_addr_t &hint){ new_addr["node"] = fs::system_complete(fs::path(hint["node"])).string(); try{ i2c_iface::sptr i2c_iface = e100_ctrl::make_dev_i2c_iface(E100_I2C_DEV_NODE); - const mboard_eeprom_t mb_eeprom(*i2c_iface, E100_EEPROM_MAP_KEY); + const mboard_eeprom_t mb_eeprom = get_mb_eeprom(i2c_iface); + new_addr["name"] = mb_eeprom["name"]; new_addr["serial"] = mb_eeprom["serial"]; } @@ -108,7 +109,7 @@ static const uhd::dict model_to_fpga_file_name = boost std::string get_default_e1x0_fpga_image(const uhd::device_addr_t &device_addr){ //read the eeprom so we can determine the hardware uhd::i2c_iface::sptr dev_i2c_iface = e100_ctrl::make_dev_i2c_iface(E100_I2C_DEV_NODE); - const mboard_eeprom_t mb_eeprom(*dev_i2c_iface, E100_EEPROM_MAP_KEY); + const mboard_eeprom_t mb_eeprom = e100_impl::get_mb_eeprom(dev_i2c_iface); //determine the model string for this device const std::string model = device_addr.get("model", mb_eeprom.get("model", "")); @@ -132,8 +133,9 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ _ignore_cal_file = device_addr.has_key("ignore-cal-file"); _dev_i2c_iface = e100_ctrl::make_dev_i2c_iface(E100_I2C_DEV_NODE); - const mboard_eeprom_t mb_eeprom(*_dev_i2c_iface, E100_EEPROM_MAP_KEY); - const std::string default_fpga_file_name = get_default_e1x0_fpga_image(device_addr); + const mboard_eeprom_t mb_eeprom = get_mb_eeprom(_dev_i2c_iface); + const std::string default_fpga_file_name = + get_default_e1x0_fpga_image(device_addr); const std::string model = device_addr["model"]; std::string e100_fpga_image; try{ @@ -496,10 +498,6 @@ double e100_impl::update_rx_codec_gain(const double gain){ return _codec_ctrl->get_rx_pga_gain('A'); } -void e100_impl::set_mb_eeprom(const uhd::usrp::mboard_eeprom_t &mb_eeprom){ - mb_eeprom.commit(*_dev_i2c_iface, E100_EEPROM_MAP_KEY); -} - void e100_impl::set_db_eeprom(const std::string &type, const uhd::usrp::dboard_eeprom_t &db_eeprom){ if (type == "rx") db_eeprom.store(*_fpga_i2c_ctrl, I2C_ADDR_RX_DB); if (type == "tx") db_eeprom.store(*_fpga_i2c_ctrl, I2C_ADDR_TX_DB); -- cgit v1.2.3