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 #if defined(CONFIG_CMD_MMC)
35 #ifdef CONFIG_HAS_DATAFLASH
36 #include <dataflash.h>
40 #if defined(CONFIG_CMD_MEMORY)
43 #define PRINTF(fmt,args...) printf (fmt ,##args)
45 #define PRINTF(fmt,args...)
48 static int mod_mem(cmd_tbl_t *, int, int, int, char *[]);
50 /* Display values from last command.
51 * Memory modify remembered values are different from display memory.
53 uint dp_last_addr, dp_last_size;
54 uint dp_last_length = 0x40;
55 uint mm_last_addr, mm_last_size;
57 static ulong base_address = 0;
62 * md{.b, .w, .l} {addr} {len}
64 #define DISP_LINE_LEN 16
65 int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
68 #if defined(CONFIG_HAS_DATAFLASH)
69 ulong nbytes, linebytes;
74 /* We use the last specified parameters, unless new ones are
79 length = dp_last_length;
82 printf ("Usage:\n%s\n", cmdtp->usage);
86 if ((flag & CMD_FLAG_REPEAT) == 0) {
87 /* New command specified. Check for a size specification.
88 * Defaults to long if no or incorrect specification.
90 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
93 /* Address is specified since argc > 1
95 addr = simple_strtoul(argv[1], NULL, 16);
98 /* If another parameter, it is the length to display.
99 * Length is the number of objects, not number of bytes.
102 length = simple_strtoul(argv[2], NULL, 16);
105 #if defined(CONFIG_HAS_DATAFLASH)
108 * We buffer all read data, so we can make sure data is read only
109 * once, and all accesses are with the specified bus width.
111 nbytes = length * size;
113 char linebuf[DISP_LINE_LEN];
115 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
117 rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
118 p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
119 print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
127 } while (nbytes > 0);
130 # if defined(CONFIG_BLACKFIN)
131 /* See if we're trying to display L1 inst */
132 if (addr_bfin_on_chip_mem(addr)) {
133 char linebuf[DISP_LINE_LEN];
134 ulong linebytes, nbytes = length * size;
136 linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
137 memcpy(linebuf, (void *)addr, linebytes);
138 print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size);
146 } while (nbytes > 0);
151 /* Print the lines. */
152 print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
158 dp_last_length = length;
163 int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
165 return mod_mem (cmdtp, 1, flag, argc, argv);
167 int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
169 return mod_mem (cmdtp, 0, flag, argc, argv);
172 int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
174 ulong addr, writeval, count;
177 if ((argc < 3) || (argc > 4)) {
178 printf ("Usage:\n%s\n", cmdtp->usage);
182 /* Check for size specification.
184 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
187 /* Address is specified since argc > 1
189 addr = simple_strtoul(argv[1], NULL, 16);
190 addr += base_address;
192 /* Get the value to write.
194 writeval = simple_strtoul(argv[2], NULL, 16);
198 count = simple_strtoul(argv[3], NULL, 16);
203 while (count-- > 0) {
205 *((ulong *)addr) = (ulong )writeval;
207 *((ushort *)addr) = (ushort)writeval;
209 *((u_char *)addr) = (u_char)writeval;
215 #ifdef CONFIG_MX_CYCLIC
216 int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
222 printf ("Usage:\n%s\n", cmdtp->usage);
226 count = simple_strtoul(argv[3], NULL, 10);
229 do_mem_md (NULL, 0, 3, argv);
231 /* delay for <count> ms... */
232 for (i=0; i<count; i++)
235 /* check for ctrl-c to abort... */
245 int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
251 printf ("Usage:\n%s\n", cmdtp->usage);
255 count = simple_strtoul(argv[3], NULL, 10);
258 do_mem_mw (NULL, 0, 3, argv);
260 /* delay for <count> ms... */
261 for (i=0; i<count; i++)
264 /* check for ctrl-c to abort... */
273 #endif /* CONFIG_MX_CYCLIC */
275 int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
277 ulong addr1, addr2, count, ngood;
282 printf ("Usage:\n%s\n", cmdtp->usage);
286 /* Check for size specification.
288 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
291 addr1 = simple_strtoul(argv[1], NULL, 16);
292 addr1 += base_address;
294 addr2 = simple_strtoul(argv[2], NULL, 16);
295 addr2 += base_address;
297 count = simple_strtoul(argv[3], NULL, 16);
299 #ifdef CONFIG_HAS_DATAFLASH
300 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
301 puts ("Comparison with DataFlash space not supported.\n\r");
306 #ifdef CONFIG_BLACKFIN
307 if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) {
308 puts ("Comparison with L1 instruction memory not supported.\n\r");
315 while (count-- > 0) {
317 ulong word1 = *(ulong *)addr1;
318 ulong word2 = *(ulong *)addr2;
319 if (word1 != word2) {
320 printf("word at 0x%08lx (0x%08lx) "
321 "!= word at 0x%08lx (0x%08lx)\n",
322 addr1, word1, addr2, word2);
327 else if (size == 2) {
328 ushort hword1 = *(ushort *)addr1;
329 ushort hword2 = *(ushort *)addr2;
330 if (hword1 != hword2) {
331 printf("halfword at 0x%08lx (0x%04x) "
332 "!= halfword at 0x%08lx (0x%04x)\n",
333 addr1, hword1, addr2, hword2);
339 u_char byte1 = *(u_char *)addr1;
340 u_char byte2 = *(u_char *)addr2;
341 if (byte1 != byte2) {
342 printf("byte at 0x%08lx (0x%02x) "
343 "!= byte at 0x%08lx (0x%02x)\n",
344 addr1, byte1, addr2, byte2);
354 printf("Total of %ld %s%s were the same\n",
355 ngood, size == 4 ? "word" : size == 2 ? "halfword" : "byte",
356 ngood == 1 ? "" : "s");
360 int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
362 ulong addr, dest, count;
366 printf ("Usage:\n%s\n", cmdtp->usage);
370 /* Check for size specification.
372 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
375 addr = simple_strtoul(argv[1], NULL, 16);
376 addr += base_address;
378 dest = simple_strtoul(argv[2], NULL, 16);
379 dest += base_address;
381 count = simple_strtoul(argv[3], NULL, 16);
384 puts ("Zero length ???\n");
389 /* check if we are copying to Flash */
390 if ( (addr2info(dest) != NULL)
391 #ifdef CONFIG_HAS_DATAFLASH
392 && (!addr_dataflash(dest))
397 puts ("Copy to Flash... ");
399 rc = flash_write ((char *)addr, dest, count*size);
409 #if defined(CONFIG_CMD_MMC)
410 if (mmc2info(dest)) {
413 puts ("Copy to MMC... ");
414 switch (rc = mmc_write ((uchar *)addr, dest, count*size)) {
422 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
429 if (mmc2info(addr)) {
432 puts ("Copy from MMC... ");
433 switch (rc = mmc_read (addr, (uchar *)dest, count*size)) {
441 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
449 #ifdef CONFIG_HAS_DATAFLASH
450 /* Check if we are copying from RAM or Flash to DataFlash */
451 if (addr_dataflash(dest) && !addr_dataflash(addr)){
454 puts ("Copy to DataFlash... ");
456 rc = write_dataflash (dest, addr, count*size);
459 dataflash_perror (rc);
466 /* Check if we are copying from DataFlash to RAM */
467 if (addr_dataflash(addr) && !addr_dataflash(dest)
469 && (addr2info(dest) == NULL)
473 rc = read_dataflash(addr, count * size, (char *) dest);
475 dataflash_perror (rc);
481 if (addr_dataflash(addr) && addr_dataflash(dest)){
482 puts ("Unsupported combination of source/destination.\n\r");
487 #ifdef CONFIG_BLACKFIN
488 /* See if we're copying to/from L1 inst */
489 if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) {
490 memcpy((void *)dest, (void *)addr, count * size);
495 while (count-- > 0) {
497 *((ulong *)dest) = *((ulong *)addr);
499 *((ushort *)dest) = *((ushort *)addr);
501 *((u_char *)dest) = *((u_char *)addr);
508 int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
511 /* Set new base address.
513 base_address = simple_strtoul(argv[1], NULL, 16);
515 /* Print the current base address.
517 printf("Base Address: 0x%08lx\n", base_address);
521 int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
523 ulong addr, length, i, junk;
525 volatile uint *longp;
526 volatile ushort *shortp;
530 printf ("Usage:\n%s\n", cmdtp->usage);
534 /* Check for a size spefication.
535 * Defaults to long if no or incorrect specification.
537 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
540 /* Address is always specified.
542 addr = simple_strtoul(argv[1], NULL, 16);
544 /* Length is the number of objects, not number of bytes.
546 length = simple_strtoul(argv[2], NULL, 16);
548 /* We want to optimize the loops to run as fast as possible.
549 * If we have only one object, just run infinite loops.
553 longp = (uint *)addr;
558 shortp = (ushort *)addr;
569 longp = (uint *)addr;
577 shortp = (ushort *)addr;
592 int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
594 ulong addr, length, i, data;
596 volatile uint *longp;
597 volatile ushort *shortp;
601 printf ("Usage:\n%s\n", cmdtp->usage);
605 /* Check for a size spefication.
606 * Defaults to long if no or incorrect specification.
608 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
611 /* Address is always specified.
613 addr = simple_strtoul(argv[1], NULL, 16);
615 /* Length is the number of objects, not number of bytes.
617 length = simple_strtoul(argv[2], NULL, 16);
620 data = simple_strtoul(argv[3], NULL, 16);
622 /* We want to optimize the loops to run as fast as possible.
623 * If we have only one object, just run infinite loops.
627 longp = (uint *)addr;
632 shortp = (ushort *)addr;
643 longp = (uint *)addr;
651 shortp = (ushort *)addr;
664 #endif /* CONFIG_LOOPW */
667 * Perform a memory test. A more complete alternative test can be
668 * configured using CFG_ALT_MEMTEST. The complete test loops until
669 * interrupted by ctrl-c or by a failure of one of the sub-tests.
671 int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
673 vu_long *addr, *start, *end;
678 #if defined(CFG_ALT_MEMTEST)
684 vu_long anti_pattern;
686 #if defined(CFG_MEMTEST_SCRATCH)
687 vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
689 vu_long *dummy = 0; /* yes, this is address 0x0, not NULL */
694 static const ulong bitpattern[] = {
695 0x00000001, /* single bit */
696 0x00000003, /* two adjacent bits */
697 0x00000007, /* three adjacent bits */
698 0x0000000F, /* four adjacent bits */
699 0x00000005, /* two non-adjacent bits */
700 0x00000015, /* three non-adjacent bits */
701 0x00000055, /* four non-adjacent bits */
702 0xaaaaaaaa, /* alternating 1/0 */
710 start = (ulong *)simple_strtoul(argv[1], NULL, 16);
712 start = (ulong *)CFG_MEMTEST_START;
716 end = (ulong *)simple_strtoul(argv[2], NULL, 16);
718 end = (ulong *)(CFG_MEMTEST_END);
722 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
727 #if defined(CFG_ALT_MEMTEST)
728 printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
729 PRINTF("%s:%d: start 0x%p end 0x%p\n",
730 __FUNCTION__, __LINE__, start, end);
738 printf("Iteration: %6d\r", iterations);
739 PRINTF("Iteration: %6d\n", iterations);
743 * Data line test: write a pattern to the first
744 * location, write the 1's complement to a 'parking'
745 * address (changes the state of the data bus so a
746 * floating bus doen't give a false OK), and then
747 * read the value back. Note that we read it back
748 * into a variable because the next time we read it,
749 * it might be right (been there, tough to explain to
750 * the quality guys why it prints a failure when the
751 * "is" and "should be" are obviously the same in the
754 * Rather than exhaustively testing, we test some
755 * patterns by shifting '1' bits through a field of
756 * '0's and '0' bits through a field of '1's (i.e.
757 * pattern and ~pattern).
760 for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
762 for(; val != 0; val <<= 1) {
764 *dummy = ~val; /* clear the test data off of the bus */
766 if(readback != val) {
767 printf ("FAILURE (data line): "
768 "expected %08lx, actual %08lx\n",
774 if(readback != ~val) {
775 printf ("FAILURE (data line): "
776 "Is %08lx, should be %08lx\n",
783 * Based on code whose Original Author and Copyright
784 * information follows: Copyright (c) 1998 by Michael
785 * Barr. This software is placed into the public
786 * domain and may be used for any purpose. However,
787 * this notice must not be changed or removed and no
788 * warranty is either expressed or implied by its
789 * publication or distribution.
795 * Description: Test the address bus wiring in a
796 * memory region by performing a walking
797 * 1's test on the relevant bits of the
798 * address and checking for aliasing.
799 * This test will find single-bit
800 * address failures such as stuck -high,
801 * stuck-low, and shorted pins. The base
802 * address and size of the region are
803 * selected by the caller.
805 * Notes: For best results, the selected base
806 * address should have enough LSB 0's to
807 * guarantee single address bit changes.
808 * For example, to test a 64-Kbyte
809 * region, select a base address on a
810 * 64-Kbyte boundary. Also, select the
811 * region size as a power-of-two if at
814 * Returns: 0 if the test succeeds, 1 if the test fails.
816 len = ((ulong)end - (ulong)start)/sizeof(vu_long);
817 pattern = (vu_long) 0xaaaaaaaa;
818 anti_pattern = (vu_long) 0x55555555;
820 PRINTF("%s:%d: length = 0x%.8lx\n",
821 __FUNCTION__, __LINE__,
824 * Write the default pattern at each of the
825 * power-of-two offsets.
827 for (offset = 1; offset < len; offset <<= 1) {
828 start[offset] = pattern;
832 * Check for address bits stuck high.
835 start[test_offset] = anti_pattern;
837 for (offset = 1; offset < len; offset <<= 1) {
838 temp = start[offset];
839 if (temp != pattern) {
840 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
841 " expected 0x%.8lx, actual 0x%.8lx\n",
842 (ulong)&start[offset], pattern, temp);
846 start[test_offset] = pattern;
850 * Check for addr bits stuck low or shorted.
852 for (test_offset = 1; test_offset < len; test_offset <<= 1) {
853 start[test_offset] = anti_pattern;
855 for (offset = 1; offset < len; offset <<= 1) {
856 temp = start[offset];
857 if ((temp != pattern) && (offset != test_offset)) {
858 printf ("\nFAILURE: Address bit stuck low or shorted @"
859 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
860 (ulong)&start[offset], pattern, temp);
864 start[test_offset] = pattern;
868 * Description: Test the integrity of a physical
869 * memory device by performing an
870 * increment/decrement test over the
871 * entire region. In the process every
872 * storage bit in the device is tested
873 * as a zero and a one. The base address
874 * and the size of the region are
875 * selected by the caller.
877 * Returns: 0 if the test succeeds, 1 if the test fails.
879 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
882 * Fill memory with a known pattern.
884 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
886 start[offset] = pattern;
890 * Check each location and invert it for the second pass.
892 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
894 temp = start[offset];
895 if (temp != pattern) {
896 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
897 " expected 0x%.8lx, actual 0x%.8lx)\n",
898 (ulong)&start[offset], pattern, temp);
902 anti_pattern = ~pattern;
903 start[offset] = anti_pattern;
907 * Check each location for the inverted pattern and zero it.
909 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
911 anti_pattern = ~pattern;
912 temp = start[offset];
913 if (temp != anti_pattern) {
914 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
915 " expected 0x%.8lx, actual 0x%.8lx)\n",
916 (ulong)&start[offset], anti_pattern, temp);
923 #else /* The original, quickie test */
931 printf ("\rPattern %08lX Writing..."
933 "\b\b\b\b\b\b\b\b\b\b",
936 for (addr=start,val=pattern; addr<end; addr++) {
944 for (addr=start,val=pattern; addr<end; addr++) {
947 if (readback != val) {
948 printf ("\nMem error @ 0x%08X: "
949 "found %08lX, expected %08lX\n",
950 (uint)addr, readback, val);
957 * Flip the pattern each time to make lots of zeros and
958 * then, the next time, lots of ones. We decrement
959 * the "negative" patterns and increment the "positive"
960 * patterns to preserve this feature.
962 if(pattern & 0x80000000) {
963 pattern = -pattern; /* complement & increment */
978 * mm{.b, .w, .l} {addr}
979 * nm{.b, .w, .l} {addr}
982 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
986 extern char console_buffer[];
989 printf ("Usage:\n%s\n", cmdtp->usage);
993 #ifdef CONFIG_BOOT_RETRY_TIME
994 reset_cmd_timeout(); /* got a good command to get here */
996 /* We use the last specified parameters, unless new ones are
1000 size = mm_last_size;
1002 if ((flag & CMD_FLAG_REPEAT) == 0) {
1003 /* New command specified. Check for a size specification.
1004 * Defaults to long if no or incorrect specification.
1006 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1009 /* Address is specified since argc > 1
1011 addr = simple_strtoul(argv[1], NULL, 16);
1012 addr += base_address;
1015 #ifdef CONFIG_HAS_DATAFLASH
1016 if (addr_dataflash(addr)){
1017 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
1022 #ifdef CONFIG_BLACKFIN
1023 if (addr_bfin_on_chip_mem(addr)) {
1024 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
1029 /* Print the address, followed by value. Then accept input for
1030 * the next value. A non-converted value exits.
1033 printf("%08lx:", addr);
1035 printf(" %08x", *((uint *)addr));
1037 printf(" %04x", *((ushort *)addr));
1039 printf(" %02x", *((u_char *)addr));
1041 nbytes = readline (" ? ");
1042 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1043 /* <CR> pressed as only input, don't modify current
1044 * location and move to next. "-" pressed will go back.
1047 addr += nbytes ? -size : size;
1049 #ifdef CONFIG_BOOT_RETRY_TIME
1050 reset_cmd_timeout(); /* good enough to not time out */
1053 #ifdef CONFIG_BOOT_RETRY_TIME
1054 else if (nbytes == -2) {
1055 break; /* timed out, exit the command */
1060 i = simple_strtoul(console_buffer, &endp, 16);
1061 nbytes = endp - console_buffer;
1063 #ifdef CONFIG_BOOT_RETRY_TIME
1064 /* good enough to not time out
1066 reset_cmd_timeout();
1069 *((uint *)addr) = i;
1071 *((ushort *)addr) = i;
1073 *((u_char *)addr) = i;
1080 mm_last_addr = addr;
1081 mm_last_size = size;
1085 #ifndef CONFIG_CRC32_VERIFY
1087 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1094 printf ("Usage:\n%s\n", cmdtp->usage);
1098 addr = simple_strtoul (argv[1], NULL, 16);
1099 addr += base_address;
1101 length = simple_strtoul (argv[2], NULL, 16);
1103 crc = crc32 (0, (const uchar *) addr, length);
1105 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1106 addr, addr + length - 1, crc);
1109 ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
1116 #else /* CONFIG_CRC32_VERIFY */
1118 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1130 printf ("Usage:\n%s\n", cmdtp->usage);
1136 if (strcmp(*av, "-v") == 0) {
1145 addr = simple_strtoul(*av++, NULL, 16);
1146 addr += base_address;
1147 length = simple_strtoul(*av++, NULL, 16);
1149 crc = crc32(0, (const uchar *) addr, length);
1152 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1153 addr, addr + length - 1, crc);
1155 ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
1159 vcrc = simple_strtoul(*av++, NULL, 16);
1161 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1162 addr, addr + length - 1, crc, vcrc);
1170 #endif /* CONFIG_CRC32_VERIFY */
1173 #ifdef CONFIG_CMD_UNZIP
1174 int gunzip (void *, int, unsigned char *, unsigned long *);
1176 int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1178 unsigned long src, dst;
1179 unsigned long src_len = ~0UL, dst_len = ~0UL;
1184 dst_len = simple_strtoul(argv[3], NULL, 16);
1187 src = simple_strtoul(argv[1], NULL, 16);
1188 dst = simple_strtoul(argv[2], NULL, 16);
1191 printf ("Usage:\n%s\n", cmdtp->usage);
1195 return !!gunzip((void *) dst, dst_len, (void *) src, &src_len);
1197 #endif /* CONFIG_CMD_UNZIP */
1200 /**************************************************/
1202 md, 3, 1, do_mem_md,
1203 "md - memory display\n",
1204 "[.b, .w, .l] address [# of objects]\n - memory display\n"
1209 mm, 2, 1, do_mem_mm,
1210 "mm - memory modify (auto-incrementing)\n",
1211 "[.b, .w, .l] address\n" " - memory modify, auto increment address\n"
1216 nm, 2, 1, do_mem_nm,
1217 "nm - memory modify (constant address)\n",
1218 "[.b, .w, .l] address\n - memory modify, read and keep address\n"
1222 mw, 4, 1, do_mem_mw,
1223 "mw - memory write (fill)\n",
1224 "[.b, .w, .l] address value [count]\n - write memory\n"
1228 cp, 4, 1, do_mem_cp,
1229 "cp - memory copy\n",
1230 "[.b, .w, .l] source target count\n - copy memory\n"
1234 cmp, 4, 1, do_mem_cmp,
1235 "cmp - memory compare\n",
1236 "[.b, .w, .l] addr1 addr2 count\n - compare memory\n"
1239 #ifndef CONFIG_CRC32_VERIFY
1242 crc32, 4, 1, do_mem_crc,
1243 "crc32 - checksum calculation\n",
1244 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1247 #else /* CONFIG_CRC32_VERIFY */
1250 crc32, 5, 1, do_mem_crc,
1251 "crc32 - checksum calculation\n",
1252 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1253 "-v address count crc\n - verify crc of memory area\n"
1256 #endif /* CONFIG_CRC32_VERIFY */
1259 base, 2, 1, do_mem_base,
1260 "base - print or set address offset\n",
1261 "\n - print address offset for memory commands\n"
1262 "base off\n - set address offset for memory commands to 'off'\n"
1266 loop, 3, 1, do_mem_loop,
1267 "loop - infinite loop on address range\n",
1268 "[.b, .w, .l] address number_of_objects\n"
1269 " - loop on a set of addresses\n"
1274 loopw, 4, 1, do_mem_loopw,
1275 "loopw - infinite write loop on address range\n",
1276 "[.b, .w, .l] address number_of_objects data_to_write\n"
1277 " - loop on a set of addresses\n"
1279 #endif /* CONFIG_LOOPW */
1282 mtest, 4, 1, do_mem_mtest,
1283 "mtest - simple RAM test\n",
1284 "[start [end [pattern]]]\n"
1285 " - simple RAM read/write test\n"
1288 #ifdef CONFIG_MX_CYCLIC
1290 mdc, 4, 1, do_mem_mdc,
1291 "mdc - memory display cyclic\n",
1292 "[.b, .w, .l] address count delay(ms)\n - memory display cyclic\n"
1296 mwc, 4, 1, do_mem_mwc,
1297 "mwc - memory write cyclic\n",
1298 "[.b, .w, .l] address value delay(ms)\n - memory write cyclic\n"
1300 #endif /* CONFIG_MX_CYCLIC */
1302 #ifdef CONFIG_CMD_UNZIP
1304 unzip, 4, 1, do_unzip,
1305 "unzip - unzip a memory region\n",
1306 "srcaddr dstaddr [dstsize]\n"
1308 #endif /* CONFIG_CMD_UNZIP */