diff options
author | Josh Blum <josh@joshknows.com> | 2011-07-11 13:02:21 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-07-13 12:46:07 -0700 |
commit | 5239879e9f97bdbb6e3c531cee85824823ebff89 (patch) | |
tree | 8a5f2230b3dec83eedac05eb0865082f80ef87d1 /host | |
parent | ba0e3c8dcc90ea3e4cf015dea1038cb51a89b159 (diff) | |
download | uhd-5239879e9f97bdbb6e3c531cee85824823ebff89.tar.gz uhd-5239879e9f97bdbb6e3c531cee85824823ebff89.tar.bz2 uhd-5239879e9f97bdbb6e3c531cee85824823ebff89.zip |
usrp2: added a place for product code in eeprom map
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/mboard_eeprom.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp index 2ee4a9284..f65b0aac8 100644 --- a/host/lib/usrp/mboard_eeprom.cpp +++ b/host/lib/usrp/mboard_eeprom.cpp @@ -75,6 +75,7 @@ static const uhd::dict<std::string, boost::uint8_t> USRP_N100_OFFSETS = boost::a ("mac-addr", 0x02) ("ip-addr", 0x0C) //leave space here for other addresses (perhaps) + ("prod-lsb-msb", 0x14) ("gpsdo", 0x17) ("serial", 0x18) ("name", 0x18 + SERIAL_LEN) @@ -92,6 +93,11 @@ static void load_n100(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ boost::uint16_t rev = (boost::uint16_t(rev_lsb_msb.at(0)) << 0) | (boost::uint16_t(rev_lsb_msb.at(1)) << 8); mb_eeprom["rev"] = boost::lexical_cast<std::string>(rev); + //extract the product code + byte_vector_t prod_lsb_msb = iface.read_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["prod-lsb-msb"], 2); + boost::uint16_t prod = (boost::uint16_t(prod_lsb_msb.at(0)) << 0) | (boost::uint16_t(prod_lsb_msb.at(1)) << 8); + mb_eeprom["product"] = (prod == 0 or prod == 0xffff)? "" : boost::lexical_cast<std::string>(prod); + //extract the addresses mb_eeprom["mac-addr"] = mac_addr_t::from_bytes(iface.read_eeprom( N100_EEPROM_ADDR, USRP_N100_OFFSETS["mac-addr"], 6 @@ -140,6 +146,16 @@ static void store_n100(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ iface.write_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["rev-lsb-msb"], rev_lsb_msb); } + //parse the product code + if (mb_eeprom.has_key("product")){ + boost::uint16_t prod = boost::lexical_cast<boost::uint16_t>(mb_eeprom["product"]); + byte_vector_t prod_lsb_msb = boost::assign::list_of + (boost::uint8_t(prod >> 0)) + (boost::uint8_t(prod >> 8)) + ; + iface.write_eeprom(N100_EEPROM_ADDR, USRP_N100_OFFSETS["prod-lsb-msb"], prod_lsb_msb); + } + //store the addresses if (mb_eeprom.has_key("mac-addr")) iface.write_eeprom( N100_EEPROM_ADDR, USRP_N100_OFFSETS["mac-addr"], |