diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-05-09 16:25:11 -0700 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2019-05-10 16:59:58 -0700 |
commit | 0812a5f6bf600f3d09e40f55b02de91a3b82dd75 (patch) | |
tree | 41adfcb06150bf8515d3e4afe4c632df5ea6d89e /mpm/tools/eeprom.c | |
parent | e0e61a5a5eb2442c14f11298c358d8492c037a68 (diff) | |
download | uhd-0812a5f6bf600f3d09e40f55b02de91a3b82dd75.tar.gz uhd-0812a5f6bf600f3d09e40f55b02de91a3b82dd75.tar.bz2 uhd-0812a5f6bf600f3d09e40f55b02de91a3b82dd75.zip |
mpm: Add MB-EEPROMv3
This includes a rev_compat field, which we can use to identify the last
hardware revision this hardware is compatible with. Example: Say the
current hardware revision is 7, but it is compatible with version 5,
then we store 7 as the current rev, and 5 as the rev_compat. Software
can now check the rev_compat rather than the current rev for
compatibility. This makes MPM more future-proof against minor,
compatible hardware changes.
Diffstat (limited to 'mpm/tools/eeprom.c')
-rw-r--r-- | mpm/tools/eeprom.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/mpm/tools/eeprom.c b/mpm/tools/eeprom.c index c2bf3705e..ae036ac43 100644 --- a/mpm/tools/eeprom.c +++ b/mpm/tools/eeprom.c @@ -31,7 +31,7 @@ static const u32 USRP_EEPROM_MAGIC = 0xF008AD10; static const u32 USRP_EEPROM_DB_MAGIC = 0xF008AD11; -static const u32 USRP_EEPROM_VERSION = 2; +static const u32 USRP_EEPROM_VERSION = 3; static const u32 USRP_EEPROM_DB_VERSION = 2; static const u32 USRP_EEPROM_DEFAULT_MCU_FLAGS[4] = {0x0, 0x0, 0x0, 0x0}; @@ -127,7 +127,8 @@ struct usrp_sulfur_eeprom *usrp_sulfur_eeprom_new(const u32 *mcu_flags, const char *eth_addr1, const char *eth_addr2, const u16 dt_compat, - const u16 mcu_compat) + const u16 mcu_compat, + const u16 rev_compat) { struct usrp_sulfur_eeprom *ep; int i; @@ -173,6 +174,7 @@ struct usrp_sulfur_eeprom *usrp_sulfur_eeprom_new(const u32 *mcu_flags, ep->dt_compat = htons(dt_compat); ep->mcu_compat = htons(mcu_compat); + ep->rev_compat = htons(rev_compat); ep->crc = htonl(crc32(0, &ep->magic, sizeof(*ep)-4)); @@ -222,10 +224,14 @@ void usrp_sulfur_eeprom_print(const struct usrp_sulfur_eeprom *ep) ep->eth_addr2[0], ep->eth_addr2[1], ep->eth_addr2[2], ep->eth_addr2[3], ep->eth_addr2[4], ep->eth_addr2[5]); - if (ntohl(ep->version) == 2) + if (ntohl(ep->version) >= 2) printf("-- DT-Compat/MCU-Compat: %04x %04x\n", ntohs(ep->dt_compat), ntohs(ep->mcu_compat)); + if (ntohl(ep->version) >= 3) { + printf("-- Max-REV: %04x\n", ntohs(ep->rev_compat)); + } + printf("-- CRC: %08x (%s)\n", ntohl(ep->crc), __usrp_sulfur_eeprom_check_crc(ep) ? "matches": "doesn't match!"); } |