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 static int mod_mem(cmd_tbl_t
*, int, int, int, char * const []);
39 /* Display values from last command.
40 * Memory modify remembered values are different from display memory.
42 static uint dp_last_addr
, dp_last_size
;
43 static uint dp_last_length
= 0x40;
44 static uint mm_last_addr
, mm_last_size
;
46 static ulong base_address
= 0;
51 * md{.b, .w, .l} {addr} {len}
53 #define DISP_LINE_LEN 16
54 int do_mem_md ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
57 #if defined(CONFIG_HAS_DATAFLASH)
58 ulong nbytes
, linebytes
;
63 /* We use the last specified parameters, unless new ones are
68 length
= dp_last_length
;
73 if ((flag
& CMD_FLAG_REPEAT
) == 0) {
74 /* New command specified. Check for a size specification.
75 * Defaults to long if no or incorrect specification.
77 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
80 /* Address is specified since argc > 1
82 addr
= simple_strtoul(argv
[1], NULL
, 16);
85 /* If another parameter, it is the length to display.
86 * Length is the number of objects, not number of bytes.
89 length
= simple_strtoul(argv
[2], NULL
, 16);
92 #if defined(CONFIG_HAS_DATAFLASH)
95 * We buffer all read data, so we can make sure data is read only
96 * once, and all accesses are with the specified bus width.
98 nbytes
= length
* size
;
100 char linebuf
[DISP_LINE_LEN
];
102 linebytes
= (nbytes
>DISP_LINE_LEN
)?DISP_LINE_LEN
:nbytes
;
104 rc
= read_dataflash(addr
, (linebytes
/size
)*size
, linebuf
);
105 p
= (rc
== DATAFLASH_OK
) ? linebuf
: (void*)addr
;
106 print_buffer(addr
, p
, size
, linebytes
/size
, DISP_LINE_LEN
/size
);
114 } while (nbytes
> 0);
117 # if defined(CONFIG_BLACKFIN)
118 /* See if we're trying to display L1 inst */
119 if (addr_bfin_on_chip_mem(addr
)) {
120 char linebuf
[DISP_LINE_LEN
];
121 ulong linebytes
, nbytes
= length
* size
;
123 linebytes
= (nbytes
> DISP_LINE_LEN
) ? DISP_LINE_LEN
: nbytes
;
124 memcpy(linebuf
, (void *)addr
, linebytes
);
125 print_buffer(addr
, linebuf
, size
, linebytes
/size
, DISP_LINE_LEN
/size
);
133 } while (nbytes
> 0);
138 /* Print the lines. */
139 print_buffer(addr
, (void*)addr
, size
, length
, DISP_LINE_LEN
/size
);
145 dp_last_length
= length
;
150 int do_mem_mm ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
152 return mod_mem (cmdtp
, 1, flag
, argc
, argv
);
154 int do_mem_nm ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
156 return mod_mem (cmdtp
, 0, flag
, argc
, argv
);
159 int do_mem_mw ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
161 ulong addr
, writeval
, count
;
164 if ((argc
< 3) || (argc
> 4))
165 return CMD_RET_USAGE
;
167 /* Check for size specification.
169 if ((size
= cmd_get_data_size(argv
[0], 4)) < 1)
172 /* Address is specified since argc > 1
174 addr
= simple_strtoul(argv
[1], NULL
, 16);
175 addr
+= base_address
;
177 /* Get the value to write.
179 writeval
= simple_strtoul(argv
[2], NULL
, 16);
183 count
= simple_strtoul(argv
[3], NULL
, 16);
188 while (count
-- > 0) {
190 *((ulong
*)addr
) = (ulong
)writeval
;
192 *((ushort
*)addr
) = (ushort
)writeval
;
194 *((u_char
*)addr
) = (u_char
)writeval
;
200 #ifdef CONFIG_MX_CYCLIC
201 int do_mem_mdc ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
207 return CMD_RET_USAGE
;
209 count
= simple_strtoul(argv
[3], NULL
, 10);
212 do_mem_md (NULL
, 0, 3, argv
);
214 /* delay for <count> ms... */
215 for (i
=0; i
<count
; i
++)
218 /* check for ctrl-c to abort... */
228 int do_mem_mwc ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
234 return CMD_RET_USAGE
;
236 count
= simple_strtoul(argv
[3], NULL
, 10);
239 do_mem_mw (NULL
, 0, 3, argv
);
241 /* delay for <count> ms... */
242 for (i
=0; i
<count
; i
++)
245 /* check for ctrl-c to abort... */
254 #endif /* CONFIG_MX_CYCLIC */
256 int do_mem_cmp (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
258 ulong addr1
, addr2
, count
, ngood
;
264 return CMD_RET_USAGE
;
266 /* Check for size specification.
268 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
270 type
= size
== 4 ? "word" : size
== 2 ? "halfword" : "byte";
272 addr1
= simple_strtoul(argv
[1], NULL
, 16);
273 addr1
+= base_address
;
275 addr2
= simple_strtoul(argv
[2], NULL
, 16);
276 addr2
+= base_address
;
278 count
= simple_strtoul(argv
[3], NULL
, 16);
280 #ifdef CONFIG_HAS_DATAFLASH
281 if (addr_dataflash(addr1
) | addr_dataflash(addr2
)){
282 puts ("Comparison with DataFlash space not supported.\n\r");
287 #ifdef CONFIG_BLACKFIN
288 if (addr_bfin_on_chip_mem(addr1
) || addr_bfin_on_chip_mem(addr2
)) {
289 puts ("Comparison with L1 instruction memory not supported.\n\r");
294 for (ngood
= 0; ngood
< count
; ++ngood
) {
297 word1
= *(ulong
*)addr1
;
298 word2
= *(ulong
*)addr2
;
299 } else if (size
== 2) {
300 word1
= *(ushort
*)addr1
;
301 word2
= *(ushort
*)addr2
;
303 word1
= *(u_char
*)addr1
;
304 word2
= *(u_char
*)addr2
;
306 if (word1
!= word2
) {
307 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
308 type
, addr1
, size
, word1
,
309 type
, addr2
, size
, word2
);
317 /* reset watchdog from time to time */
318 if ((ngood
% (64 << 10)) == 0)
322 printf("Total of %ld %s(s) were the same\n", ngood
, type
);
326 int do_mem_cp ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
328 ulong addr
, dest
, count
;
332 return CMD_RET_USAGE
;
334 /* Check for size specification.
336 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
339 addr
= simple_strtoul(argv
[1], NULL
, 16);
340 addr
+= base_address
;
342 dest
= simple_strtoul(argv
[2], NULL
, 16);
343 dest
+= base_address
;
345 count
= simple_strtoul(argv
[3], NULL
, 16);
348 puts ("Zero length ???\n");
352 #ifndef CONFIG_SYS_NO_FLASH
353 /* check if we are copying to Flash */
354 if ( (addr2info(dest
) != NULL
)
355 #ifdef CONFIG_HAS_DATAFLASH
356 && (!addr_dataflash(dest
))
361 puts ("Copy to Flash... ");
363 rc
= flash_write ((char *)addr
, dest
, count
*size
);
373 #ifdef CONFIG_HAS_DATAFLASH
374 /* Check if we are copying from RAM or Flash to DataFlash */
375 if (addr_dataflash(dest
) && !addr_dataflash(addr
)){
378 puts ("Copy to DataFlash... ");
380 rc
= write_dataflash (dest
, addr
, count
*size
);
383 dataflash_perror (rc
);
390 /* Check if we are copying from DataFlash to RAM */
391 if (addr_dataflash(addr
) && !addr_dataflash(dest
)
392 #ifndef CONFIG_SYS_NO_FLASH
393 && (addr2info(dest
) == NULL
)
397 rc
= read_dataflash(addr
, count
* size
, (char *) dest
);
399 dataflash_perror (rc
);
405 if (addr_dataflash(addr
) && addr_dataflash(dest
)){
406 puts ("Unsupported combination of source/destination.\n\r");
411 #ifdef CONFIG_BLACKFIN
412 /* See if we're copying to/from L1 inst */
413 if (addr_bfin_on_chip_mem(dest
) || addr_bfin_on_chip_mem(addr
)) {
414 memcpy((void *)dest
, (void *)addr
, count
* size
);
419 while (count
-- > 0) {
421 *((ulong
*)dest
) = *((ulong
*)addr
);
423 *((ushort
*)dest
) = *((ushort
*)addr
);
425 *((u_char
*)dest
) = *((u_char
*)addr
);
429 /* reset watchdog from time to time */
430 if ((count
% (64 << 10)) == 0)
436 int do_mem_base (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
439 /* Set new base address.
441 base_address
= simple_strtoul(argv
[1], NULL
, 16);
443 /* Print the current base address.
445 printf("Base Address: 0x%08lx\n", base_address
);
449 int do_mem_loop (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
451 ulong addr
, length
, i
;
453 volatile uint
*longp
;
454 volatile ushort
*shortp
;
458 return CMD_RET_USAGE
;
460 /* Check for a size spefication.
461 * Defaults to long if no or incorrect specification.
463 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
466 /* Address is always specified.
468 addr
= simple_strtoul(argv
[1], NULL
, 16);
470 /* Length is the number of objects, not number of bytes.
472 length
= simple_strtoul(argv
[2], NULL
, 16);
474 /* We want to optimize the loops to run as fast as possible.
475 * If we have only one object, just run infinite loops.
479 longp
= (uint
*)addr
;
484 shortp
= (ushort
*)addr
;
495 longp
= (uint
*)addr
;
503 shortp
= (ushort
*)addr
;
518 int do_mem_loopw (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
520 ulong addr
, length
, i
, data
;
522 volatile uint
*longp
;
523 volatile ushort
*shortp
;
527 return CMD_RET_USAGE
;
529 /* Check for a size spefication.
530 * Defaults to long if no or incorrect specification.
532 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
535 /* Address is always specified.
537 addr
= simple_strtoul(argv
[1], NULL
, 16);
539 /* Length is the number of objects, not number of bytes.
541 length
= simple_strtoul(argv
[2], NULL
, 16);
544 data
= simple_strtoul(argv
[3], 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
;
588 #endif /* CONFIG_LOOPW */
591 * Perform a memory test. A more complete alternative test can be
592 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
593 * interrupted by ctrl-c or by a failure of one of the sub-tests.
595 int do_mem_mtest (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
597 vu_long
*addr
, *start
, *end
;
604 #if defined(CONFIG_SYS_ALT_MEMTEST)
610 vu_long anti_pattern
;
612 #if defined(CONFIG_SYS_MEMTEST_SCRATCH)
613 vu_long
*dummy
= (vu_long
*)CONFIG_SYS_MEMTEST_SCRATCH
;
615 vu_long
*dummy
= 0; /* yes, this is address 0x0, not NULL */
619 static const ulong bitpattern
[] = {
620 0x00000001, /* single bit */
621 0x00000003, /* two adjacent bits */
622 0x00000007, /* three adjacent bits */
623 0x0000000F, /* four adjacent bits */
624 0x00000005, /* two non-adjacent bits */
625 0x00000015, /* three non-adjacent bits */
626 0x00000055, /* four non-adjacent bits */
627 0xaaaaaaaa, /* alternating 1/0 */
635 start
= (ulong
*)simple_strtoul(argv
[1], NULL
, 16);
637 start
= (ulong
*)CONFIG_SYS_MEMTEST_START
;
640 end
= (ulong
*)simple_strtoul(argv
[2], NULL
, 16);
642 end
= (ulong
*)(CONFIG_SYS_MEMTEST_END
);
645 pattern
= (ulong
)simple_strtoul(argv
[3], NULL
, 16);
650 iteration_limit
= (ulong
)simple_strtoul(argv
[4], NULL
, 16);
654 #if defined(CONFIG_SYS_ALT_MEMTEST)
655 printf ("Testing %08x ... %08x:\n", (uint
)start
, (uint
)end
);
656 debug("%s:%d: start 0x%p end 0x%p\n",
657 __FUNCTION__
, __LINE__
, start
, end
);
666 if (iteration_limit
&& iterations
> iteration_limit
) {
667 printf("Tested %d iteration(s) with %lu errors.\n",
672 printf("Iteration: %6d\r", iterations
);
677 * Data line test: write a pattern to the first
678 * location, write the 1's complement to a 'parking'
679 * address (changes the state of the data bus so a
680 * floating bus doen't give a false OK), and then
681 * read the value back. Note that we read it back
682 * into a variable because the next time we read it,
683 * it might be right (been there, tough to explain to
684 * the quality guys why it prints a failure when the
685 * "is" and "should be" are obviously the same in the
688 * Rather than exhaustively testing, we test some
689 * patterns by shifting '1' bits through a field of
690 * '0's and '0' bits through a field of '1's (i.e.
691 * pattern and ~pattern).
694 for (j
= 0; j
< sizeof(bitpattern
)/sizeof(bitpattern
[0]); j
++) {
696 for(; val
!= 0; val
<<= 1) {
698 *dummy
= ~val
; /* clear the test data off of the bus */
700 if(readback
!= val
) {
701 printf ("FAILURE (data line): "
702 "expected %08lx, actual %08lx\n",
713 if(readback
!= ~val
) {
714 printf ("FAILURE (data line): "
715 "Is %08lx, should be %08lx\n",
727 * Based on code whose Original Author and Copyright
728 * information follows: Copyright (c) 1998 by Michael
729 * Barr. This software is placed into the public
730 * domain and may be used for any purpose. However,
731 * this notice must not be changed or removed and no
732 * warranty is either expressed or implied by its
733 * publication or distribution.
739 * Description: Test the address bus wiring in a
740 * memory region by performing a walking
741 * 1's test on the relevant bits of the
742 * address and checking for aliasing.
743 * This test will find single-bit
744 * address failures such as stuck -high,
745 * stuck-low, and shorted pins. The base
746 * address and size of the region are
747 * selected by the caller.
749 * Notes: For best results, the selected base
750 * address should have enough LSB 0's to
751 * guarantee single address bit changes.
752 * For example, to test a 64-Kbyte
753 * region, select a base address on a
754 * 64-Kbyte boundary. Also, select the
755 * region size as a power-of-two if at
758 * Returns: 0 if the test succeeds, 1 if the test fails.
760 len
= ((ulong
)end
- (ulong
)start
)/sizeof(vu_long
);
761 pattern
= (vu_long
) 0xaaaaaaaa;
762 anti_pattern
= (vu_long
) 0x55555555;
764 debug("%s:%d: length = 0x%.8lx\n",
765 __FUNCTION__
, __LINE__
,
768 * Write the default pattern at each of the
769 * power-of-two offsets.
771 for (offset
= 1; offset
< len
; offset
<<= 1) {
772 start
[offset
] = pattern
;
776 * Check for address bits stuck high.
779 start
[test_offset
] = anti_pattern
;
781 for (offset
= 1; offset
< len
; offset
<<= 1) {
782 temp
= start
[offset
];
783 if (temp
!= pattern
) {
784 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
785 " expected 0x%.8lx, actual 0x%.8lx\n",
786 (ulong
)&start
[offset
], pattern
, temp
);
794 start
[test_offset
] = pattern
;
798 * Check for addr bits stuck low or shorted.
800 for (test_offset
= 1; test_offset
< len
; test_offset
<<= 1) {
801 start
[test_offset
] = anti_pattern
;
803 for (offset
= 1; offset
< len
; offset
<<= 1) {
804 temp
= start
[offset
];
805 if ((temp
!= pattern
) && (offset
!= test_offset
)) {
806 printf ("\nFAILURE: Address bit stuck low or shorted @"
807 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
808 (ulong
)&start
[offset
], pattern
, temp
);
816 start
[test_offset
] = pattern
;
820 * Description: Test the integrity of a physical
821 * memory device by performing an
822 * increment/decrement test over the
823 * entire region. In the process every
824 * storage bit in the device is tested
825 * as a zero and a one. The base address
826 * and the size of the region are
827 * selected by the caller.
829 * Returns: 0 if the test succeeds, 1 if the test fails.
831 num_words
= ((ulong
)end
- (ulong
)start
)/sizeof(vu_long
) + 1;
834 * Fill memory with a known pattern.
836 for (pattern
= 1, offset
= 0; offset
< num_words
; pattern
++, offset
++) {
838 start
[offset
] = pattern
;
842 * Check each location and invert it for the second pass.
844 for (pattern
= 1, offset
= 0; offset
< num_words
; pattern
++, offset
++) {
846 temp
= start
[offset
];
847 if (temp
!= pattern
) {
848 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
849 " expected 0x%.8lx, actual 0x%.8lx)\n",
850 (ulong
)&start
[offset
], pattern
, temp
);
858 anti_pattern
= ~pattern
;
859 start
[offset
] = anti_pattern
;
863 * Check each location for the inverted pattern and zero it.
865 for (pattern
= 1, offset
= 0; offset
< num_words
; pattern
++, offset
++) {
867 anti_pattern
= ~pattern
;
868 temp
= start
[offset
];
869 if (temp
!= anti_pattern
) {
870 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
871 " expected 0x%.8lx, actual 0x%.8lx)\n",
872 (ulong
)&start
[offset
], anti_pattern
, temp
);
883 #else /* The original, quickie test */
891 if (iteration_limit
&& iterations
> iteration_limit
) {
892 printf("Tested %d iteration(s) with %lu errors.\n",
898 printf ("\rPattern %08lX Writing..."
900 "\b\b\b\b\b\b\b\b\b\b",
903 for (addr
=start
,val
=pattern
; addr
<end
; addr
++) {
911 for (addr
=start
,val
=pattern
; addr
<end
; addr
++) {
914 if (readback
!= val
) {
915 printf ("\nMem error @ 0x%08X: "
916 "found %08lX, expected %08lX\n",
917 (uint
)(uintptr_t)addr
, readback
, val
);
928 * Flip the pattern each time to make lots of zeros and
929 * then, the next time, lots of ones. We decrement
930 * the "negative" patterns and increment the "positive"
931 * patterns to preserve this feature.
933 if(pattern
& 0x80000000) {
934 pattern
= -pattern
; /* complement & increment */
942 return 0; /* not reached */
949 * mm{.b, .w, .l} {addr}
950 * nm{.b, .w, .l} {addr}
953 mod_mem(cmd_tbl_t
*cmdtp
, int incrflag
, int flag
, int argc
, char * const argv
[])
959 return CMD_RET_USAGE
;
961 #ifdef CONFIG_BOOT_RETRY_TIME
962 reset_cmd_timeout(); /* got a good command to get here */
964 /* We use the last specified parameters, unless new ones are
970 if ((flag
& CMD_FLAG_REPEAT
) == 0) {
971 /* New command specified. Check for a size specification.
972 * Defaults to long if no or incorrect specification.
974 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
977 /* Address is specified since argc > 1
979 addr
= simple_strtoul(argv
[1], NULL
, 16);
980 addr
+= base_address
;
983 #ifdef CONFIG_HAS_DATAFLASH
984 if (addr_dataflash(addr
)){
985 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
990 #ifdef CONFIG_BLACKFIN
991 if (addr_bfin_on_chip_mem(addr
)) {
992 puts ("Can't modify L1 instruction in place. Use cp instead.\n\r");
997 /* Print the address, followed by value. Then accept input for
998 * the next value. A non-converted value exits.
1001 printf("%08lx:", addr
);
1003 printf(" %08x", *((uint
*)addr
));
1005 printf(" %04x", *((ushort
*)addr
));
1007 printf(" %02x", *((u_char
*)addr
));
1009 nbytes
= readline (" ? ");
1010 if (nbytes
== 0 || (nbytes
== 1 && console_buffer
[0] == '-')) {
1011 /* <CR> pressed as only input, don't modify current
1012 * location and move to next. "-" pressed will go back.
1015 addr
+= nbytes
? -size
: size
;
1017 #ifdef CONFIG_BOOT_RETRY_TIME
1018 reset_cmd_timeout(); /* good enough to not time out */
1021 #ifdef CONFIG_BOOT_RETRY_TIME
1022 else if (nbytes
== -2) {
1023 break; /* timed out, exit the command */
1028 i
= simple_strtoul(console_buffer
, &endp
, 16);
1029 nbytes
= endp
- console_buffer
;
1031 #ifdef CONFIG_BOOT_RETRY_TIME
1032 /* good enough to not time out
1034 reset_cmd_timeout();
1037 *((uint
*)addr
) = i
;
1039 *((ushort
*)addr
) = i
;
1041 *((u_char
*)addr
) = i
;
1048 mm_last_addr
= addr
;
1049 mm_last_size
= size
;
1053 #ifdef CONFIG_CMD_CRC32
1055 #ifndef CONFIG_CRC32_VERIFY
1057 int do_mem_crc (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
1064 return CMD_RET_USAGE
;
1066 addr
= simple_strtoul (argv
[1], NULL
, 16);
1067 addr
+= base_address
;
1069 length
= simple_strtoul (argv
[2], NULL
, 16);
1071 crc
= crc32_wd (0, (const uchar
*) addr
, length
, CHUNKSZ_CRC32
);
1073 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1074 addr
, addr
+ length
- 1, crc
);
1077 ptr
= (ulong
*) simple_strtoul (argv
[3], NULL
, 16);
1084 #else /* CONFIG_CRC32_VERIFY */
1086 int do_mem_crc (cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
1098 return CMD_RET_USAGE
;
1103 if (strcmp(*av
, "-v") == 0) {
1112 addr
= simple_strtoul(*av
++, NULL
, 16);
1113 addr
+= base_address
;
1114 length
= simple_strtoul(*av
++, NULL
, 16);
1116 crc
= crc32_wd (0, (const uchar
*) addr
, length
, CHUNKSZ_CRC32
);
1119 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1120 addr
, addr
+ length
- 1, crc
);
1122 ptr
= (ulong
*) simple_strtoul (*av
++, NULL
, 16);
1126 vcrc
= simple_strtoul(*av
++, NULL
, 16);
1128 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1129 addr
, addr
+ length
- 1, crc
, vcrc
);
1137 #endif /* CONFIG_CRC32_VERIFY */
1141 /**************************************************/
1143 md
, 3, 1, do_mem_md
,
1145 "[.b, .w, .l] address [# of objects]"
1150 mm
, 2, 1, do_mem_mm
,
1151 "memory modify (auto-incrementing address)",
1152 "[.b, .w, .l] address"
1157 nm
, 2, 1, do_mem_nm
,
1158 "memory modify (constant address)",
1159 "[.b, .w, .l] address"
1163 mw
, 4, 1, do_mem_mw
,
1164 "memory write (fill)",
1165 "[.b, .w, .l] address value [count]"
1169 cp
, 4, 1, do_mem_cp
,
1171 "[.b, .w, .l] source target count"
1175 cmp
, 4, 1, do_mem_cmp
,
1177 "[.b, .w, .l] addr1 addr2 count"
1180 #ifdef CONFIG_CMD_CRC32
1182 #ifndef CONFIG_CRC32_VERIFY
1185 crc32
, 4, 1, do_mem_crc
,
1186 "checksum calculation",
1187 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1190 #else /* CONFIG_CRC32_VERIFY */
1193 crc32
, 5, 1, do_mem_crc
,
1194 "checksum calculation",
1195 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1196 "-v address count crc\n - verify crc of memory area"
1199 #endif /* CONFIG_CRC32_VERIFY */
1204 base
, 2, 1, do_mem_base
,
1205 "print or set address offset",
1206 "\n - print address offset for memory commands\n"
1207 "base off\n - set address offset for memory commands to 'off'"
1211 loop
, 3, 1, do_mem_loop
,
1212 "infinite loop on address range",
1213 "[.b, .w, .l] address number_of_objects"
1218 loopw
, 4, 1, do_mem_loopw
,
1219 "infinite write loop on address range",
1220 "[.b, .w, .l] address number_of_objects data_to_write"
1222 #endif /* CONFIG_LOOPW */
1225 mtest
, 5, 1, do_mem_mtest
,
1226 "simple RAM read/write test",
1227 "[start [end [pattern [iterations]]]]"
1230 #ifdef CONFIG_MX_CYCLIC
1232 mdc
, 4, 1, do_mem_mdc
,
1233 "memory display cyclic",
1234 "[.b, .w, .l] address count delay(ms)"
1238 mwc
, 4, 1, do_mem_mwc
,
1239 "memory write cyclic",
1240 "[.b, .w, .l] address value delay(ms)"
1242 #endif /* CONFIG_MX_CYCLIC */