changeset 39:d67bfcb9e351

loadagent: blankchk command implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 13 May 2013 20:51:04 +0000
parents 5b3d7398d2d9
children 9b4c5ce3db8b
files target-utils/libload/Makefile target-utils/libload/cmd_blankchk.c target-utils/libload/cmd_crc32.c target-utils/loadagent/cmdtab.c
diffstat 4 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/libload/Makefile	Mon May 13 20:40:44 2013 +0000
+++ b/target-utils/libload/Makefile	Mon May 13 20:51:04 2013 +0000
@@ -4,7 +4,7 @@
 AR=	arm-elf-ar
 RANLIB=	arm-elf-ranlib
 
-OBJS=	cmd_crc32.o cmd_memdump_human.o cmd_memdump_machine.o
+OBJS=	cmd_blankchk.o cmd_crc32.o cmd_memdump_human.o cmd_memdump_machine.o
 
 all:	libload.a
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/libload/cmd_blankchk.c	Mon May 13 20:51:04 2013 +0000
@@ -0,0 +1,35 @@
+/*
+ * Flash blank check command
+ */
+
+#include <sys/types.h>
+#include "types.h"
+
+void
+cmd_blankchk(argbulk)
+	char *argbulk;
+{
+	char *argv[3];
+	u_long start, length;
+	u_long addr;
+	int c;
+
+	if (parse_args(argbulk, 2, 2, argv, 0) < 0)
+		return;
+	if (parse_hexarg(argv[0], 8, &start) < 0) {
+		printf("ERROR: arg1 must be a valid 32-bit hex address\n");
+		return;
+	}
+	if (parse_hexarg(argv[1], 8, &length) < 0) {
+	    printf("ERROR: arg2 must be a valid 32-bit hex value (length)\n");
+		return;
+	}
+	for (addr = start; addr < start + length; addr++) {
+		c = *(volatile u8 *)addr;
+		if (c != 0xFF) {
+			printf("Not blank: %02X at %08X\n", c, addr);
+			return;
+		}
+	}
+	printf("OK\n");
+}
--- a/target-utils/libload/cmd_crc32.c	Mon May 13 20:40:44 2013 +0000
+++ b/target-utils/libload/cmd_crc32.c	Mon May 13 20:51:04 2013 +0000
@@ -82,7 +82,6 @@
 	char *argv[3];
 	u_long start, length;
 	u_long addr, crc;
-	int i;
 
 	if (parse_args(argbulk, 2, 2, argv, 0) < 0)
 		return;
--- a/target-utils/loadagent/cmdtab.c	Mon May 13 20:40:44 2013 +0000
+++ b/target-utils/loadagent/cmdtab.c	Mon May 13 20:51:04 2013 +0000
@@ -1,5 +1,6 @@
 #include "cmdtab.h"
 
+extern void cmd_blankchk();
 extern void cmd_crc32();
 extern void cmd_jump();
 extern void cmd_r8();
@@ -16,6 +17,7 @@
 const struct cmdtab cmdtab[] = {
 	{"DUMP", cmd_memdump_machine},
 	{"baud", cmd_baud_switch},
+	{"blankchk", cmd_blankchk},
 	{"crc32", cmd_crc32},
 	{"dump", cmd_memdump_human},
 	{"jump", cmd_jump},