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>
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 #if defined(CONFIG_CMD_MMC)
408 if (mmc2info(dest)) {
411 puts ("Copy to MMC... ");
412 switch (rc = mmc_write ((uchar *)addr, dest, count*size)) {
420 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
427 if (mmc2info(addr)) {
430 puts ("Copy from MMC... ");
431 switch (rc = mmc_read (addr, (uchar *)dest, count*size)) {
439 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
447 #ifdef CONFIG_HAS_DATAFLASH
448 /* Check if we are copying from RAM or Flash to DataFlash */
449 if (addr_dataflash(dest) && !addr_dataflash(addr)){
452 puts ("Copy to DataFlash... ");
454 rc = write_dataflash (dest, addr, count*size);
457 dataflash_perror (rc);
464 /* Check if we are copying from DataFlash to RAM */
465 if (addr_dataflash(addr) && !addr_dataflash(dest)
466 #ifndef CONFIG_SYS_NO_FLASH
467 && (addr2info(dest) == NULL)
471 rc = read_dataflash(addr, count * size, (char *) dest);
473 dataflash_perror (rc);
479 if (addr_dataflash(addr) && addr_dataflash(dest)){
480 puts ("Unsupported combination of source/destination.\n\r");
485 #ifdef CONFIG_BLACKFIN
486 /* See if we're copying to/from L1 inst */
487 if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) {
488 memcpy((void *)dest, (void *)addr, count * size);
493 while (count-- > 0) {
495 *((ulong *)dest) = *((ulong *)addr);
497 *((ushort *)dest) = *((ushort *)addr);
499 *((u_char *)dest) = *((u_char *)addr);
506 int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
509 /* Set new base address.
511 base_address = simple_strtoul(argv[1], NULL, 16);
513 /* Print the current base address.
515 printf("Base Address: 0x%08lx\n", base_address);
519 int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
521 ulong addr, length, i, junk;
523 volatile uint *longp;
524 volatile ushort *shortp;
532 /* Check for a size spefication.
533 * Defaults to long if no or incorrect specification.
535 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
538 /* Address is always specified.
540 addr = simple_strtoul(argv[1], NULL, 16);
542 /* Length is the number of objects, not number of bytes.
544 length = simple_strtoul(argv[2], NULL, 16);
546 /* We want to optimize the loops to run as fast as possible.
547 * If we have only one object, just run infinite loops.
551 longp = (uint *)addr;
556 shortp = (ushort *)addr;
567 longp = (uint *)addr;
575 shortp = (ushort *)addr;
590 int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
592 ulong addr, length, i, data;
594 volatile uint *longp;
595 volatile ushort *shortp;
603 /* Check for a size spefication.
604 * Defaults to long if no or incorrect specification.
606 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
609 /* Address is always specified.
611 addr = simple_strtoul(argv[1], NULL, 16);
613 /* Length is the number of objects, not number of bytes.
615 length = simple_strtoul(argv[2], NULL, 16);
618 data = simple_strtoul(argv[3], NULL, 16);
620 /* We want to optimize the loops to run as fast as possible.
621 * If we have only one object, just run infinite loops.
625 longp = (uint *)addr;
630 shortp = (ushort *)addr;
641 longp = (uint *)addr;
649 shortp = (ushort *)addr;
662 #endif /* CONFIG_LOOPW */
665 * Perform a memory test. A more complete alternative test can be
666 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
667 * interrupted by ctrl-c or by a failure of one of the sub-tests.
669 int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
671 vu_long *addr, *start, *end;
678 #if defined(CONFIG_SYS_ALT_MEMTEST)
684 vu_long anti_pattern;
686 #if defined(CONFIG_SYS_MEMTEST_SCRATCH)
687 vu_long *dummy = (vu_long*)CONFIG_SYS_MEMTEST_SCRATCH;
689 vu_long *dummy = 0; /* yes, this is address 0x0, not NULL */
693 static const ulong bitpattern[] = {
694 0x00000001, /* single bit */
695 0x00000003, /* two adjacent bits */
696 0x00000007, /* three adjacent bits */
697 0x0000000F, /* four adjacent bits */
698 0x00000005, /* two non-adjacent bits */
699 0x00000015, /* three non-adjacent bits */
700 0x00000055, /* four non-adjacent bits */
701 0xaaaaaaaa, /* alternating 1/0 */
709 start = (ulong *)simple_strtoul(argv[1], NULL, 16);
711 start = (ulong *)CONFIG_SYS_MEMTEST_START;
714 end = (ulong *)simple_strtoul(argv[2], NULL, 16);
716 end = (ulong *)(CONFIG_SYS_MEMTEST_END);
719 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
724 iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16);
728 #if defined(CONFIG_SYS_ALT_MEMTEST)
729 printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
730 PRINTF("%s:%d: start 0x%p end 0x%p\n",
731 __FUNCTION__, __LINE__, start, end);
740 if (iteration_limit && iterations > iteration_limit) {
741 printf("Tested %d iteration(s) without errors.\n",
746 printf("Iteration: %6d\r", iterations);
751 * Data line test: write a pattern to the first
752 * location, write the 1's complement to a 'parking'
753 * address (changes the state of the data bus so a
754 * floating bus doen't give a false OK), and then
755 * read the value back. Note that we read it back
756 * into a variable because the next time we read it,
757 * it might be right (been there, tough to explain to
758 * the quality guys why it prints a failure when the
759 * "is" and "should be" are obviously the same in the
762 * Rather than exhaustively testing, we test some
763 * patterns by shifting '1' bits through a field of
764 * '0's and '0' bits through a field of '1's (i.e.
765 * pattern and ~pattern).
768 for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
770 for(; val != 0; val <<= 1) {
772 *dummy = ~val; /* clear the test data off of the bus */
774 if(readback != val) {
775 printf ("FAILURE (data line): "
776 "expected %08lx, actual %08lx\n",
782 if(readback != ~val) {
783 printf ("FAILURE (data line): "
784 "Is %08lx, should be %08lx\n",
791 * Based on code whose Original Author and Copyright
792 * information follows: Copyright (c) 1998 by Michael
793 * Barr. This software is placed into the public
794 * domain and may be used for any purpose. However,
795 * this notice must not be changed or removed and no
796 * warranty is either expressed or implied by its
797 * publication or distribution.
803 * Description: Test the address bus wiring in a
804 * memory region by performing a walking
805 * 1's test on the relevant bits of the
806 * address and checking for aliasing.
807 * This test will find single-bit
808 * address failures such as stuck -high,
809 * stuck-low, and shorted pins. The base
810 * address and size of the region are
811 * selected by the caller.
813 * Notes: For best results, the selected base
814 * address should have enough LSB 0's to
815 * guarantee single address bit changes.
816 * For example, to test a 64-Kbyte
817 * region, select a base address on a
818 * 64-Kbyte boundary. Also, select the
819 * region size as a power-of-two if at
822 * Returns: 0 if the test succeeds, 1 if the test fails.
824 len = ((ulong)end - (ulong)start)/sizeof(vu_long);
825 pattern = (vu_long) 0xaaaaaaaa;
826 anti_pattern = (vu_long) 0x55555555;
828 PRINTF("%s:%d: length = 0x%.8lx\n",
829 __FUNCTION__, __LINE__,
832 * Write the default pattern at each of the
833 * power-of-two offsets.
835 for (offset = 1; offset < len; offset <<= 1) {
836 start[offset] = pattern;
840 * Check for address bits stuck high.
843 start[test_offset] = anti_pattern;
845 for (offset = 1; offset < len; offset <<= 1) {
846 temp = start[offset];
847 if (temp != pattern) {
848 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
849 " expected 0x%.8lx, actual 0x%.8lx\n",
850 (ulong)&start[offset], pattern, temp);
854 start[test_offset] = pattern;
858 * Check for addr bits stuck low or shorted.
860 for (test_offset = 1; test_offset < len; test_offset <<= 1) {
861 start[test_offset] = anti_pattern;
863 for (offset = 1; offset < len; offset <<= 1) {
864 temp = start[offset];
865 if ((temp != pattern) && (offset != test_offset)) {
866 printf ("\nFAILURE: Address bit stuck low or shorted @"
867 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
868 (ulong)&start[offset], pattern, temp);
872 start[test_offset] = pattern;
876 * Description: Test the integrity of a physical
877 * memory device by performing an
878 * increment/decrement test over the
879 * entire region. In the process every
880 * storage bit in the device is tested
881 * as a zero and a one. The base address
882 * and the size of the region are
883 * selected by the caller.
885 * Returns: 0 if the test succeeds, 1 if the test fails.
887 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
890 * Fill memory with a known pattern.
892 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
894 start[offset] = pattern;
898 * Check each location and invert it for the second pass.
900 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
902 temp = start[offset];
903 if (temp != pattern) {
904 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
905 " expected 0x%.8lx, actual 0x%.8lx)\n",
906 (ulong)&start[offset], pattern, temp);
910 anti_pattern = ~pattern;
911 start[offset] = anti_pattern;
915 * Check each location for the inverted pattern and zero it.
917 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
919 anti_pattern = ~pattern;
920 temp = start[offset];
921 if (temp != anti_pattern) {
922 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
923 " expected 0x%.8lx, actual 0x%.8lx)\n",
924 (ulong)&start[offset], anti_pattern, temp);
931 #else /* The original, quickie test */
939 if (iteration_limit && iterations > iteration_limit) {
940 printf("Tested %d iteration(s) without errors.\n",
946 printf ("\rPattern %08lX Writing..."
948 "\b\b\b\b\b\b\b\b\b\b",
951 for (addr=start,val=pattern; addr<end; addr++) {
959 for (addr=start,val=pattern; addr<end; addr++) {
962 if (readback != val) {
963 printf ("\nMem error @ 0x%08X: "
964 "found %08lX, expected %08lX\n",
965 (uint)addr, readback, val);
972 * Flip the pattern each time to make lots of zeros and
973 * then, the next time, lots of ones. We decrement
974 * the "negative" patterns and increment the "positive"
975 * patterns to preserve this feature.
977 if(pattern & 0x80000000) {
978 pattern = -pattern; /* complement & increment */
993 * mm{.b, .w, .l} {addr}
994 * nm{.b, .w, .l} {addr}
997 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
1001 extern char console_buffer[];
1008 #ifdef CONFIG_BOOT_RETRY_TIME
1009 reset_cmd_timeout(); /* got a good command to get here */
1011 /* We use the last specified parameters, unless new ones are
1014 addr = mm_last_addr;
1015 size = mm_last_size;
1017 if ((flag & CMD_FLAG_REPEAT) == 0) {
1018 /* New command specified. Check for a size specification.
1019 * Defaults to long if no or incorrect specification.
1021 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1024 /* Address is specified since argc > 1
1026 addr = simple_strtoul(argv[1], NULL, 16);
1027 addr += base_address;
1030 #ifdef CONFIG_HAS_DATAFLASH
1031 if (addr_dataflash(addr)){
1032 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
1037 #ifdef CONFIG_BLACKFIN
1038 if (addr_bfin_on_chip_mem(addr)) {
1039 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
1044 /* Print the address, followed by value. Then accept input for
1045 * the next value. A non-converted value exits.
1048 printf("%08lx:", addr);
1050 printf(" %08x", *((uint *)addr));
1052 printf(" %04x", *((ushort *)addr));
1054 printf(" %02x", *((u_char *)addr));
1056 nbytes = readline (" ? ");
1057 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1058 /* <CR> pressed as only input, don't modify current
1059 * location and move to next. "-" pressed will go back.
1062 addr += nbytes ? -size : size;
1064 #ifdef CONFIG_BOOT_RETRY_TIME
1065 reset_cmd_timeout(); /* good enough to not time out */
1068 #ifdef CONFIG_BOOT_RETRY_TIME
1069 else if (nbytes == -2) {
1070 break; /* timed out, exit the command */
1075 i = simple_strtoul(console_buffer, &endp, 16);
1076 nbytes = endp - console_buffer;
1078 #ifdef CONFIG_BOOT_RETRY_TIME
1079 /* good enough to not time out
1081 reset_cmd_timeout();
1084 *((uint *)addr) = i;
1086 *((ushort *)addr) = i;
1088 *((u_char *)addr) = i;
1095 mm_last_addr = addr;
1096 mm_last_size = size;
1100 #ifndef CONFIG_CRC32_VERIFY
1102 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1113 addr = simple_strtoul (argv[1], NULL, 16);
1114 addr += base_address;
1116 length = simple_strtoul (argv[2], NULL, 16);
1118 crc = crc32 (0, (const uchar *) addr, length);
1120 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1121 addr, addr + length - 1, crc);
1124 ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
1131 #else /* CONFIG_CRC32_VERIFY */
1133 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1151 if (strcmp(*av, "-v") == 0) {
1160 addr = simple_strtoul(*av++, NULL, 16);
1161 addr += base_address;
1162 length = simple_strtoul(*av++, NULL, 16);
1164 crc = crc32(0, (const uchar *) addr, length);
1167 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1168 addr, addr + length - 1, crc);
1170 ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
1174 vcrc = simple_strtoul(*av++, NULL, 16);
1176 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1177 addr, addr + length - 1, crc, vcrc);
1185 #endif /* CONFIG_CRC32_VERIFY */
1188 #ifdef CONFIG_CMD_UNZIP
1189 int gunzip (void *, int, unsigned char *, unsigned long *);
1191 int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1193 unsigned long src, dst;
1194 unsigned long src_len = ~0UL, dst_len = ~0UL;
1198 dst_len = simple_strtoul(argv[3], NULL, 16);
1201 src = simple_strtoul(argv[1], NULL, 16);
1202 dst = simple_strtoul(argv[2], NULL, 16);
1209 return !!gunzip((void *) dst, dst_len, (void *) src, &src_len);
1211 #endif /* CONFIG_CMD_UNZIP */
1214 /**************************************************/
1216 md, 3, 1, do_mem_md,
1218 "[.b, .w, .l] address [# of objects]\n - memory display\n"
1223 mm, 2, 1, do_mem_mm,
1224 "memory modify (auto-incrementing)",
1225 "[.b, .w, .l] address\n" " - memory modify, auto increment address\n"
1230 nm, 2, 1, do_mem_nm,
1231 "memory modify (constant address)",
1232 "[.b, .w, .l] address\n - memory modify, read and keep address\n"
1236 mw, 4, 1, do_mem_mw,
1237 "memory write (fill)",
1238 "[.b, .w, .l] address value [count]\n - write memory\n"
1242 cp, 4, 1, do_mem_cp,
1244 "[.b, .w, .l] source target count\n - copy memory\n"
1248 cmp, 4, 1, do_mem_cmp,
1250 "[.b, .w, .l] addr1 addr2 count\n - compare memory\n"
1253 #ifndef CONFIG_CRC32_VERIFY
1256 crc32, 4, 1, do_mem_crc,
1257 "checksum calculation",
1258 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1261 #else /* CONFIG_CRC32_VERIFY */
1264 crc32, 5, 1, do_mem_crc,
1265 "checksum calculation",
1266 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1267 "-v address count crc\n - verify crc of memory area\n"
1270 #endif /* CONFIG_CRC32_VERIFY */
1273 base, 2, 1, do_mem_base,
1274 "print or set address offset",
1275 "\n - print address offset for memory commands\n"
1276 "base off\n - set address offset for memory commands to 'off'\n"
1280 loop, 3, 1, do_mem_loop,
1281 "infinite loop on address range",
1282 "[.b, .w, .l] address number_of_objects\n"
1283 " - loop on a set of addresses\n"
1288 loopw, 4, 1, do_mem_loopw,
1289 "infinite write loop on address range",
1290 "[.b, .w, .l] address number_of_objects data_to_write\n"
1291 " - loop on a set of addresses\n"
1293 #endif /* CONFIG_LOOPW */
1296 mtest, 5, 1, do_mem_mtest,
1298 "[start [end [pattern [iterations]]]]\n"
1299 " - simple RAM read/write test\n"
1302 #ifdef CONFIG_MX_CYCLIC
1304 mdc, 4, 1, do_mem_mdc,
1305 "memory display cyclic",
1306 "[.b, .w, .l] address count delay(ms)\n - memory display cyclic\n"
1310 mwc, 4, 1, do_mem_mwc,
1311 "memory write cyclic",
1312 "[.b, .w, .l] address value delay(ms)\n - memory write cyclic\n"
1314 #endif /* CONFIG_MX_CYCLIC */
1316 #ifdef CONFIG_CMD_UNZIP
1318 unzip, 4, 1, do_unzip,
1319 "unzip a memory region",
1320 "srcaddr dstaddr [dstsize]\n"
1322 #endif /* CONFIG_CMD_UNZIP */