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/eeprom-blank.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/eeprom-blank.c')
-rw-r--r-- | mpm/tools/eeprom-blank.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/mpm/tools/eeprom-blank.c b/mpm/tools/eeprom-blank.c new file mode 100644 index 000000000..d8314a382 --- /dev/null +++ b/mpm/tools/eeprom-blank.c @@ -0,0 +1,45 @@ +// +// Copyright 2017 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0 +// + +#include "eeprom.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +void usage(char *argv[]) +{ + printf("-- Usage -- \n"); + printf("Example:\n"); + printf("%s -c -f\n", argv[0]); +} + + +int main(int argc, char *argv[]) +{ + struct usrp_sulfur_eeprom *ep; + int erase = 0; + + if (argc == 3) { + erase = !strcmp("-c", argv[1]) && + !strcmp("-f", argv[2]); + } else { + usage(argv); + return EXIT_FAILURE; + } + + if (!erase) + return EXIT_FAILURE; + + printf("Erasing ..."); + ep = malloc(sizeof(*ep)); + memset(ep, 0xff, sizeof(*ep)); + + usrp_sulfur_eeprom_to_i2c(ep, "/dev/i2c-2"); + printf(" Done\n"); + free(ep); + + return EXIT_SUCCESS; +} |