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>
38 #define PRINTF(fmt,args...) printf (fmt ,##args)
40 #define PRINTF(fmt,args...)
43 static int mod_mem(cmd_tbl_t
*, int, int, int, char *[]);
45 /* Display values from last command.
46 * Memory modify remembered values are different from display memory.
48 uint dp_last_addr
, dp_last_size
;
49 uint dp_last_length
= 0x40;
50 uint mm_last_addr
, mm_last_size
;
52 static ulong base_address
= 0;
57 * md{.b, .w, .l} {addr} {len}
59 #define DISP_LINE_LEN 16
60 int do_mem_md ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
63 #if defined(CONFIG_HAS_DATAFLASH)
64 ulong nbytes
, linebytes
;
69 /* We use the last specified parameters, unless new ones are
74 length
= dp_last_length
;
81 if ((flag
& CMD_FLAG_REPEAT
) == 0) {
82 /* New command specified. Check for a size specification.
83 * Defaults to long if no or incorrect specification.
85 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
88 /* Address is specified since argc > 1
90 addr
= simple_strtoul(argv
[1], NULL
, 16);
93 /* If another parameter, it is the length to display.
94 * Length is the number of objects, not number of bytes.
97 length
= simple_strtoul(argv
[2], NULL
, 16);
100 #if defined(CONFIG_HAS_DATAFLASH)
103 * We buffer all read data, so we can make sure data is read only
104 * once, and all accesses are with the specified bus width.
106 nbytes
= length
* size
;
108 char linebuf
[DISP_LINE_LEN
];
110 linebytes
= (nbytes
>DISP_LINE_LEN
)?DISP_LINE_LEN
:nbytes
;
112 rc
= read_dataflash(addr
, (linebytes
/size
)*size
, linebuf
);
113 p
= (rc
== DATAFLASH_OK
) ? linebuf
: (void*)addr
;
114 print_buffer(addr
, p
, size
, linebytes
/size
, DISP_LINE_LEN
/size
);
122 } while (nbytes
> 0);
125 # if defined(CONFIG_BLACKFIN)
126 /* See if we're trying to display L1 inst */
127 if (addr_bfin_on_chip_mem(addr
)) {
128 char linebuf
[DISP_LINE_LEN
];
129 ulong linebytes
, nbytes
= length
* size
;
131 linebytes
= (nbytes
> DISP_LINE_LEN
) ? DISP_LINE_LEN
: nbytes
;
132 memcpy(linebuf
, (void *)addr
, linebytes
);
133 print_buffer(addr
, linebuf
, size
, linebytes
/size
, DISP_LINE_LEN
/size
);
141 } while (nbytes
> 0);
146 /* Print the lines. */
147 print_buffer(addr
, (void*)addr
, size
, length
, DISP_LINE_LEN
/size
);
153 dp_last_length
= length
;
158 int do_mem_mm ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
160 return mod_mem (cmdtp
, 1, flag
, argc
, argv
);
162 int do_mem_nm ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
164 return mod_mem (cmdtp
, 0, flag
, argc
, argv
);
167 int do_mem_mw ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
169 ulong addr
, writeval
, count
;
172 if ((argc
< 3) || (argc
> 4)) {
177 /* Check for size specification.
179 if ((size
= cmd_get_data_size(argv
[0], 4)) < 1)
182 /* Address is specified since argc > 1
184 addr
= simple_strtoul(argv
[1], NULL
, 16);
185 addr
+= base_address
;
187 /* Get the value to write.
189 writeval
= simple_strtoul(argv
[2], NULL
, 16);
193 count
= simple_strtoul(argv
[3], NULL
, 16);
198 while (count
-- > 0) {
200 *((ulong
*)addr
) = (ulong
)writeval
;
202 *((ushort
*)addr
) = (ushort
)writeval
;
204 *((u_char
*)addr
) = (u_char
)writeval
;
210 #ifdef CONFIG_MX_CYCLIC
211 int do_mem_mdc ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
221 count
= simple_strtoul(argv
[3], NULL
, 10);
224 do_mem_md (NULL
, 0, 3, argv
);
226 /* delay for <count> ms... */
227 for (i
=0; i
<count
; i
++)
230 /* check for ctrl-c to abort... */
240 int do_mem_mwc ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
250 count
= simple_strtoul(argv
[3], NULL
, 10);
253 do_mem_mw (NULL
, 0, 3, argv
);
255 /* delay for <count> ms... */
256 for (i
=0; i
<count
; i
++)
259 /* check for ctrl-c to abort... */
268 #endif /* CONFIG_MX_CYCLIC */
270 int do_mem_cmp (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
272 ulong addr1
, addr2
, count
, ngood
;
281 /* Check for size specification.
283 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
286 addr1
= simple_strtoul(argv
[1], NULL
, 16);
287 addr1
+= base_address
;
289 addr2
= simple_strtoul(argv
[2], NULL
, 16);
290 addr2
+= base_address
;
292 count
= simple_strtoul(argv
[3], NULL
, 16);
294 #ifdef CONFIG_HAS_DATAFLASH
295 if (addr_dataflash(addr1
) | addr_dataflash(addr2
)){
296 puts ("Comparison with DataFlash space not supported.\n\r");
301 #ifdef CONFIG_BLACKFIN
302 if (addr_bfin_on_chip_mem(addr1
) || addr_bfin_on_chip_mem(addr2
)) {
303 puts ("Comparison with L1 instruction memory not supported.\n\r");
310 while (count
-- > 0) {
312 ulong word1
= *(ulong
*)addr1
;
313 ulong word2
= *(ulong
*)addr2
;
314 if (word1
!= word2
) {
315 printf("word at 0x%08lx (0x%08lx) "
316 "!= word at 0x%08lx (0x%08lx)\n",
317 addr1
, word1
, addr2
, word2
);
322 else if (size
== 2) {
323 ushort hword1
= *(ushort
*)addr1
;
324 ushort hword2
= *(ushort
*)addr2
;
325 if (hword1
!= hword2
) {
326 printf("halfword at 0x%08lx (0x%04x) "
327 "!= halfword at 0x%08lx (0x%04x)\n",
328 addr1
, hword1
, addr2
, hword2
);
334 u_char byte1
= *(u_char
*)addr1
;
335 u_char byte2
= *(u_char
*)addr2
;
336 if (byte1
!= byte2
) {
337 printf("byte at 0x%08lx (0x%02x) "
338 "!= byte at 0x%08lx (0x%02x)\n",
339 addr1
, byte1
, addr2
, byte2
);
349 printf("Total of %ld %s%s were the same\n",
350 ngood
, size
== 4 ? "word" : size
== 2 ? "halfword" : "byte",
351 ngood
== 1 ? "" : "s");
355 int do_mem_cp ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
357 ulong addr
, dest
, count
;
365 /* Check for size specification.
367 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
370 addr
= simple_strtoul(argv
[1], NULL
, 16);
371 addr
+= base_address
;
373 dest
= simple_strtoul(argv
[2], NULL
, 16);
374 dest
+= base_address
;
376 count
= simple_strtoul(argv
[3], NULL
, 16);
379 puts ("Zero length ???\n");
383 #ifndef CONFIG_SYS_NO_FLASH
384 /* check if we are copying to Flash */
385 if ( (addr2info(dest
) != NULL
)
386 #ifdef CONFIG_HAS_DATAFLASH
387 && (!addr_dataflash(dest
))
392 puts ("Copy to Flash... ");
394 rc
= flash_write ((char *)addr
, dest
, count
*size
);
404 #ifdef CONFIG_HAS_DATAFLASH
405 /* Check if we are copying from RAM or Flash to DataFlash */
406 if (addr_dataflash(dest
) && !addr_dataflash(addr
)){
409 puts ("Copy to DataFlash... ");
411 rc
= write_dataflash (dest
, addr
, count
*size
);
414 dataflash_perror (rc
);
421 /* Check if we are copying from DataFlash to RAM */
422 if (addr_dataflash(addr
) && !addr_dataflash(dest
)
423 #ifndef CONFIG_SYS_NO_FLASH
424 && (addr2info(dest
) == NULL
)
428 rc
= read_dataflash(addr
, count
* size
, (char *) dest
);
430 dataflash_perror (rc
);
436 if (addr_dataflash(addr
) && addr_dataflash(dest
)){
437 puts ("Unsupported combination of source/destination.\n\r");
442 #ifdef CONFIG_BLACKFIN
443 /* See if we're copying to/from L1 inst */
444 if (addr_bfin_on_chip_mem(dest
) || addr_bfin_on_chip_mem(addr
)) {
445 memcpy((void *)dest
, (void *)addr
, count
* size
);
450 while (count
-- > 0) {
452 *((ulong
*)dest
) = *((ulong
*)addr
);
454 *((ushort
*)dest
) = *((ushort
*)addr
);
456 *((u_char
*)dest
) = *((u_char
*)addr
);
463 int do_mem_base (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
466 /* Set new base address.
468 base_address
= simple_strtoul(argv
[1], NULL
, 16);
470 /* Print the current base address.
472 printf("Base Address: 0x%08lx\n", base_address
);
476 int do_mem_loop (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
478 ulong addr
, length
, i
, junk
;
480 volatile uint
*longp
;
481 volatile ushort
*shortp
;
489 /* Check for a size spefication.
490 * Defaults to long if no or incorrect specification.
492 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
495 /* Address is always specified.
497 addr
= simple_strtoul(argv
[1], NULL
, 16);
499 /* Length is the number of objects, not number of bytes.
501 length
= simple_strtoul(argv
[2], NULL
, 16);
503 /* We want to optimize the loops to run as fast as possible.
504 * If we have only one object, just run infinite loops.
508 longp
= (uint
*)addr
;
513 shortp
= (ushort
*)addr
;
524 longp
= (uint
*)addr
;
532 shortp
= (ushort
*)addr
;
547 int do_mem_loopw (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
549 ulong addr
, length
, i
, data
;
551 volatile uint
*longp
;
552 volatile ushort
*shortp
;
560 /* Check for a size spefication.
561 * Defaults to long if no or incorrect specification.
563 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
566 /* Address is always specified.
568 addr
= simple_strtoul(argv
[1], NULL
, 16);
570 /* Length is the number of objects, not number of bytes.
572 length
= simple_strtoul(argv
[2], NULL
, 16);
575 data
= simple_strtoul(argv
[3], NULL
, 16);
577 /* We want to optimize the loops to run as fast as possible.
578 * If we have only one object, just run infinite loops.
582 longp
= (uint
*)addr
;
587 shortp
= (ushort
*)addr
;
598 longp
= (uint
*)addr
;
606 shortp
= (ushort
*)addr
;
619 #endif /* CONFIG_LOOPW */
622 * Perform a memory test. A more complete alternative test can be
623 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
624 * interrupted by ctrl-c or by a failure of one of the sub-tests.
626 int do_mem_mtest (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
628 vu_long
*addr
, *start
, *end
;
635 #if defined(CONFIG_SYS_ALT_MEMTEST)
641 vu_long anti_pattern
;
643 #if defined(CONFIG_SYS_MEMTEST_SCRATCH)
644 vu_long
*dummy
= (vu_long
*)CONFIG_SYS_MEMTEST_SCRATCH
;
646 vu_long
*dummy
= 0; /* yes, this is address 0x0, not NULL */
650 static const ulong bitpattern
[] = {
651 0x00000001, /* single bit */
652 0x00000003, /* two adjacent bits */
653 0x00000007, /* three adjacent bits */
654 0x0000000F, /* four adjacent bits */
655 0x00000005, /* two non-adjacent bits */
656 0x00000015, /* three non-adjacent bits */
657 0x00000055, /* four non-adjacent bits */
658 0xaaaaaaaa, /* alternating 1/0 */
666 start
= (ulong
*)simple_strtoul(argv
[1], NULL
, 16);
668 start
= (ulong
*)CONFIG_SYS_MEMTEST_START
;
671 end
= (ulong
*)simple_strtoul(argv
[2], NULL
, 16);
673 end
= (ulong
*)(CONFIG_SYS_MEMTEST_END
);
676 pattern
= (ulong
)simple_strtoul(argv
[3], NULL
, 16);
681 iteration_limit
= (ulong
)simple_strtoul(argv
[4], NULL
, 16);
685 #if defined(CONFIG_SYS_ALT_MEMTEST)
686 printf ("Testing %08x ... %08x:\n", (uint
)start
, (uint
)end
);
687 PRINTF("%s:%d: start 0x%p end 0x%p\n",
688 __FUNCTION__
, __LINE__
, start
, end
);
697 if (iteration_limit
&& iterations
> iteration_limit
) {
698 printf("Tested %d iteration(s) without errors.\n",
703 printf("Iteration: %6d\r", iterations
);
708 * Data line test: write a pattern to the first
709 * location, write the 1's complement to a 'parking'
710 * address (changes the state of the data bus so a
711 * floating bus doen't give a false OK), and then
712 * read the value back. Note that we read it back
713 * into a variable because the next time we read it,
714 * it might be right (been there, tough to explain to
715 * the quality guys why it prints a failure when the
716 * "is" and "should be" are obviously the same in the
719 * Rather than exhaustively testing, we test some
720 * patterns by shifting '1' bits through a field of
721 * '0's and '0' bits through a field of '1's (i.e.
722 * pattern and ~pattern).
725 for (j
= 0; j
< sizeof(bitpattern
)/sizeof(bitpattern
[0]); j
++) {
727 for(; val
!= 0; val
<<= 1) {
729 *dummy
= ~val
; /* clear the test data off of the bus */
731 if(readback
!= val
) {
732 printf ("FAILURE (data line): "
733 "expected %08lx, actual %08lx\n",
739 if(readback
!= ~val
) {
740 printf ("FAILURE (data line): "
741 "Is %08lx, should be %08lx\n",
748 * Based on code whose Original Author and Copyright
749 * information follows: Copyright (c) 1998 by Michael
750 * Barr. This software is placed into the public
751 * domain and may be used for any purpose. However,
752 * this notice must not be changed or removed and no
753 * warranty is either expressed or implied by its
754 * publication or distribution.
760 * Description: Test the address bus wiring in a
761 * memory region by performing a walking
762 * 1's test on the relevant bits of the
763 * address and checking for aliasing.
764 * This test will find single-bit
765 * address failures such as stuck -high,
766 * stuck-low, and shorted pins. The base
767 * address and size of the region are
768 * selected by the caller.
770 * Notes: For best results, the selected base
771 * address should have enough LSB 0's to
772 * guarantee single address bit changes.
773 * For example, to test a 64-Kbyte
774 * region, select a base address on a
775 * 64-Kbyte boundary. Also, select the
776 * region size as a power-of-two if at
779 * Returns: 0 if the test succeeds, 1 if the test fails.
781 len
= ((ulong
)end
- (ulong
)start
)/sizeof(vu_long
);
782 pattern
= (vu_long
) 0xaaaaaaaa;
783 anti_pattern
= (vu_long
) 0x55555555;
785 PRINTF("%s:%d: length = 0x%.8lx\n",
786 __FUNCTION__
, __LINE__
,
789 * Write the default pattern at each of the
790 * power-of-two offsets.
792 for (offset
= 1; offset
< len
; offset
<<= 1) {
793 start
[offset
] = pattern
;
797 * Check for address bits stuck high.
800 start
[test_offset
] = anti_pattern
;
802 for (offset
= 1; offset
< len
; offset
<<= 1) {
803 temp
= start
[offset
];
804 if (temp
!= pattern
) {
805 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
806 " expected 0x%.8lx, actual 0x%.8lx\n",
807 (ulong
)&start
[offset
], pattern
, temp
);
811 start
[test_offset
] = pattern
;
815 * Check for addr bits stuck low or shorted.
817 for (test_offset
= 1; test_offset
< len
; test_offset
<<= 1) {
818 start
[test_offset
] = anti_pattern
;
820 for (offset
= 1; offset
< len
; offset
<<= 1) {
821 temp
= start
[offset
];
822 if ((temp
!= pattern
) && (offset
!= test_offset
)) {
823 printf ("\nFAILURE: Address bit stuck low or shorted @"
824 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
825 (ulong
)&start
[offset
], pattern
, temp
);
829 start
[test_offset
] = pattern
;
833 * Description: Test the integrity of a physical
834 * memory device by performing an
835 * increment/decrement test over the
836 * entire region. In the process every
837 * storage bit in the device is tested
838 * as a zero and a one. The base address
839 * and the size of the region are
840 * selected by the caller.
842 * Returns: 0 if the test succeeds, 1 if the test fails.
844 num_words
= ((ulong
)end
- (ulong
)start
)/sizeof(vu_long
) + 1;
847 * Fill memory with a known pattern.
849 for (pattern
= 1, offset
= 0; offset
< num_words
; pattern
++, offset
++) {
851 start
[offset
] = pattern
;
855 * Check each location and invert it for the second pass.
857 for (pattern
= 1, offset
= 0; offset
< num_words
; pattern
++, offset
++) {
859 temp
= start
[offset
];
860 if (temp
!= pattern
) {
861 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
862 " expected 0x%.8lx, actual 0x%.8lx)\n",
863 (ulong
)&start
[offset
], pattern
, temp
);
867 anti_pattern
= ~pattern
;
868 start
[offset
] = anti_pattern
;
872 * Check each location for the inverted pattern and zero it.
874 for (pattern
= 1, offset
= 0; offset
< num_words
; pattern
++, offset
++) {
876 anti_pattern
= ~pattern
;
877 temp
= start
[offset
];
878 if (temp
!= anti_pattern
) {
879 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
880 " expected 0x%.8lx, actual 0x%.8lx)\n",
881 (ulong
)&start
[offset
], anti_pattern
, temp
);
888 #else /* The original, quickie test */
896 if (iteration_limit
&& iterations
> iteration_limit
) {
897 printf("Tested %d iteration(s) without errors.\n",
903 printf ("\rPattern %08lX Writing..."
905 "\b\b\b\b\b\b\b\b\b\b",
908 for (addr
=start
,val
=pattern
; addr
<end
; addr
++) {
916 for (addr
=start
,val
=pattern
; addr
<end
; addr
++) {
919 if (readback
!= val
) {
920 printf ("\nMem error @ 0x%08X: "
921 "found %08lX, expected %08lX\n",
922 (uint
)addr
, readback
, val
);
929 * Flip the pattern each time to make lots of zeros and
930 * then, the next time, lots of ones. We decrement
931 * the "negative" patterns and increment the "positive"
932 * patterns to preserve this feature.
934 if(pattern
& 0x80000000) {
935 pattern
= -pattern
; /* complement & increment */
950 * mm{.b, .w, .l} {addr}
951 * nm{.b, .w, .l} {addr}
954 mod_mem(cmd_tbl_t
*cmdtp
, int incrflag
, int flag
, int argc
, char *argv
[])
958 extern char console_buffer
[];
965 #ifdef CONFIG_BOOT_RETRY_TIME
966 reset_cmd_timeout(); /* got a good command to get here */
968 /* We use the last specified parameters, unless new ones are
974 if ((flag
& CMD_FLAG_REPEAT
) == 0) {
975 /* New command specified. Check for a size specification.
976 * Defaults to long if no or incorrect specification.
978 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
981 /* Address is specified since argc > 1
983 addr
= simple_strtoul(argv
[1], NULL
, 16);
984 addr
+= base_address
;
987 #ifdef CONFIG_HAS_DATAFLASH
988 if (addr_dataflash(addr
)){
989 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
994 #ifdef CONFIG_BLACKFIN
995 if (addr_bfin_on_chip_mem(addr
)) {
996 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
1001 /* Print the address, followed by value. Then accept input for
1002 * the next value. A non-converted value exits.
1005 printf("%08lx:", addr
);
1007 printf(" %08x", *((uint
*)addr
));
1009 printf(" %04x", *((ushort
*)addr
));
1011 printf(" %02x", *((u_char
*)addr
));
1013 nbytes
= readline (" ? ");
1014 if (nbytes
== 0 || (nbytes
== 1 && console_buffer
[0] == '-')) {
1015 /* <CR> pressed as only input, don't modify current
1016 * location and move to next. "-" pressed will go back.
1019 addr
+= nbytes
? -size
: size
;
1021 #ifdef CONFIG_BOOT_RETRY_TIME
1022 reset_cmd_timeout(); /* good enough to not time out */
1025 #ifdef CONFIG_BOOT_RETRY_TIME
1026 else if (nbytes
== -2) {
1027 break; /* timed out, exit the command */
1032 i
= simple_strtoul(console_buffer
, &endp
, 16);
1033 nbytes
= endp
- console_buffer
;
1035 #ifdef CONFIG_BOOT_RETRY_TIME
1036 /* good enough to not time out
1038 reset_cmd_timeout();
1041 *((uint
*)addr
) = i
;
1043 *((ushort
*)addr
) = i
;
1045 *((u_char
*)addr
) = i
;
1052 mm_last_addr
= addr
;
1053 mm_last_size
= size
;
1057 #ifndef CONFIG_CRC32_VERIFY
1059 int do_mem_crc (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
1070 addr
= simple_strtoul (argv
[1], NULL
, 16);
1071 addr
+= base_address
;
1073 length
= simple_strtoul (argv
[2], NULL
, 16);
1075 crc
= crc32 (0, (const uchar
*) addr
, length
);
1077 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1078 addr
, addr
+ length
- 1, crc
);
1081 ptr
= (ulong
*) simple_strtoul (argv
[3], NULL
, 16);
1088 #else /* CONFIG_CRC32_VERIFY */
1090 int do_mem_crc (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
1108 if (strcmp(*av
, "-v") == 0) {
1117 addr
= simple_strtoul(*av
++, NULL
, 16);
1118 addr
+= base_address
;
1119 length
= simple_strtoul(*av
++, NULL
, 16);
1121 crc
= crc32(0, (const uchar
*) addr
, length
);
1124 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1125 addr
, addr
+ length
- 1, crc
);
1127 ptr
= (ulong
*) simple_strtoul (*av
++, NULL
, 16);
1131 vcrc
= simple_strtoul(*av
++, NULL
, 16);
1133 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1134 addr
, addr
+ length
- 1, crc
, vcrc
);
1142 #endif /* CONFIG_CRC32_VERIFY */
1145 #ifdef CONFIG_CMD_UNZIP
1146 int gunzip (void *, int, unsigned char *, unsigned long *);
1148 int do_unzip ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
1150 unsigned long src
, dst
;
1151 unsigned long src_len
= ~0UL, dst_len
= ~0UL;
1155 dst_len
= simple_strtoul(argv
[3], NULL
, 16);
1158 src
= simple_strtoul(argv
[1], NULL
, 16);
1159 dst
= simple_strtoul(argv
[2], NULL
, 16);
1166 return !!gunzip((void *) dst
, dst_len
, (void *) src
, &src_len
);
1168 #endif /* CONFIG_CMD_UNZIP */
1171 /**************************************************/
1173 md
, 3, 1, do_mem_md
,
1175 "[.b, .w, .l] address [# of objects]"
1180 mm
, 2, 1, do_mem_mm
,
1181 "memory modify (auto-incrementing address)",
1182 "[.b, .w, .l] address"
1187 nm
, 2, 1, do_mem_nm
,
1188 "memory modify (constant address)",
1189 "[.b, .w, .l] address"
1193 mw
, 4, 1, do_mem_mw
,
1194 "memory write (fill)",
1195 "[.b, .w, .l] address value [count]"
1199 cp
, 4, 1, do_mem_cp
,
1201 "[.b, .w, .l] source target count"
1205 cmp
, 4, 1, do_mem_cmp
,
1207 "[.b, .w, .l] addr1 addr2 count"
1210 #ifndef CONFIG_CRC32_VERIFY
1213 crc32
, 4, 1, do_mem_crc
,
1214 "checksum calculation",
1215 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1218 #else /* CONFIG_CRC32_VERIFY */
1221 crc32
, 5, 1, do_mem_crc
,
1222 "checksum calculation",
1223 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1224 "-v address count crc\n - verify crc of memory area"
1227 #endif /* CONFIG_CRC32_VERIFY */
1230 base
, 2, 1, do_mem_base
,
1231 "print or set address offset",
1232 "\n - print address offset for memory commands\n"
1233 "base off\n - set address offset for memory commands to 'off'"
1237 loop
, 3, 1, do_mem_loop
,
1238 "infinite loop on address range",
1239 "[.b, .w, .l] address number_of_objects"
1244 loopw
, 4, 1, do_mem_loopw
,
1245 "infinite write loop on address range",
1246 "[.b, .w, .l] address number_of_objects data_to_write"
1248 #endif /* CONFIG_LOOPW */
1251 mtest
, 5, 1, do_mem_mtest
,
1252 "simple RAM read/write test",
1253 "[start [end [pattern [iterations]]]]"
1256 #ifdef CONFIG_MX_CYCLIC
1258 mdc
, 4, 1, do_mem_mdc
,
1259 "memory display cyclic",
1260 "[.b, .w, .l] address count delay(ms)"
1264 mwc
, 4, 1, do_mem_mwc
,
1265 "memory write cyclic",
1266 "[.b, .w, .l] address value delay(ms)"
1268 #endif /* CONFIG_MX_CYCLIC */
1270 #ifdef CONFIG_CMD_UNZIP
1272 unzip
, 4, 1, do_unzip
,
1273 "unzip a memory region",
1274 "srcaddr dstaddr [dstsize]"
1276 #endif /* CONFIG_CMD_UNZIP */