diff options
author | Ashish Chaudhari <ashish@ettus.com> | 2015-07-18 22:26:25 -0700 |
---|---|---|
committer | Ashish Chaudhari <ashish@ettus.com> | 2015-07-18 22:26:25 -0700 |
commit | 410b2447769ada7142c164cdfde7eefb8270bef8 (patch) | |
tree | 3a55ef1ae0273695398588a0b1c6b5088b82cff6 /host | |
parent | 722f6f6b398e7698089138ed41824b48b569c4ca (diff) | |
download | uhd-410b2447769ada7142c164cdfde7eefb8270bef8.tar.gz uhd-410b2447769ada7142c164cdfde7eefb8270bef8.tar.bz2 uhd-410b2447769ada7142c164cdfde7eefb8270bef8.zip |
x300: Added HW rev compat number support
- Added new field "revision_compat" to mb_eeprom
- Enforce a revision_compat of 7
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/mboard_eeprom.cpp | 14 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_fw_common.h | 2 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 37 |
3 files changed, 40 insertions, 13 deletions
diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp index 9c92fe252..c2415763b 100644 --- a/host/lib/usrp/mboard_eeprom.cpp +++ b/host/lib/usrp/mboard_eeprom.cpp @@ -213,7 +213,8 @@ struct x300_eeprom_map //indentifying numbers unsigned char revision[2]; unsigned char product[2]; - boost::uint8_t _pad0[4]; + unsigned char revision_compat[2]; + boost::uint8_t _pad0[2]; //all the mac addrs boost::uint8_t mac_addr0[6]; @@ -244,6 +245,11 @@ static void load_x300(mboard_eeprom_t &mb_eeprom, i2c_iface &iface) iface.read_eeprom(X300_EEPROM_ADDR, offsetof(x300_eeprom_map, product), 2) ); + //extract the revision compat number + mb_eeprom["revision_compat"] = uint16_bytes_to_string( + iface.read_eeprom(X300_EEPROM_ADDR, offsetof(x300_eeprom_map, revision_compat), 2) + ); + //extract the mac addresses mb_eeprom["mac-addr0"] = mac_addr_t::from_bytes(iface.read_eeprom( X300_EEPROM_ADDR, offsetof(x300_eeprom_map, mac_addr0), 6 @@ -291,6 +297,12 @@ static void store_x300(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface) string_to_uint16_bytes(mb_eeprom["product"]) ); + //parse the revision compat number + if (mb_eeprom.has_key("revision_compat")) iface.write_eeprom( + X300_EEPROM_ADDR, offsetof(x300_eeprom_map, revision_compat), + string_to_uint16_bytes(mb_eeprom["revision_compat"]) + ); + //store the mac addresses if (mb_eeprom.has_key("mac-addr0")) iface.write_eeprom( X300_EEPROM_ADDR, offsetof(x300_eeprom_map, mac_addr0), diff --git a/host/lib/usrp/x300/x300_fw_common.h b/host/lib/usrp/x300/x300_fw_common.h index f7364c774..79b6670b3 100644 --- a/host/lib/usrp/x300/x300_fw_common.h +++ b/host/lib/usrp/x300/x300_fw_common.h @@ -29,7 +29,7 @@ extern "C" { #endif -#define X300_MAX_HW_REV 8 +#define X300_REVISION_COMPAT 7 #define X300_FW_COMPAT_MAJOR 4 #define X300_FW_COMPAT_MINOR 0 #define X300_FPGA_COMPAT_MAJOR 11 diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 34090faa3..3cfb18a38 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -604,10 +604,8 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) } //////////////////////////////////////////////////////////////////// - // create clock control objects + // read hardware revision and compatibility number //////////////////////////////////////////////////////////////////// - UHD_MSG(status) << "Setup RF frontend clocking..." << std::endl; - mb.hw_rev = 0; if(mb_eeprom.has_key("revision") and not mb_eeprom["revision"].empty()) { try { @@ -624,16 +622,33 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) mb.hw_rev = X300_REV("D"); } - if (mb.hw_rev > X300_MAX_HW_REV) { - throw uhd::runtime_error(str( - boost::format("Unsupported board revision number: %d.\n" - "The maximum board revision number supported in this version is %d.\n" - "Please update your UHD version.") - % mb.hw_rev % X300_MAX_HW_REV - )); + if (mb_eeprom.has_key("revision_compat") and not mb_eeprom["revision_compat"].empty()) { + size_t hw_rev_compat = 0; + try { + hw_rev_compat = boost::lexical_cast<size_t>(mb_eeprom["revision_compat"]); + } catch(...) { + UHD_MSG(warning) << "Revision compat in EEPROM is invalid! Please reprogram your EEPROM." << std::endl; + } + + if (hw_rev_compat > X300_REVISION_COMPAT) { + throw uhd::runtime_error(str(boost::format( + "Hardware is too new for this software. Please upgrade to a UHD/NI-USRP that supports hardware revision %d.") + % mb.hw_rev)); + } else if (hw_rev_compat < X300_REVISION_COMPAT) { + throw uhd::runtime_error(str(boost::format( + "Hardware is too new for this software. Please downgrade to a UHD/NI-USRP that supports hardware revision %d.") + % mb.hw_rev)); + } + } else if (mb.hw_rev >= 7) { //Revision compat was added with revision 7 + UHD_MSG(warning) << "No revision compat detected MB EEPROM must be reprogrammed!" << std::endl; } - //Create clock control. NOTE: This does not configure the LMK yet. + //////////////////////////////////////////////////////////////////// + // create clock control objects + //////////////////////////////////////////////////////////////////// + UHD_MSG(status) << "Setup RF frontend clocking..." << std::endl; + + //Initialize clock control registers. NOTE: This does not configure the LMK yet. initialize_clock_control(mb); mb.clock = x300_clock_ctrl::make(mb.zpu_spi, 1 /*slaveno*/, |