]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/cmd_mem.c
printf() --> printf_P(PSTR())
[z180-stamp.git] / avr / cmd_mem.c
index 6341e0b77682c5057fb27c964436654c176b3e24..91668bdf819a2e7bc0c9b4dc9eb9b84833a4242a 100644 (file)
@@ -194,7 +194,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
        do {
                z80_bus_cmd(Request);
                data = z80_read(addr);
-               printf("%05lx: %02x", addr, data);
+               printf_P(PSTR("%05lx: %02x"), addr, data);
                z80_bus_cmd(Release);
 
                nbytes = cli_readline(PSTR(" ? "));
@@ -292,7 +292,7 @@ command_ret_t do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const ar
 
                /* check for ctrl-c to abort... */
                if (ctrlc()) {
-                       my_puts("Abort\n");
+                       my_puts_P(PSTR("Abort\n"));
                        return CMD_RET_SUCCESS;
                }
        }
@@ -320,7 +320,7 @@ command_ret_t do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const ar
 
                /* check for ctrl-c to abort... */
                if (ctrlc()) {
-                       my_puts("Abort\n");
+                       my_puts_P(PSTR("Abort\n"));
                        return CMD_RET_SUCCESS;
                }
        }
@@ -365,12 +365,12 @@ command_ret_t do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
 
                /* check for ctrl-c to abort... */
                if (ctrlc()) {
-                       my_puts("Abort\n");
+                       my_puts_P(PSTR("Abort\n"));
                        return CMD_RET_SUCCESS;
                }
        }
 
-       printf("Total of %ld byte(s) (0x%lx) were the same\n", ngood, ngood);
+       printf_P(PSTR("Total of %ld byte(s) (0x%lx) were the same\n"), ngood, ngood);
        return rcode;
 }
 
@@ -392,7 +392,7 @@ command_ret_t do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
        count = strtoul(argv[3], NULL, 16);
 
        if (count == 0) {
-               my_puts ("Zero length ???\n");
+               my_puts_P(PSTR("Zero length?\n"));
                return CMD_RET_FAILURE;
        }
        
@@ -414,7 +414,7 @@ command_ret_t do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
 
                /* check for ctrl-c to abort... */
                if (ctrlc()) {
-                       my_puts("Abort\n");
+                       my_puts_P(PSTR("Abort\n"));
                        return CMD_RET_SUCCESS;
                }
        }
@@ -432,7 +432,7 @@ command_ret_t do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
                base_address = strtoul(argv[1], NULL, 16);
        }
        /* Print the current base address. */
-       printf("Base Address: 0x%05lx\n", base_address);
+       printf_P(PSTR("Base Address: 0x%05lx\n"), base_address);
        return CMD_RET_SUCCESS;
 }
 
