comparison target-utils/libload/cmd_blankchk.c @ 39:d67bfcb9e351

loadagent: blankchk command implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 13 May 2013 20:51:04 +0000
parents
children
comparison
equal deleted inserted replaced
38:5b3d7398d2d9 39:d67bfcb9e351
1 /*
2 * Flash blank check command
3 */
4
5 #include <sys/types.h>
6 #include "types.h"
7
8 void
9 cmd_blankchk(argbulk)
10 char *argbulk;
11 {
12 char *argv[3];
13 u_long start, length;
14 u_long addr;
15 int c;
16
17 if (parse_args(argbulk, 2, 2, argv, 0) < 0)
18 return;
19 if (parse_hexarg(argv[0], 8, &start) < 0) {
20 printf("ERROR: arg1 must be a valid 32-bit hex address\n");
21 return;
22 }
23 if (parse_hexarg(argv[1], 8, &length) < 0) {
24 printf("ERROR: arg2 must be a valid 32-bit hex value (length)\n");
25 return;
26 }
27 for (addr = start; addr < start + length; addr++) {
28 c = *(volatile u8 *)addr;
29 if (c != 0xFF) {
30 printf("Not blank: %02X at %08X\n", c, addr);
31 return;
32 }
33 }
34 printf("OK\n");
35 }