3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * Copied from FADS ROM, Dan Malek (dmalek@jlc.net)
32 #ifdef CONFIG_HAS_DATAFLASH
33 #include <dataflash.h>
37 #include <u-boot/md5.h>
41 #define PRINTF(fmt,args...) printf (fmt ,##args)
43 #define PRINTF(fmt,args...)
46 static int mod_mem(cmd_tbl_t *, int, int, int, char *[]);
48 /* Display values from last command.
49 * Memory modify remembered values are different from display memory.
51 uint dp_last_addr, dp_last_size;
52 uint dp_last_length = 0x40;
53 uint mm_last_addr, mm_last_size;
55 static ulong base_address = 0;
60 * md{.b, .w, .l} {addr} {len}
62 #define DISP_LINE_LEN 16
63 int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
66 #if defined(CONFIG_HAS_DATAFLASH)
67 ulong nbytes, linebytes;
72 /* We use the last specified parameters, unless new ones are
77 length = dp_last_length;
84 if ((flag & CMD_FLAG_REPEAT) == 0) {
85 /* New command specified. Check for a size specification.
86 * Defaults to long if no or incorrect specification.
88 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
91 /* Address is specified since argc > 1
93 addr = simple_strtoul(argv[1], NULL, 16);
96 /* If another parameter, it is the length to display.
97 * Length is the number of objects, not number of bytes.
100 length = simple_strtoul(argv[2], NULL, 16);
103 #if defined(CONFIG_HAS_DATAFLASH)
106 * We buffer all read data, so we can make sure data is read only
107 * once, and all accesses are with the specified bus width.
109 nbytes = length * size;
111 char linebuf[DISP_LINE_LEN];
113 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
115 rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
116 p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
117 print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
125 } while (nbytes > 0);
128 # if defined(CONFIG_BLACKFIN)
129 /* See if we're trying to display L1 inst */
130 if (addr_bfin_on_chip_mem(addr)) {
131 char linebuf[DISP_LINE_LEN];
132 ulong linebytes, nbytes = length * size;
134 linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
135 memcpy(linebuf, (void *)addr, linebytes);
136 print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size);
144 } while (nbytes > 0);
149 /* Print the lines. */
150 print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
156 dp_last_length = length;
161 int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
163 return mod_mem (cmdtp, 1, flag, argc, argv);
165 int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
167 return mod_mem (cmdtp, 0, flag, argc, argv);
170 int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
172 ulong addr, writeval, count;
175 if ((argc < 3) || (argc > 4)) {
180 /* Check for size specification.
182 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
185 /* Address is specified since argc > 1
187 addr = simple_strtoul(argv[1], NULL, 16);
188 addr += base_address;
190 /* Get the value to write.
192 writeval = simple_strtoul(argv[2], NULL, 16);
196 count = simple_strtoul(argv[3], NULL, 16);
201 while (count-- > 0) {
203 *((ulong *)addr) = (ulong )writeval;
205 *((ushort *)addr) = (ushort)writeval;
207 *((u_char *)addr) = (u_char)writeval;
213 #ifdef CONFIG_MX_CYCLIC
214 int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
224 count = simple_strtoul(argv[3], NULL, 10);
227 do_mem_md (NULL, 0, 3, argv);
229 /* delay for <count> ms... */
230 for (i=0; i<count; i++)
233 /* check for ctrl-c to abort... */
243 int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
253 count = simple_strtoul(argv[3], NULL, 10);
256 do_mem_mw (NULL, 0, 3, argv);
258 /* delay for <count> ms... */
259 for (i=0; i<count; i++)
262 /* check for ctrl-c to abort... */
271 #endif /* CONFIG_MX_CYCLIC */
273 int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
275 ulong addr1, addr2, count, ngood;
284 /* Check for size specification.
286 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
289 addr1 = simple_strtoul(argv[1], NULL, 16);
290 addr1 += base_address;
292 addr2 = simple_strtoul(argv[2], NULL, 16);
293 addr2 += base_address;
295 count = simple_strtoul(argv[3], NULL, 16);
297 #ifdef CONFIG_HAS_DATAFLASH
298 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
299 puts ("Comparison with DataFlash space not supported.\n\r");
304 #ifdef CONFIG_BLACKFIN
305 if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) {
306 puts ("Comparison with L1 instruction memory not supported.\n\r");
313 while (count-- > 0) {
315 ulong word1 = *(ulong *)addr1;
316 ulong word2 = *(ulong *)addr2;
317 if (word1 != word2) {
318 printf("word at 0x%08lx (0x%08lx) "
319 "!= word at 0x%08lx (0x%08lx)\n",
320 addr1, word1, addr2, word2);
325 else if (size == 2) {
326 ushort hword1 = *(ushort *)addr1;
327 ushort hword2 = *(ushort *)addr2;
328 if (hword1 != hword2) {
329 printf("halfword at 0x%08lx (0x%04x) "
330 "!= halfword at 0x%08lx (0x%04x)\n",
331 addr1, hword1, addr2, hword2);
337 u_char byte1 = *(u_char *)addr1;
338 u_char byte2 = *(u_char *)addr2;
339 if (byte1 != byte2) {
340 printf("byte at 0x%08lx (0x%02x) "
341 "!= byte at 0x%08lx (0x%02x)\n",
342 addr1, byte1, addr2, byte2);
352 printf("Total of %ld %s%s were the same\n",
353 ngood, size == 4 ? "word" : size == 2 ? "halfword" : "byte",
354 ngood == 1 ? "" : "s");
358 int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
360 ulong addr, dest, count;
368 /* Check for size specification.
370 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
373 addr = simple_strtoul(argv[1], NULL, 16);
374 addr += base_address;
376 dest = simple_strtoul(argv[2], NULL, 16);
377 dest += base_address;
379 count = simple_strtoul(argv[3], NULL, 16);
382 puts ("Zero length ???\n");
386 #ifndef CONFIG_SYS_NO_FLASH
387 /* check if we are copying to Flash */
388 if ( (addr2info(dest) != NULL)
389 #ifdef CONFIG_HAS_DATAFLASH
390 && (!addr_dataflash(dest))
395 puts ("Copy to Flash... ");
397 rc = flash_write ((char *)addr, dest, count*size);
407 #ifdef CONFIG_HAS_DATAFLASH
408 /* Check if we are copying from RAM or Flash to DataFlash */
409 if (addr_dataflash(dest) && !addr_dataflash(addr)){
412 puts ("Copy to DataFlash... ");
414 rc = write_dataflash (dest, addr, count*size);
417 dataflash_perror (rc);
424 /* Check if we are copying from DataFlash to RAM */
425 if (addr_dataflash(addr) && !addr_dataflash(dest)
426 #ifndef CONFIG_SYS_NO_FLASH
427 && (addr2info(dest) == NULL)
431 rc = read_dataflash(addr, count * size, (char *) dest);
433 dataflash_perror (rc);
439 if (addr_dataflash(addr) && addr_dataflash(dest)){
440 puts ("Unsupported combination of source/destination.\n\r");
445 #ifdef CONFIG_BLACKFIN
446 /* See if we're copying to/from L1 inst */
447 if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) {
448 memcpy((void *)dest, (void *)addr, count * size);
453 while (count-- > 0) {
455 *((ulong *)dest) = *((ulong *)addr);
457 *((ushort *)dest) = *((ushort *)addr);
459 *((u_char *)dest) = *((u_char *)addr);
466 int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
469 /* Set new base address.
471 base_address = simple_strtoul(argv[1], NULL, 16);
473 /* Print the current base address.
475 printf("Base Address: 0x%08lx\n", base_address);
479 int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
481 ulong addr, length, i, junk;
483 volatile uint *longp;
484 volatile ushort *shortp;
492 /* Check for a size spefication.
493 * Defaults to long if no or incorrect specification.
495 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
498 /* Address is always specified.
500 addr = simple_strtoul(argv[1], NULL, 16);
502 /* Length is the number of objects, not number of bytes.
504 length = simple_strtoul(argv[2], NULL, 16);
506 /* We want to optimize the loops to run as fast as possible.
507 * If we have only one object, just run infinite loops.
511 longp = (uint *)addr;
516 shortp = (ushort *)addr;
527 longp = (uint *)addr;
535 shortp = (ushort *)addr;
550 int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
552 ulong addr, length, i, data;
554 volatile uint *longp;
555 volatile ushort *shortp;
563 /* Check for a size spefication.
564 * Defaults to long if no or incorrect specification.
566 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
569 /* Address is always specified.
571 addr = simple_strtoul(argv[1], NULL, 16);
573 /* Length is the number of objects, not number of bytes.
575 length = simple_strtoul(argv[2], NULL, 16);
578 data = simple_strtoul(argv[3], NULL, 16);
580 /* We want to optimize the loops to run as fast as possible.
581 * If we have only one object, just run infinite loops.
585 longp = (uint *)addr;
590 shortp = (ushort *)addr;
601 longp = (uint *)addr;
609 shortp = (ushort *)addr;
622 #endif /* CONFIG_LOOPW */
625 * Perform a memory test. A more complete alternative test can be
626 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
627 * interrupted by ctrl-c or by a failure of one of the sub-tests.
629 int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
631 vu_long *addr, *start, *end;
638 #if defined(CONFIG_SYS_ALT_MEMTEST)
644 vu_long anti_pattern;
646 #if defined(CONFIG_SYS_MEMTEST_SCRATCH)
647 vu_long *dummy = (vu_long*)CONFIG_SYS_MEMTEST_SCRATCH;
649 vu_long *dummy = 0; /* yes, this is address 0x0, not NULL */
653 static const ulong bitpattern[] = {
654 0x00000001, /* single bit */
655 0x00000003, /* two adjacent bits */
656 0x00000007, /* three adjacent bits */
657 0x0000000F, /* four adjacent bits */
658 0x00000005, /* two non-adjacent bits */
659 0x00000015, /* three non-adjacent bits */
660 0x00000055, /* four non-adjacent bits */
661 0xaaaaaaaa, /* alternating 1/0 */
669 start = (ulong *)simple_strtoul(argv[1], NULL, 16);
671 start = (ulong *)CONFIG_SYS_MEMTEST_START;
674 end = (ulong *)simple_strtoul(argv[2], NULL, 16);
676 end = (ulong *)(CONFIG_SYS_MEMTEST_END);
679 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
684 iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16);
688 #if defined(CONFIG_SYS_ALT_MEMTEST)
689 printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
690 PRINTF("%s:%d: start 0x%p end 0x%p\n",
691 __FUNCTION__, __LINE__, start, end);
700 if (iteration_limit && iterations > iteration_limit) {
701 printf("Tested %d iteration(s) without errors.\n",
706 printf("Iteration: %6d\r", iterations);
711 * Data line test: write a pattern to the first
712 * location, write the 1's complement to a 'parking'
713 * address (changes the state of the data bus so a
714 * floating bus doen't give a false OK), and then
715 * read the value back. Note that we read it back
716 * into a variable because the next time we read it,
717 * it might be right (been there, tough to explain to
718 * the quality guys why it prints a failure when the
719 * "is" and "should be" are obviously the same in the
722 * Rather than exhaustively testing, we test some
723 * patterns by shifting '1' bits through a field of
724 * '0's and '0' bits through a field of '1's (i.e.
725 * pattern and ~pattern).
728 for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
730 for(; val != 0; val <<= 1) {
732 *dummy = ~val; /* clear the test data off of the bus */
734 if(readback != val) {
735 printf ("FAILURE (data line): "
736 "expected %08lx, actual %08lx\n",
742 if(readback != ~val) {
743 printf ("FAILURE (data line): "
744 "Is %08lx, should be %08lx\n",
751 * Based on code whose Original Author and Copyright
752 * information follows: Copyright (c) 1998 by Michael
753 * Barr. This software is placed into the public
754 * domain and may be used for any purpose. However,
755 * this notice must not be changed or removed and no
756 * warranty is either expressed or implied by its
757 * publication or distribution.
763 * Description: Test the address bus wiring in a
764 * memory region by performing a walking
765 * 1's test on the relevant bits of the
766 * address and checking for aliasing.
767 * This test will find single-bit
768 * address failures such as stuck -high,
769 * stuck-low, and shorted pins. The base
770 * address and size of the region are
771 * selected by the caller.
773 * Notes: For best results, the selected base
774 * address should have enough LSB 0's to
775 * guarantee single address bit changes.
776 * For example, to test a 64-Kbyte
777 * region, select a base address on a
778 * 64-Kbyte boundary. Also, select the
779 * region size as a power-of-two if at
782 * Returns: 0 if the test succeeds, 1 if the test fails.
784 len = ((ulong)end - (ulong)start)/sizeof(vu_long);
785 pattern = (vu_long) 0xaaaaaaaa;
786 anti_pattern = (vu_long) 0x55555555;
788 PRINTF("%s:%d: length = 0x%.8lx\n",
789 __FUNCTION__, __LINE__,
792 * Write the default pattern at each of the
793 * power-of-two offsets.
795 for (offset = 1; offset < len; offset <<= 1) {
796 start[offset] = pattern;
800 * Check for address bits stuck high.
803 start[test_offset] = anti_pattern;
805 for (offset = 1; offset < len; offset <<= 1) {
806 temp = start[offset];
807 if (temp != pattern) {
808 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
809 " expected 0x%.8lx, actual 0x%.8lx\n",
810 (ulong)&start[offset], pattern, temp);
814 start[test_offset] = pattern;
818 * Check for addr bits stuck low or shorted.
820 for (test_offset = 1; test_offset < len; test_offset <<= 1) {
821 start[test_offset] = anti_pattern;
823 for (offset = 1; offset < len; offset <<= 1) {
824 temp = start[offset];
825 if ((temp != pattern) && (offset != test_offset)) {
826 printf ("\nFAILURE: Address bit stuck low or shorted @"
827 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
828 (ulong)&start[offset], pattern, temp);
832 start[test_offset] = pattern;
836 * Description: Test the integrity of a physical
837 * memory device by performing an
838 * increment/decrement test over the
839 * entire region. In the process every
840 * storage bit in the device is tested
841 * as a zero and a one. The base address
842 * and the size of the region are
843 * selected by the caller.
845 * Returns: 0 if the test succeeds, 1 if the test fails.
847 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
850 * Fill memory with a known pattern.
852 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
854 start[offset] = pattern;
858 * Check each location and invert it for the second pass.
860 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
862 temp = start[offset];
863 if (temp != pattern) {
864 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
865 " expected 0x%.8lx, actual 0x%.8lx)\n",
866 (ulong)&start[offset], pattern, temp);
870 anti_pattern = ~pattern;
871 start[offset] = anti_pattern;
875 * Check each location for the inverted pattern and zero it.
877 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
879 anti_pattern = ~pattern;
880 temp = start[offset];
881 if (temp != anti_pattern) {
882 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
883 " expected 0x%.8lx, actual 0x%.8lx)\n",
884 (ulong)&start[offset], anti_pattern, temp);
891 #else /* The original, quickie test */
899 if (iteration_limit && iterations > iteration_limit) {
900 printf("Tested %d iteration(s) without errors.\n",
906 printf ("\rPattern %08lX Writing..."
908 "\b\b\b\b\b\b\b\b\b\b",
911 for (addr=start,val=pattern; addr<end; addr++) {
919 for (addr=start,val=pattern; addr<end; addr++) {
922 if (readback != val) {
923 printf ("\nMem error @ 0x%08X: "
924 "found %08lX, expected %08lX\n",
925 (uint)addr, readback, val);
932 * Flip the pattern each time to make lots of zeros and
933 * then, the next time, lots of ones. We decrement
934 * the "negative" patterns and increment the "positive"
935 * patterns to preserve this feature.
937 if(pattern & 0x80000000) {
938 pattern = -pattern; /* complement & increment */
953 * mm{.b, .w, .l} {addr}
954 * nm{.b, .w, .l} {addr}
957 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
961 extern char console_buffer[];
968 #ifdef CONFIG_BOOT_RETRY_TIME
969 reset_cmd_timeout(); /* got a good command to get here */
971 /* We use the last specified parameters, unless new ones are
977 if ((flag & CMD_FLAG_REPEAT) == 0) {
978 /* New command specified. Check for a size specification.
979 * Defaults to long if no or incorrect specification.
981 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
984 /* Address is specified since argc > 1
986 addr = simple_strtoul(argv[1], NULL, 16);
987 addr += base_address;
990 #ifdef CONFIG_HAS_DATAFLASH
991 if (addr_dataflash(addr)){
992 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
997 #ifdef CONFIG_BLACKFIN
998 if (addr_bfin_on_chip_mem(addr)) {
999 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
1004 /* Print the address, followed by value. Then accept input for
1005 * the next value. A non-converted value exits.
1008 printf("%08lx:", addr);
1010 printf(" %08x", *((uint *)addr));
1012 printf(" %04x", *((ushort *)addr));
1014 printf(" %02x", *((u_char *)addr));
1016 nbytes = readline (" ? ");
1017 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1018 /* <CR> pressed as only input, don't modify current
1019 * location and move to next. "-" pressed will go back.
1022 addr += nbytes ? -size : size;
1024 #ifdef CONFIG_BOOT_RETRY_TIME
1025 reset_cmd_timeout(); /* good enough to not time out */
1028 #ifdef CONFIG_BOOT_RETRY_TIME
1029 else if (nbytes == -2) {
1030 break; /* timed out, exit the command */
1035 i = simple_strtoul(console_buffer, &endp, 16);
1036 nbytes = endp - console_buffer;
1038 #ifdef CONFIG_BOOT_RETRY_TIME
1039 /* good enough to not time out
1041 reset_cmd_timeout();
1044 *((uint *)addr) = i;
1046 *((ushort *)addr) = i;
1048 *((u_char *)addr) = i;
1055 mm_last_addr = addr;
1056 mm_last_size = size;
1060 #ifndef CONFIG_CRC32_VERIFY
1062 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1073 addr = simple_strtoul (argv[1], NULL, 16);
1074 addr += base_address;
1076 length = simple_strtoul (argv[2], NULL, 16);
1078 crc = crc32 (0, (const uchar *) addr, length);
1080 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1081 addr, addr + length - 1, crc);
1084 ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
1091 #else /* CONFIG_CRC32_VERIFY */
1093 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1111 if (strcmp(*av, "-v") == 0) {
1120 addr = simple_strtoul(*av++, NULL, 16);
1121 addr += base_address;
1122 length = simple_strtoul(*av++, NULL, 16);
1124 crc = crc32(0, (const uchar *) addr, length);
1127 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1128 addr, addr + length - 1, crc);
1130 ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
1134 vcrc = simple_strtoul(*av++, NULL, 16);
1136 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1137 addr, addr + length - 1, crc, vcrc);
1145 #endif /* CONFIG_CRC32_VERIFY */
1147 #ifdef CONFIG_CMD_MD5SUM
1148 int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1150 unsigned long addr, len;
1159 addr = simple_strtoul(argv[1], NULL, 16);
1160 len = simple_strtoul(argv[2], NULL, 16);
1162 md5((unsigned char *) addr, len, output);
1163 printf("md5 for %08lx ... %08lx ==> ", addr, addr + len - 1);
1164 for (i = 0; i < 16; i++)
1165 printf("%02x", output[i]);
1172 #ifdef CONFIG_CMD_SHA1
1173 int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1175 unsigned long addr, len;
1184 addr = simple_strtoul(argv[1], NULL, 16);
1185 len = simple_strtoul(argv[2], NULL, 16);
1187 sha1_csum((unsigned char *) addr, len, output);
1188 printf("SHA1 for %08lx ... %08lx ==> ", addr, addr + len - 1);
1189 for (i = 0; i < 20; i++)
1190 printf("%02x", output[i]);
1197 #ifdef CONFIG_CMD_UNZIP
1198 int gunzip (void *, int, unsigned char *, unsigned long *);
1200 int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1202 unsigned long src, dst;
1203 unsigned long src_len = ~0UL, dst_len = ~0UL;
1207 dst_len = simple_strtoul(argv[3], NULL, 16);
1210 src = simple_strtoul(argv[1], NULL, 16);
1211 dst = simple_strtoul(argv[2], NULL, 16);
1218 return !!gunzip((void *) dst, dst_len, (void *) src, &src_len);
1220 #endif /* CONFIG_CMD_UNZIP */
1223 /**************************************************/
1225 md, 3, 1, do_mem_md,
1227 "[.b, .w, .l] address [# of objects]"
1232 mm, 2, 1, do_mem_mm,
1233 "memory modify (auto-incrementing address)",
1234 "[.b, .w, .l] address"
1239 nm, 2, 1, do_mem_nm,
1240 "memory modify (constant address)",
1241 "[.b, .w, .l] address"
1245 mw, 4, 1, do_mem_mw,
1246 "memory write (fill)",
1247 "[.b, .w, .l] address value [count]"
1251 cp, 4, 1, do_mem_cp,
1253 "[.b, .w, .l] source target count"
1257 cmp, 4, 1, do_mem_cmp,
1259 "[.b, .w, .l] addr1 addr2 count"
1262 #ifndef CONFIG_CRC32_VERIFY
1265 crc32, 4, 1, do_mem_crc,
1266 "checksum calculation",
1267 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1270 #else /* CONFIG_CRC32_VERIFY */
1273 crc32, 5, 1, do_mem_crc,
1274 "checksum calculation",
1275 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1276 "-v address count crc\n - verify crc of memory area"
1279 #endif /* CONFIG_CRC32_VERIFY */
1282 base, 2, 1, do_mem_base,
1283 "print or set address offset",
1284 "\n - print address offset for memory commands\n"
1285 "base off\n - set address offset for memory commands to 'off'"
1289 loop, 3, 1, do_mem_loop,
1290 "infinite loop on address range",
1291 "[.b, .w, .l] address number_of_objects"
1296 loopw, 4, 1, do_mem_loopw,
1297 "infinite write loop on address range",
1298 "[.b, .w, .l] address number_of_objects data_to_write"
1300 #endif /* CONFIG_LOOPW */
1303 mtest, 5, 1, do_mem_mtest,
1304 "simple RAM read/write test",
1305 "[start [end [pattern [iterations]]]]"
1308 #ifdef CONFIG_MX_CYCLIC
1310 mdc, 4, 1, do_mem_mdc,
1311 "memory display cyclic",
1312 "[.b, .w, .l] address count delay(ms)"
1316 mwc, 4, 1, do_mem_mwc,
1317 "memory write cyclic",
1318 "[.b, .w, .l] address value delay(ms)"
1320 #endif /* CONFIG_MX_CYCLIC */
1322 #ifdef CONFIG_CMD_MD5SUM
1324 md5sum, 3, 1, do_md5sum,
1325 "compute MD5 message digest",
1330 #ifdef CONFIG_CMD_SHA1SUM
1332 sha1sum, 3, 1, do_sha1sum,
1333 "compute SHA1 message digest",
1336 #endif /* CONFIG_CMD_SHA1 */
1338 #ifdef CONFIG_CMD_UNZIP
1340 unzip, 4, 1, do_unzip,
1341 "unzip a memory region",
1342 "srcaddr dstaddr [dstsize]"
1344 #endif /* CONFIG_CMD_UNZIP */