@@ -566,8 +566,8 @@ static uint32_t mem_test_alt(vu_long *buf, uint32_t start_addr, uint32_t end_add
                        *dummy  = ~val; /* clear the test data off the bus */
                        readback = *addr;
                        if (readback != val) {
-                               printf("FAILURE (data line): "
-                                       "expected %05lx, actual %05lx\n",
+                               printf_P(PSTR("FAILURE (data line): "
+                                       "expected %05lx, actual %05lx\n"),
                                                val, readback);
                                errs++;
                                if (ctrlc())
@@ -577,8 +577,8 @@ static uint32_t mem_test_alt(vu_long *buf, uint32_t start_addr, uint32_t end_add
                        *dummy  = val;
                        readback = *addr;
                        if (readback != ~val) {
-                               printf("FAILURE (data line): "
-                                       "Is %05lx, should be %05lx\n",
+                               printf_P(PSTR("FAILURE (data line): "
+                                       "Is %05lx, should be %05lx\n"),
                                                readback, ~val);
                                errs++;
                                if (ctrlc())
@@ -641,8 +641,8 @@ static uint32_t mem_test_alt(vu_long *buf, uint32_t start_addr, uint32_t end_add
        for (offset = 1; offset < num_words; offset <<= 1) {
                temp = addr[offset];
                if (temp != pattern) {
-                       printf("\nFAILURE: Address bit stuck high @ 0x%.5lx:"
-                               " expected 0x%.5lx, actual 0x%.5lx\n",
+                       printf_P(PSTR("\nFAILURE: Address bit stuck high @ 0x%.5lx:"
+                               " expected 0x%.5lx, actual 0x%.5lx\n"),
                                start_addr + offset*sizeof(vu_long),
                                pattern, temp);
                        errs++;
@@ -661,9 +661,9 @@ static uint32_t mem_test_alt(vu_long *buf, uint32_t start_addr, uint32_t end_add
                for (offset = 1; offset < num_words; offset <<= 1) {
                        temp = addr[offset];
                        if ((temp != pattern) && (offset != test_offset)) {
-                               printf("\nFAILURE: Address bit stuck low or"
+                               printf_P(PSTR("\nFAILURE: Address bit stuck low or"
                                        " shorted @ 0x%.5lx: expected 0x%.5lx,"
-                                       " actual 0x%.5lx\n",
+                                       " actual 0x%.5lx\n"),
                                        start_addr + offset*sizeof(vu_long),
                                        pattern, temp);
                                errs++;
@@ -701,8 +701,8 @@ static uint32_t mem_test_alt(vu_long *buf, uint32_t start_addr, uint32_t end_add
        for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
                temp = addr[offset];
                if (temp != pattern) {
-                       printf("\nFAILURE (read/write) @ 0x%.5lx:"
-                               " expected 0x%.5lx, actual 0x%.5lx)\n",
+                       printf_P(PSTR("\nFAILURE (read/write) @ 0x%.5lx:"
+                               " expected 0x%.5lx, actual 0x%.5lx)\n"),
                                start_addr + offset*sizeof(vu_long),
                                pattern, temp);
                        errs++;
@@ -722,8 +722,8 @@ static uint32_t mem_test_alt(vu_long *buf, uint32_t start_addr, uint32_t end_add
                anti_pattern = ~pattern;
                temp = addr[offset];
                if (temp != anti_pattern) {
-                       printf("\nFAILURE (read/write): @ 0x%.5lx:"
-                               " expected 0x%.5lx, actual 0x%.5lx)\n",
+                       printf_P(PSTR("\nFAILURE (read/write): @ 0x%.5lx:"
+                               " expected 0x%.5lx, actual 0x%.5lx)\n"),
                                start_addr + offset*sizeof(vu_long),
                                anti_pattern, temp);
                        errs++;
@@ -762,9 +762,9 @@ static uint32_t mem_test_quick(vu_long *buf, uint32_t start_addr, uint32_t end_a
        }
        length = (end_addr - start_addr) / sizeof(uint32_t);
        end = buf + length;
-       printf("\rPattern %08lX  Writing..."
+       printf_P(PSTR("\rPattern %08lX  Writing..."
                "%12s"
-               "\b\b\b\b\b\b\b\b\b\b",
+               "\b\b\b\b\b\b\b\b\b\b"),
                pattern, "");
 
        for (addr = buf, val = pattern; addr < end; addr++) {
@@ -772,15 +772,15 @@ static uint32_t mem_test_quick(vu_long *buf, uint32_t start_addr, uint32_t end_a
                val += incr;
        }
 
-       my_puts("Reading...");
+       my_puts_P(PSTR("Reading..."));
 
        for (addr = buf, val = pattern; addr < end; addr++) {
                readback = *addr;
                if (readback != val) {
                        uint32_t offset = addr - buf;
 
-                       printf("\nMem error @ 0x%08X: "
-                               "found %08lX, expected %08lX\n",
+                       printf_P(PSTR("\nMem error @ 0x%08X: "
+                               "found %08lX, expected %08lX\n"),
                                (unsigned int)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
                                readback, val);
                        errs++;
@@ -835,7 +835,7 @@ command_ret_t do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
        else
                iteration_limit = 0;
 
-       printf("Testing %08x ... %08x:\n", (unsigned int)start, (unsigned int)end);
+       printf_P(PSTR("Testing %08x ... %08x:\n"), (unsigned int)start, (unsigned int)end);
        debug("%s:%d: start %#05lx end %#05lx\n", __func__, __LINE__,
              start, end);
 
@@ -850,7 +850,7 @@ command_ret_t do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
                        break;
                }
 
-               printf("Iteration: %6d\r", iteration + 1);
+               printf_P(PSTR("Iteration: %6d\r"), iteration + 1);
                debug("\n");
                if (alt_test) {
                        errs = mem_test_alt(buf, start, end, dummy);
@@ -867,7 +867,7 @@ command_ret_t do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
                putc('\n');
                ret = 1;
        } else {
-               printf("Tested %d iteration(s) with %lu errors.\n",
+               printf_P(PSTR("Tested %d iteration(s) with %lu errors.\n"),
                        iteration, errs);
                ret = errs != 0;
        }