FreeCalypso > hg > freecalypso-tools
comparison loadtools/ltmisc.c @ 640:5385aca4d813
fc-loadtool module refactoring: CRC-32 functions split out
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 01 Mar 2020 18:54:29 +0000 |
parents | e7502631a0f9 |
children | 0d199c6a6ea4 |
comparison
equal
deleted
inserted
replaced
639:963d15a808eb | 640:5385aca4d813 |
---|---|
4 */ | 4 */ |
5 | 5 |
6 #include <sys/types.h> | 6 #include <sys/types.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdlib.h> | |
10 | |
11 cmd_crc32(argc, argv) | |
12 char **argv; | |
13 { | |
14 u_long area_base, area_len; | |
15 char *strtoul_endp; | |
16 u_long crc_result; | |
17 int stat; | |
18 | |
19 area_base = strtoul(argv[1], &strtoul_endp, 16); | |
20 if (*strtoul_endp) { | |
21 inv: fprintf(stderr, "usage: crc32 hex-start hex-len\n"); | |
22 return(-1); | |
23 } | |
24 area_len = strtoul(argv[2], &strtoul_endp, 16); | |
25 if (*strtoul_endp) | |
26 goto inv; | |
27 stat = crc32_on_target(area_base, area_len, &crc_result); | |
28 if (stat == 0) | |
29 printf("%08lX\n", crc_result); | |
30 return(stat); | |
31 } | |
9 | 32 |
10 cmd_dieid(argc, argv) | 33 cmd_dieid(argc, argv) |
11 char **argv; | 34 char **argv; |
12 { | 35 { |
13 static uint32_t addrs[4] = {0xFFFEF010, 0xFFFEF012, 0xFFFEF014, | 36 static uint32_t addrs[4] = {0xFFFEF010, 0xFFFEF012, 0xFFFEF014, |