Newer
Older
mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
ulong addr, i;
int nbytes, size;
return CMD_RET_USAGE;
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout(); /* got a good command to get here */
#endif
/* We use the last specified parameters, unless new ones are
* entered.
*/
addr = mm_last_addr;
size = mm_last_size;
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
return 1;
/* Address is specified since argc > 1
*/
addr = simple_strtoul(argv[1], NULL, 16);
addr += base_address;
}
#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash(addr)){
puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
return 0;
}
#endif
#ifdef CONFIG_BLACKFIN
if (addr_bfin_on_chip_mem(addr)) {
puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
return 0;
}
#endif
/* Print the address, followed by value. Then accept input for
* the next value. A non-converted value exits.
*/
do {
ptr = map_sysmem(addr, size);
printf(" %08x", *((uint *)ptr));
printf(" %04x", *((ushort *)ptr));
printf(" %02x", *((u_char *)ptr));
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
nbytes = readline (" ? ");
if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
/* <CR> pressed as only input, don't modify current
* location and move to next. "-" pressed will go back.
*/
if (incrflag)
addr += nbytes ? -size : size;
nbytes = 1;
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout(); /* good enough to not time out */
#endif
}
#ifdef CONFIG_BOOT_RETRY_TIME
else if (nbytes == -2) {
break; /* timed out, exit the command */
}
#endif
else {
char *endp;
i = simple_strtoul(console_buffer, &endp, 16);
nbytes = endp - console_buffer;
if (nbytes) {
#ifdef CONFIG_BOOT_RETRY_TIME
/* good enough to not time out
*/
reset_cmd_timeout();
#endif
if (size == 4)
if (incrflag)
addr += size;
}
}
} while (nbytes);
if (ptr)
unmap_sysmem(ptr);
mm_last_addr = addr;
mm_last_size = size;
return 0;
}
static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char * const *av;
return CMD_RET_USAGE;
av = argv + 1;
ac = argc - 1;
if (strcmp(*av, "-v") == 0) {
return hash_command("crc32", flags, cmdtp, flag, ac, av);
"memory modify (auto-incrementing address)",
"[.b, .w, .l] address"
#ifndef CONFIG_CRC32_VERIFY
"address count [addr]\n - compute CRC32 checksum [save at addr]"
#else /* CONFIG_CRC32_VERIFY */
U_BOOT_CMD(
"address count [addr]\n - compute CRC32 checksum [save at addr]\n"
"-v address count crc\n - verify crc of memory area"
);
#endif /* CONFIG_CRC32_VERIFY */
#ifdef CONFIG_CMD_MEMINFO
__weak void board_show_dram(ulong size)
{
puts("DRAM: ");
print_size(size, "\n");
}
static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
board_show_dram(gd->ram_size);
return 0;
}
#endif
"base off\n - set address offset for memory commands to 'off'"
#ifdef CONFIG_LOOPW
U_BOOT_CMD(
"[.b, .w, .l] address number_of_objects data_to_write"
);
#endif /* CONFIG_LOOPW */
#ifdef CONFIG_CMD_MEMTEST
"simple RAM read/write test",
"[start [end [pattern [iterations]]]]"
#endif /* CONFIG_CMD_MEMTEST */
#ifdef CONFIG_MX_CYCLIC
U_BOOT_CMD(
);
U_BOOT_CMD(
);
#endif /* CONFIG_MX_CYCLIC */
#ifdef CONFIG_CMD_MEMINFO
U_BOOT_CMD(
meminfo, 3, 1, do_mem_info,
"display memory information",
""
);
#endif