diff options
author | Josh Blum <josh@joshknows.com> | 2010-11-11 11:07:39 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-11-11 11:07:39 -0800 |
commit | 926fd69de88725f14c34062a81969a4a833a7f61 (patch) | |
tree | 53265ba2229d4b12f1f8c4ca2e2e6e1fe9581b6d /host/lib/usrp/mboard_eeprom.cpp | |
parent | 0d0b4724b03070b8a4c988c5911655fd522930dd (diff) | |
download | uhd-926fd69de88725f14c34062a81969a4a833a7f61.tar.gz uhd-926fd69de88725f14c34062a81969a4a833a7f61.tar.bz2 uhd-926fd69de88725f14c34062a81969a4a833a7f61.zip |
usrp_e100: added byteswapping calls to vendor and device (its NBO)
Diffstat (limited to 'host/lib/usrp/mboard_eeprom.cpp')
-rw-r--r-- | host/lib/usrp/mboard_eeprom.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp index 842ee01e3..70f4664a0 100644 --- a/host/lib/usrp/mboard_eeprom.cpp +++ b/host/lib/usrp/mboard_eeprom.cpp @@ -18,6 +18,7 @@ #include <uhd/usrp/mboard_eeprom.hpp> #include <uhd/types/mac_addr.hpp> #include <uhd/utils/algorithm.hpp> +#include <uhd/utils/byteswap.hpp> #include <boost/asio/ip/address_v4.hpp> #include <boost/assign/list_of.hpp> #include <boost/lexical_cast.hpp> @@ -201,8 +202,8 @@ static void load_e100(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ byte_vector_t map_bytes = iface.read_eeprom(E100_EEPROM_ADDR, 0, num_bytes); e100_eeprom_map map; std::memcpy(&map, &map_bytes[0], map_bytes.size()); - mb_eeprom["vendor"] = boost::lexical_cast<std::string>(map.vendor); - mb_eeprom["device"] = boost::lexical_cast<std::string>(map.device); + mb_eeprom["vendor"] = boost::lexical_cast<std::string>(uhd::ntohx(map.vendor)); + mb_eeprom["device"] = boost::lexical_cast<std::string>(uhd::ntohx(map.device)); mb_eeprom["revision"] = boost::lexical_cast<std::string>(unsigned(map.revision)); mb_eeprom["content"] = boost::lexical_cast<std::string>(unsigned(map.content)); @@ -221,12 +222,12 @@ static void store_e100(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ if (mb_eeprom.has_key("vendor")) iface.write_eeprom( E100_EEPROM_ADDR, offsetof(e100_eeprom_map, vendor), - to_bytes(boost::lexical_cast<boost::uint16_t>(mb_eeprom["vendor"])) + to_bytes(uhd::htonx(boost::lexical_cast<boost::uint16_t>(mb_eeprom["vendor"]))) ); if (mb_eeprom.has_key("device")) iface.write_eeprom( E100_EEPROM_ADDR, offsetof(e100_eeprom_map, device), - to_bytes(boost::lexical_cast<boost::uint16_t>(mb_eeprom["device"])) + to_bytes(uhd::htonx(boost::lexical_cast<boost::uint16_t>(mb_eeprom["device"]))) ); if (mb_eeprom.has_key("revision")) iface.write_eeprom( |