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>
39 #if defined(CONFIG_CMD_MEMORY) \
40 || defined(CONFIG_CMD_I2C) \
41 || defined(CONFIG_CMD_ITEST) \
42 || defined(CONFIG_CMD_PCI) \
43 || defined(CONFIG_CMD_PORTIO)
45 int cmd_get_data_size(char* arg, int default_size)
47 /* Check for a size specification .b, .w or .l.
49 int len = strlen(arg);
50 if (len > 2 && arg[len-2] == '.') {
68 #if defined(CONFIG_CMD_MEMORY)
71 #define PRINTF(fmt,args...) printf (fmt ,##args)
73 #define PRINTF(fmt,args...)
76 static int mod_mem(cmd_tbl_t *, int, int, int, char *[]);
78 /* Display values from last command.
79 * Memory modify remembered values are different from display memory.
81 uint dp_last_addr, dp_last_size;
82 uint dp_last_length = 0x40;
83 uint mm_last_addr, mm_last_size;
85 static ulong base_address = 0;
90 * md{.b, .w, .l} {addr} {len}
92 #define DISP_LINE_LEN 16
93 int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
96 #if defined(CONFIG_HAS_DATAFLASH)
97 ulong nbytes, linebytes;
102 /* We use the last specified parameters, unless new ones are
107 length = dp_last_length;
110 printf ("Usage:\n%s\n", cmdtp->usage);
114 if ((flag & CMD_FLAG_REPEAT) == 0) {
115 /* New command specified. Check for a size specification.
116 * Defaults to long if no or incorrect specification.
118 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
121 /* Address is specified since argc > 1
123 addr = simple_strtoul(argv[1], NULL, 16);
124 addr += base_address;
126 /* If another parameter, it is the length to display.
127 * Length is the number of objects, not number of bytes.
130 length = simple_strtoul(argv[2], NULL, 16);
133 #if defined(CONFIG_HAS_DATAFLASH)
136 * We buffer all read data, so we can make sure data is read only
137 * once, and all accesses are with the specified bus width.
139 nbytes = length * size;
141 char linebuf[DISP_LINE_LEN];
143 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
145 rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
146 p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
147 print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
155 } while (nbytes > 0);
157 /* Print the lines. */
158 print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
163 dp_last_length = length;
168 int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
170 return mod_mem (cmdtp, 1, flag, argc, argv);
172 int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
174 return mod_mem (cmdtp, 0, flag, argc, argv);
177 int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
179 ulong addr, writeval, count;
182 if ((argc < 3) || (argc > 4)) {
183 printf ("Usage:\n%s\n", cmdtp->usage);
187 /* Check for size specification.
189 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
192 /* Address is specified since argc > 1
194 addr = simple_strtoul(argv[1], NULL, 16);
195 addr += base_address;
197 /* Get the value to write.
199 writeval = simple_strtoul(argv[2], NULL, 16);
203 count = simple_strtoul(argv[3], NULL, 16);
208 while (count-- > 0) {
210 *((ulong *)addr) = (ulong )writeval;
212 *((ushort *)addr) = (ushort)writeval;
214 *((u_char *)addr) = (u_char)writeval;
220 #ifdef CONFIG_MX_CYCLIC
221 int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
227 printf ("Usage:\n%s\n", cmdtp->usage);
231 count = simple_strtoul(argv[3], NULL, 10);
234 do_mem_md (NULL, 0, 3, argv);
236 /* delay for <count> ms... */
237 for (i=0; i<count; i++)
240 /* check for ctrl-c to abort... */
250 int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
256 printf ("Usage:\n%s\n", cmdtp->usage);
260 count = simple_strtoul(argv[3], NULL, 10);
263 do_mem_mw (NULL, 0, 3, argv);
265 /* delay for <count> ms... */
266 for (i=0; i<count; i++)
269 /* check for ctrl-c to abort... */
278 #endif /* CONFIG_MX_CYCLIC */
280 int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
282 ulong addr1, addr2, count, ngood;
287 printf ("Usage:\n%s\n", cmdtp->usage);
291 /* Check for size specification.
293 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
296 addr1 = simple_strtoul(argv[1], NULL, 16);
297 addr1 += base_address;
299 addr2 = simple_strtoul(argv[2], NULL, 16);
300 addr2 += base_address;
302 count = simple_strtoul(argv[3], NULL, 16);
304 #ifdef CONFIG_HAS_DATAFLASH
305 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
306 puts ("Comparison with DataFlash space 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;
364 printf ("Usage:\n%s\n", cmdtp->usage);
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");
387 /* check if we are copying to Flash */
388 if ( (addr2info(dest) != NULL)
389 #ifdef CONFIG_HAS_DATAFLASH
390 && (!addr_dataflash(addr))
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) && (addr2info(dest)==NULL) ){
467 rc = read_dataflash(addr, count * size, (char *) dest);
469 dataflash_perror (rc);
475 if (addr_dataflash(addr) && addr_dataflash(dest)){
476 puts ("Unsupported combination of source/destination.\n\r");
481 while (count-- > 0) {
483 *((ulong *)dest) = *((ulong *)addr);
485 *((ushort *)dest) = *((ushort *)addr);
487 *((u_char *)dest) = *((u_char *)addr);
494 int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
497 /* Set new base address.
499 base_address = simple_strtoul(argv[1], NULL, 16);
501 /* Print the current base address.
503 printf("Base Address: 0x%08lx\n", base_address);
507 int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
509 ulong addr, length, i, junk;
511 volatile uint *longp;
512 volatile ushort *shortp;
516 printf ("Usage:\n%s\n", cmdtp->usage);
520 /* Check for a size spefication.
521 * Defaults to long if no or incorrect specification.
523 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
526 /* Address is always specified.
528 addr = simple_strtoul(argv[1], NULL, 16);
530 /* Length is the number of objects, not number of bytes.
532 length = simple_strtoul(argv[2], NULL, 16);
534 /* We want to optimize the loops to run as fast as possible.
535 * If we have only one object, just run infinite loops.
539 longp = (uint *)addr;
544 shortp = (ushort *)addr;
555 longp = (uint *)addr;
563 shortp = (ushort *)addr;
578 int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
580 ulong addr, length, i, data;
582 volatile uint *longp;
583 volatile ushort *shortp;
587 printf ("Usage:\n%s\n", cmdtp->usage);
591 /* Check for a size spefication.
592 * Defaults to long if no or incorrect specification.
594 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
597 /* Address is always specified.
599 addr = simple_strtoul(argv[1], NULL, 16);
601 /* Length is the number of objects, not number of bytes.
603 length = simple_strtoul(argv[2], NULL, 16);
606 data = simple_strtoul(argv[3], NULL, 16);
608 /* We want to optimize the loops to run as fast as possible.
609 * If we have only one object, just run infinite loops.
613 longp = (uint *)addr;
618 shortp = (ushort *)addr;
629 longp = (uint *)addr;
637 shortp = (ushort *)addr;
650 #endif /* CONFIG_LOOPW */
653 * Perform a memory test. A more complete alternative test can be
654 * configured using CFG_ALT_MEMTEST. The complete test loops until
655 * interrupted by ctrl-c or by a failure of one of the sub-tests.
657 int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
659 vu_long *addr, *start, *end;
663 #if defined(CFG_ALT_MEMTEST)
669 vu_long anti_pattern;
671 #if defined(CFG_MEMTEST_SCRATCH)
672 vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
674 vu_long *dummy = 0; /* yes, this is address 0x0, not NULL */
679 static const ulong bitpattern[] = {
680 0x00000001, /* single bit */
681 0x00000003, /* two adjacent bits */
682 0x00000007, /* three adjacent bits */
683 0x0000000F, /* four adjacent bits */
684 0x00000005, /* two non-adjacent bits */
685 0x00000015, /* three non-adjacent bits */
686 0x00000055, /* four non-adjacent bits */
687 0xaaaaaaaa, /* alternating 1/0 */
696 start = (ulong *)simple_strtoul(argv[1], NULL, 16);
698 start = (ulong *)CFG_MEMTEST_START;
702 end = (ulong *)simple_strtoul(argv[2], NULL, 16);
704 end = (ulong *)(CFG_MEMTEST_END);
708 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
713 #if defined(CFG_ALT_MEMTEST)
714 printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
715 PRINTF("%s:%d: start 0x%p end 0x%p\n",
716 __FUNCTION__, __LINE__, start, end);
724 printf("Iteration: %6d\r", iterations);
725 PRINTF("Iteration: %6d\n", iterations);
729 * Data line test: write a pattern to the first
730 * location, write the 1's complement to a 'parking'
731 * address (changes the state of the data bus so a
732 * floating bus doen't give a false OK), and then
733 * read the value back. Note that we read it back
734 * into a variable because the next time we read it,
735 * it might be right (been there, tough to explain to
736 * the quality guys why it prints a failure when the
737 * "is" and "should be" are obviously the same in the
740 * Rather than exhaustively testing, we test some
741 * patterns by shifting '1' bits through a field of
742 * '0's and '0' bits through a field of '1's (i.e.
743 * pattern and ~pattern).
746 for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
748 for(; val != 0; val <<= 1) {
750 *dummy = ~val; /* clear the test data off of the bus */
752 if(readback != val) {
753 printf ("FAILURE (data line): "
754 "expected %08lx, actual %08lx\n",
760 if(readback != ~val) {
761 printf ("FAILURE (data line): "
762 "Is %08lx, should be %08lx\n",
769 * Based on code whose Original Author and Copyright
770 * information follows: Copyright (c) 1998 by Michael
771 * Barr. This software is placed into the public
772 * domain and may be used for any purpose. However,
773 * this notice must not be changed or removed and no
774 * warranty is either expressed or implied by its
775 * publication or distribution.
781 * Description: Test the address bus wiring in a
782 * memory region by performing a walking
783 * 1's test on the relevant bits of the
784 * address and checking for aliasing.
785 * This test will find single-bit
786 * address failures such as stuck -high,
787 * stuck-low, and shorted pins. The base
788 * address and size of the region are
789 * selected by the caller.
791 * Notes: For best results, the selected base
792 * address should have enough LSB 0's to
793 * guarantee single address bit changes.
794 * For example, to test a 64-Kbyte
795 * region, select a base address on a
796 * 64-Kbyte boundary. Also, select the
797 * region size as a power-of-two if at
800 * Returns: 0 if the test succeeds, 1 if the test fails.
802 * ## NOTE ## Be sure to specify start and end
803 * addresses such that addr_mask has
804 * lots of bits set. For example an
805 * address range of 01000000 02000000 is
806 * bad while a range of 01000000
807 * 01ffffff is perfect.
809 addr_mask = ((ulong)end - (ulong)start)/sizeof(vu_long);
810 pattern = (vu_long) 0xaaaaaaaa;
811 anti_pattern = (vu_long) 0x55555555;
813 PRINTF("%s:%d: addr mask = 0x%.8lx\n",
814 __FUNCTION__, __LINE__,
817 * Write the default pattern at each of the
818 * power-of-two offsets.
820 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
821 start[offset] = pattern;
825 * Check for address bits stuck high.
828 start[test_offset] = anti_pattern;
830 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
831 temp = start[offset];
832 if (temp != pattern) {
833 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
834 " expected 0x%.8lx, actual 0x%.8lx\n",
835 (ulong)&start[offset], pattern, temp);
839 start[test_offset] = pattern;
842 * Check for addr bits stuck low or shorted.
844 for (test_offset = 1; (test_offset & addr_mask) != 0; test_offset <<= 1) {
845 start[test_offset] = anti_pattern;
847 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
848 temp = start[offset];
849 if ((temp != pattern) && (offset != test_offset)) {
850 printf ("\nFAILURE: Address bit stuck low or shorted @"
851 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
852 (ulong)&start[offset], pattern, temp);
856 start[test_offset] = pattern;
860 * Description: Test the integrity of a physical
861 * memory device by performing an
862 * increment/decrement test over the
863 * entire region. In the process every
864 * storage bit in the device is tested
865 * as a zero and a one. The base address
866 * and the size of the region are
867 * selected by the caller.
869 * Returns: 0 if the test succeeds, 1 if the test fails.
871 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
874 * Fill memory with a known pattern.
876 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
877 start[offset] = pattern;
881 * Check each location and invert it for the second pass.
883 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
884 temp = start[offset];
885 if (temp != pattern) {
886 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
887 " expected 0x%.8lx, actual 0x%.8lx)\n",
888 (ulong)&start[offset], pattern, temp);
892 anti_pattern = ~pattern;
893 start[offset] = anti_pattern;
897 * Check each location for the inverted pattern and zero it.
899 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
900 anti_pattern = ~pattern;
901 temp = start[offset];
902 if (temp != anti_pattern) {
903 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
904 " expected 0x%.8lx, actual 0x%.8lx)\n",
905 (ulong)&start[offset], anti_pattern, temp);
912 #else /* The original, quickie test */
920 printf ("\rPattern %08lX Writing..."
922 "\b\b\b\b\b\b\b\b\b\b",
925 for (addr=start,val=pattern; addr<end; addr++) {
932 for (addr=start,val=pattern; addr<end; addr++) {
934 if (readback != val) {
935 printf ("\nMem error @ 0x%08X: "
936 "found %08lX, expected %08lX\n",
937 (uint)addr, readback, val);
944 * Flip the pattern each time to make lots of zeros and
945 * then, the next time, lots of ones. We decrement
946 * the "negative" patterns and increment the "positive"
947 * patterns to preserve this feature.
949 if(pattern & 0x80000000) {
950 pattern = -pattern; /* complement & increment */
965 * mm{.b, .w, .l} {addr}
966 * nm{.b, .w, .l} {addr}
969 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
973 extern char console_buffer[];
976 printf ("Usage:\n%s\n", cmdtp->usage);
980 #ifdef CONFIG_BOOT_RETRY_TIME
981 reset_cmd_timeout(); /* got a good command to get here */
983 /* We use the last specified parameters, unless new ones are
989 if ((flag & CMD_FLAG_REPEAT) == 0) {
990 /* New command specified. Check for a size specification.
991 * Defaults to long if no or incorrect specification.
993 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
996 /* Address is specified since argc > 1
998 addr = simple_strtoul(argv[1], NULL, 16);
999 addr += base_address;
1002 #ifdef CONFIG_HAS_DATAFLASH
1003 if (addr_dataflash(addr)){
1004 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
1009 /* Print the address, followed by value. Then accept input for
1010 * the next value. A non-converted value exits.
1013 printf("%08lx:", addr);
1015 printf(" %08x", *((uint *)addr));
1017 printf(" %04x", *((ushort *)addr));
1019 printf(" %02x", *((u_char *)addr));
1021 nbytes = readline (" ? ");
1022 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1023 /* <CR> pressed as only input, don't modify current
1024 * location and move to next. "-" pressed will go back.
1027 addr += nbytes ? -size : size;
1029 #ifdef CONFIG_BOOT_RETRY_TIME
1030 reset_cmd_timeout(); /* good enough to not time out */
1033 #ifdef CONFIG_BOOT_RETRY_TIME
1034 else if (nbytes == -2) {
1035 break; /* timed out, exit the command */
1040 i = simple_strtoul(console_buffer, &endp, 16);
1041 nbytes = endp - console_buffer;
1043 #ifdef CONFIG_BOOT_RETRY_TIME
1044 /* good enough to not time out
1046 reset_cmd_timeout();
1049 *((uint *)addr) = i;
1051 *((ushort *)addr) = i;
1053 *((u_char *)addr) = i;
1060 mm_last_addr = addr;
1061 mm_last_size = size;
1065 #ifndef CONFIG_CRC32_VERIFY
1067 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1074 printf ("Usage:\n%s\n", cmdtp->usage);
1078 addr = simple_strtoul (argv[1], NULL, 16);
1079 addr += base_address;
1081 length = simple_strtoul (argv[2], NULL, 16);
1083 crc = crc32 (0, (const uchar *) addr, length);
1085 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1086 addr, addr + length - 1, crc);
1089 ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
1096 #else /* CONFIG_CRC32_VERIFY */
1098 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1110 printf ("Usage:\n%s\n", cmdtp->usage);
1116 if (strcmp(*av, "-v") == 0) {
1125 addr = simple_strtoul(*av++, NULL, 16);
1126 addr += base_address;
1127 length = simple_strtoul(*av++, NULL, 16);
1129 crc = crc32(0, (const uchar *) addr, length);
1132 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1133 addr, addr + length - 1, crc);
1135 ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
1139 vcrc = simple_strtoul(*av++, NULL, 16);
1141 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1142 addr, addr + length - 1, crc, vcrc);
1150 #endif /* CONFIG_CRC32_VERIFY */
1152 /**************************************************/
1153 #if defined(CONFIG_CMD_MEMORY)
1155 md, 3, 1, do_mem_md,
1156 "md - memory display\n",
1157 "[.b, .w, .l] address [# of objects]\n - memory display\n"
1162 mm, 2, 1, do_mem_mm,
1163 "mm - memory modify (auto-incrementing)\n",
1164 "[.b, .w, .l] address\n" " - memory modify, auto increment address\n"
1169 nm, 2, 1, do_mem_nm,
1170 "nm - memory modify (constant address)\n",
1171 "[.b, .w, .l] address\n - memory modify, read and keep address\n"
1175 mw, 4, 1, do_mem_mw,
1176 "mw - memory write (fill)\n",
1177 "[.b, .w, .l] address value [count]\n - write memory\n"
1181 cp, 4, 1, do_mem_cp,
1182 "cp - memory copy\n",
1183 "[.b, .w, .l] source target count\n - copy memory\n"
1187 cmp, 4, 1, do_mem_cmp,
1188 "cmp - memory compare\n",
1189 "[.b, .w, .l] addr1 addr2 count\n - compare memory\n"
1192 #ifndef CONFIG_CRC32_VERIFY
1195 crc32, 4, 1, do_mem_crc,
1196 "crc32 - checksum calculation\n",
1197 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1200 #else /* CONFIG_CRC32_VERIFY */
1203 crc32, 5, 1, do_mem_crc,
1204 "crc32 - checksum calculation\n",
1205 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1206 "-v address count crc\n - verify crc of memory area\n"
1209 #endif /* CONFIG_CRC32_VERIFY */
1212 base, 2, 1, do_mem_base,
1213 "base - print or set address offset\n",
1214 "\n - print address offset for memory commands\n"
1215 "base off\n - set address offset for memory commands to 'off'\n"
1219 loop, 3, 1, do_mem_loop,
1220 "loop - infinite loop on address range\n",
1221 "[.b, .w, .l] address number_of_objects\n"
1222 " - loop on a set of addresses\n"
1227 loopw, 4, 1, do_mem_loopw,
1228 "loopw - infinite write loop on address range\n",
1229 "[.b, .w, .l] address number_of_objects data_to_write\n"
1230 " - loop on a set of addresses\n"
1232 #endif /* CONFIG_LOOPW */
1235 mtest, 4, 1, do_mem_mtest,
1236 "mtest - simple RAM test\n",
1237 "[start [end [pattern]]]\n"
1238 " - simple RAM read/write test\n"
1241 #ifdef CONFIG_MX_CYCLIC
1243 mdc, 4, 1, do_mem_mdc,
1244 "mdc - memory display cyclic\n",
1245 "[.b, .w, .l] address count delay(ms)\n - memory display cyclic\n"
1249 mwc, 4, 1, do_mem_mwc,
1250 "mwc - memory write cyclic\n",
1251 "[.b, .w, .l] address value delay(ms)\n - memory write cyclic\n"
1253 #endif /* CONFIG_MX_CYCLIC */