annotate target-utils/libload/cmd_blankchk.c @ 979:ebdf5afa9fb5

fc-tmsh: omr responses parsed and formatted in a readable manner
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 10 Dec 2015 04:28:19 +0000
parents d67bfcb9e351
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * Flash blank check command
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 */
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <sys/types.h>
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 #include "types.h"
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 void
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 cmd_blankchk(argbulk)
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 char *argbulk;
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 {
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 char *argv[3];
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 u_long start, length;
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 u_long addr;
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 int c;
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 if (parse_args(argbulk, 2, 2, argv, 0) < 0)
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 return;
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 if (parse_hexarg(argv[0], 8, &start) < 0) {
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 printf("ERROR: arg1 must be a valid 32-bit hex address\n");
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 return;
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 }
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 if (parse_hexarg(argv[1], 8, &length) < 0) {
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 printf("ERROR: arg2 must be a valid 32-bit hex value (length)\n");
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 return;
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 }
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 for (addr = start; addr < start + length; addr++) {
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 c = *(volatile u8 *)addr;
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 if (c != 0xFF) {
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 printf("Not blank: %02X at %08X\n", c, addr);
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 return;
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 }
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 }
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 printf("OK\n");
d67bfcb9e351 loadagent: blankchk command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 }