aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/tools/db-id.c
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-01-12 17:11:05 -0800
committerMartin Braun <martin.braun@ettus.com>2018-01-12 17:30:53 -0800
commitdeccab5a1b90df299b7b194bfef9da046f8f319b (patch)
treedac633f8e1fdabc370ff6bbacbf53d22332f260c /mpm/tools/db-id.c
parentefc0b22f7ea9b808512cb59a5a52202adf84b6e1 (diff)
downloaduhd-deccab5a1b90df299b7b194bfef9da046f8f319b.tar.gz
uhd-deccab5a1b90df299b7b194bfef9da046f8f319b.tar.bz2
uhd-deccab5a1b90df299b7b194bfef9da046f8f319b.zip
mpm: Add EEPROM utilities for N310
Actually-written-by: Moritz Fischer <moritz.fischer@ettus.com>
Diffstat (limited to 'mpm/tools/db-id.c')
-rw-r--r--mpm/tools/db-id.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/mpm/tools/db-id.c b/mpm/tools/db-id.c
new file mode 100644
index 000000000..140f50914
--- /dev/null
+++ b/mpm/tools/db-id.c
@@ -0,0 +1,43 @@
+//
+// Copyright 2017 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: GPL-3.0
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "eeprom.h"
+
+static void usrp_sulfur_db_eeprom_print_id(struct usrp_sulfur_db_eeprom *ep)
+{
+ if (ntohs(ep->pid) == 0x150)
+ printf("product=ni,magnesium-rev%x\n", ntohs(ep->rev)+1);
+ else if (ntohs(ep->pid) == 0x180)
+ printf("product=ni,eiscat-rev%x\n", ntohs(ep->rev)+1);
+ else
+ printf("product=unknown-(%04x)\n", ep->pid);
+
+ printf("serial=%s\n", ep->serial);
+}
+
+int main(int argc, char *argv[])
+{
+ struct usrp_sulfur_db_eeprom *ep;
+
+ ep = usrp_sulfur_db_eeprom_from_file(NVMEM_PATH_SLOT_A);
+ if (ep) {
+ printf("Slot-0\n");
+ usrp_sulfur_db_eeprom_print_id(ep);
+ free(ep);
+ }
+
+ ep = usrp_sulfur_db_eeprom_from_file(NVMEM_PATH_SLOT_B);
+ if (ep) {
+ printf("Slot-0\n");
+ usrp_sulfur_db_eeprom_print_id(ep);
+ free(ep);
+ }
+
+ return EXIT_SUCCESS;
+}
+