Newer
Older
*/
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
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
/* Print the address, followed by value. Then accept input for
* the next value. A non-converted value exits.
*/
do {
printf("%08lx:", addr);
if (size == 4)
printf(" %08x", *((uint *)addr));
else if (size == 2)
printf(" %04x", *((ushort *)addr));
else
printf(" %02x", *((u_char *)addr));
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)
*((uint *)addr) = i;
else if (size == 2)
*((ushort *)addr) = i;
else
*((u_char *)addr) = i;
if (incrflag)
addr += size;
}
}
} while (nbytes);
mm_last_addr = addr;
mm_last_size = size;
return 0;
}
#ifndef CONFIG_CRC32_VERIFY
int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ulong addr, length;
ulong crc;
ulong *ptr;
if (argc < 3)
return cmd_usage(cmdtp);
addr = simple_strtoul (argv[1], NULL, 16);
length = simple_strtoul (argv[2], NULL, 16);
crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32);
addr, addr + length - 1, crc);
if (argc > 3) {
ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
*ptr = crc;
}
#else /* CONFIG_CRC32_VERIFY */
int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
ulong addr, length;
ulong crc;
ulong *ptr;
char * const *av;
usage:
return cmd_usage(cmdtp);
}
av = argv + 1;
ac = argc - 1;
if (strcmp(*av, "-v") == 0) {
verify = 1;
av++;
ac--;
if (ac < 3)
goto usage;
} else
verify = 0;
addr = simple_strtoul(*av++, NULL, 16);
addr += base_address;
length = simple_strtoul(*av++, NULL, 16);
crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32);
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
if (!verify) {
printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
addr, addr + length - 1, crc);
if (ac > 2) {
ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
*ptr = crc;
}
} else {
vcrc = simple_strtoul(*av++, NULL, 16);
if (vcrc != crc) {
printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
addr, addr + length - 1, crc, vcrc);
return 1;
}
}
return 0;
}
#endif /* CONFIG_CRC32_VERIFY */
"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 */
"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 */
"simple RAM read/write test",
"[start [end [pattern [iterations]]]]"
#ifdef CONFIG_MX_CYCLIC
U_BOOT_CMD(
);
U_BOOT_CMD(
);
#endif /* CONFIG_MX_CYCLIC */