annotate loadtools/ltmisc.c @ 976:ca65f5adf1af

rvinterf: print old ASCII GPF traces emitted by 20020917 firmware on D-Sample
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 29 Nov 2015 05:22:41 +0000
parents 0c1480317c18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * This module is a place to implement little miscellaneous fc-loadtool
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * commands which don't belong anywhere else.
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 */
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <sys/types.h>
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <stdio.h>
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <stdint.h>
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9
71
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
10 cmd_dieid(argc, argv)
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
11 char **argv;
70
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 {
71
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
13 static uint32_t addrs[4] = {0xFFFEF010, 0xFFFEF012, 0xFFFEF014,
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
14 0xFFFEF016};
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
15 uint16_t data[4];
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
16 int i, stat;
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
17 FILE *of;
70
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18
71
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
19 for (i = 0; i < 4; i++) {
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
20 stat = do_r16(addrs[i], data + i);
70
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 if (stat)
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 return(stat);
71
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
23 printf("%08lX: %04X\n", (u_long)addrs[i], (int)data[i]);
70
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 }
71
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
25 if (argc < 2)
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
26 return(0);
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
27 of = fopen(argv[1], "w");
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
28 if (!of) {
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
29 perror(argv[1]);
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
30 return(-1);
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
31 }
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
32 for (i = 0; i < 4; i++)
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
33 fprintf(of, "%08lX: %04X\n", (u_long)addrs[i], (int)data[i]);
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
34 fclose(of);
0c1480317c18 dieid via fc-loadtool: added ability to save to a file
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 70
diff changeset
35 printf("Saved to %s\n", argv[1]);
70
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 return(0);
e2698daf40d1 dieid implemented in fc-loadtool as well
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 }