#endif
#include <watchdog.h>
-#include <u-boot/md5.h>
-#include <sha1.h>
-
#ifdef CMD_MEM_DEBUG
#define PRINTF(fmt,args...) printf (fmt ,##args)
#else
length = dp_last_length;
if (argc < 2)
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command specified. Check for a size specification.
int size;
if ((argc < 3) || (argc > 4))
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
/* Check for size specification.
*/
ulong count;
if (argc < 4)
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
count = simple_strtoul(argv[3], NULL, 10);
ulong count;
if (argc < 4)
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
count = simple_strtoul(argv[3], NULL, 10);
int rcode = 0;
if (argc != 4)
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
/* Check for size specification.
*/
int size;
if (argc != 4)
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
/* Check for size specification.
*/
int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- ulong addr, length, i, junk;
+ ulong addr, length, i;
int size;
volatile uint *longp;
volatile ushort *shortp;
volatile u_char *cp;
if (argc < 3)
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
/* Check for a size spefication.
* Defaults to long if no or incorrect specification.
longp = (uint *)addr;
i = length;
while (i-- > 0)
- junk = *longp++;
+ *longp++;
}
}
if (size == 2) {
shortp = (ushort *)addr;
i = length;
while (i-- > 0)
- junk = *shortp++;
+ *shortp++;
}
}
for (;;) {
cp = (u_char *)addr;
i = length;
while (i-- > 0)
- junk = *cp++;
+ *cp++;
}
}
volatile u_char *cp;
if (argc < 4)
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
/* Check for a size spefication.
* Defaults to long if no or incorrect specification.
if (readback != val) {
printf ("\nMem error @ 0x%08X: "
"found %08lX, expected %08lX\n",
- (uint)addr, readback, val);
+ (uint)(uintptr_t)addr, readback, val);
errs++;
if (ctrlc()) {
putc ('\n');
{
ulong addr, i;
int nbytes, size;
- extern char console_buffer[];
if (argc != 2)
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout(); /* got a good command to get here */
return 0;
}
+#ifdef CONFIG_CMD_CRC32
+
#ifndef CONFIG_CRC32_VERIFY
int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ulong *ptr;
if (argc < 3)
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
addr = simple_strtoul (argv[1], NULL, 16);
addr += base_address;
length = simple_strtoul (argv[2], NULL, 16);
- crc = crc32 (0, (const uchar *) addr, length);
+ crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32);
printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
addr, addr + length - 1, crc);
if (argc < 3) {
usage:
- return cmd_usage(cmdtp);
+ return CMD_RET_USAGE;
}
av = argv + 1;
addr += base_address;
length = simple_strtoul(*av++, NULL, 16);
- crc = crc32(0, (const uchar *) addr, length);
+ crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32);
if (!verify) {
printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
}
#endif /* CONFIG_CRC32_VERIFY */
-#ifdef CONFIG_CMD_MD5SUM
-int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- unsigned long addr, len;
- unsigned int i;
- u8 output[16];
-
- if (argc < 3)
- return cmd_usage(cmdtp);
-
- addr = simple_strtoul(argv[1], NULL, 16);
- len = simple_strtoul(argv[2], NULL, 16);
-
- md5((unsigned char *) addr, len, output);
- printf("md5 for %08lx ... %08lx ==> ", addr, addr + len - 1);
- for (i = 0; i < 16; i++)
- printf("%02x", output[i]);
- printf("\n");
-
- return 0;
-}
-#endif
-
-#ifdef CONFIG_CMD_SHA1
-int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- unsigned long addr, len;
- unsigned int i;
- u8 output[20];
-
- if (argc < 3)
- return cmd_usage(cmdtp);
-
- addr = simple_strtoul(argv[1], NULL, 16);
- len = simple_strtoul(argv[2], NULL, 16);
-
- sha1_csum((unsigned char *) addr, len, output);
- printf("SHA1 for %08lx ... %08lx ==> ", addr, addr + len - 1);
- for (i = 0; i < 20; i++)
- printf("%02x", output[i]);
- printf("\n");
-
- return 0;
-}
#endif
-#ifdef CONFIG_CMD_UNZIP
-int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- unsigned long src, dst;
- unsigned long src_len = ~0UL, dst_len = ~0UL;
-
- switch (argc) {
- case 4:
- dst_len = simple_strtoul(argv[3], NULL, 16);
- /* fall through */
- case 3:
- src = simple_strtoul(argv[1], NULL, 16);
- dst = simple_strtoul(argv[2], NULL, 16);
- break;
- default:
- return cmd_usage(cmdtp);
- }
-
- return !!gunzip((void *) dst, dst_len, (void *) src, &src_len);
-}
-#endif /* CONFIG_CMD_UNZIP */
-
-
/**************************************************/
U_BOOT_CMD(
md, 3, 1, do_mem_md,
"[.b, .w, .l] addr1 addr2 count"
);
+#ifdef CONFIG_CMD_CRC32
+
#ifndef CONFIG_CRC32_VERIFY
U_BOOT_CMD(
#endif /* CONFIG_CRC32_VERIFY */
+#endif
+
U_BOOT_CMD(
base, 2, 1, do_mem_base,
"print or set address offset",
"[.b, .w, .l] address value delay(ms)"
);
#endif /* CONFIG_MX_CYCLIC */
-
-#ifdef CONFIG_CMD_MD5SUM
-U_BOOT_CMD(
- md5sum, 3, 1, do_md5sum,
- "compute MD5 message digest",
- "address count"
-);
-#endif
-
-#ifdef CONFIG_CMD_SHA1SUM
-U_BOOT_CMD(
- sha1sum, 3, 1, do_sha1sum,
- "compute SHA1 message digest",
- "address count"
-);
-#endif /* CONFIG_CMD_SHA1 */
-
-#ifdef CONFIG_CMD_UNZIP
-U_BOOT_CMD(
- unzip, 4, 1, do_unzip,
- "unzip a memory region",
- "srcaddr dstaddr [dstsize]"
-);
-#endif /* CONFIG_CMD_UNZIP */