view target-utils/libload/cmd_blankchk.c @ 853:ae254ffeaec3

AT command interface works! The cause of the breakage was the same Nucleus API issue with NU_Create_Timer() which we encountered at the very beginning of this project with Riviera timers: the code in uartfax.c from TCS211 was passing 0 as the initial dummy value for the timer duration, and our FreeNucleus version doesn't like it. The fix is the same: pass 1 as the initial dummy value instead.
author Space Falcon <falcon@ivan.Harhan.ORG>
date Thu, 30 Apr 2015 01:46:26 +0000
parents d67bfcb9e351
children
line wrap: on
line source

/*
 * 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");
}