aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/tools/db-init.c
blob: fdf8dcd879590b8824b87ddf19d85895204dee41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Copyright 2017 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//

#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;
}