aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-07-11 13:02:21 -0700
committerJosh Blum <josh@joshknows.com>2011-07-11 13:02:21 -0700
commit9d470d5db39c75308f3ac15a8512f08b714b4ee4 (patch)
treef067a04f27c8e325c90d46ad470c94d68c460da9
parentbedd308e605f4772f156b13c702955422bfa87c5 (diff)
downloaduhd-9d470d5db39c75308f3ac15a8512f08b714b4ee4.tar.gz
uhd-9d470d5db39c75308f3ac15a8512f08b714b4ee4.tar.bz2
uhd-9d470d5db39c75308f3ac15a8512f08b714b4ee4.zip
usrp2: added a place for product code in eeprom map
-rw-r--r--host/lib/usrp/mboard_eeprom.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp
index 79cc2f5b2..35fba547a 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"],