FreeCalypso > hg > freecalypso-tools
comparison loadtools/ltmisc.c @ 0:e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 11 Jun 2016 00:13:35 +0000 |
parents | |
children | 5385aca4d813 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e7502631a0f9 |
---|---|
1 /* | |
2 * This module is a place to implement little miscellaneous fc-loadtool | |
3 * commands which don't belong anywhere else. | |
4 */ | |
5 | |
6 #include <sys/types.h> | |
7 #include <stdio.h> | |
8 #include <stdint.h> | |
9 | |
10 cmd_dieid(argc, argv) | |
11 char **argv; | |
12 { | |
13 static uint32_t addrs[4] = {0xFFFEF010, 0xFFFEF012, 0xFFFEF014, | |
14 0xFFFEF016}; | |
15 uint16_t data[4]; | |
16 int i, stat; | |
17 FILE *of; | |
18 | |
19 for (i = 0; i < 4; i++) { | |
20 stat = do_r16(addrs[i], data + i); | |
21 if (stat) | |
22 return(stat); | |
23 printf("%08lX: %04X\n", (u_long)addrs[i], (int)data[i]); | |
24 } | |
25 if (argc < 2) | |
26 return(0); | |
27 of = fopen(argv[1], "w"); | |
28 if (!of) { | |
29 perror(argv[1]); | |
30 return(-1); | |
31 } | |
32 for (i = 0; i < 4; i++) | |
33 fprintf(of, "%08lX: %04X\n", (u_long)addrs[i], (int)data[i]); | |
34 fclose(of); | |
35 printf("Saved to %s\n", argv[1]); | |
36 return(0); | |
37 } |