diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-01-12 17:11:05 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-01-12 17:30:53 -0800 |
commit | deccab5a1b90df299b7b194bfef9da046f8f319b (patch) | |
tree | dac633f8e1fdabc370ff6bbacbf53d22332f260c /mpm/tools/db-init.c | |
parent | efc0b22f7ea9b808512cb59a5a52202adf84b6e1 (diff) | |
download | uhd-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-init.c')
-rw-r--r-- | mpm/tools/db-init.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/mpm/tools/db-init.c b/mpm/tools/db-init.c new file mode 100644 index 000000000..c0e7ba464 --- /dev/null +++ b/mpm/tools/db-init.c @@ -0,0 +1,44 @@ +// +// Copyright 2017 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0 +// + +#include "eeprom.h" +#include <stdlib.h> +#include <stdio.h> + +void usage(char *argv[]) +{ + printf("-- Usage -- \n"); + printf("%s slot pid rev serial#\n\n", argv[0]); + printf("Example:\n"); + printf("$ %s 0 0x0150 0 310A850\n", + argv[0]); + +} + + +int main(int argc, char *argv[]) +{ + struct usrp_sulfur_db_eeprom *ep; + int which_slot = 0; + + if (argc != 5) { + usage(argv); + return EXIT_FAILURE; + } + + which_slot = atoi(argv[1]); + + ep = usrp_sulfur_db_eeprom_new(strtol(argv[2], NULL, 16), atoi(argv[3]), argv[4]); + usrp_sulfur_db_eeprom_print(ep); + + if (!which_slot) + usrp_sulfur_db_eeprom_to_file(ep, NVMEM_PATH_SLOT_A); + else + usrp_sulfur_db_eeprom_to_file(ep, NVMEM_PATH_SLOT_B); + + return 0; +} + |