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 (CONFIG_COMMANDS & CFG_CMD_MMC) || defined(CONFIG_CMD_MMC)
35 #ifdef CONFIG_HAS_DATAFLASH
36 #include <dataflash.h>
39 #if (CONFIG_COMMANDS & (CFG_CMD_MEMORY | \
44 || defined(CONFIG_CMD_MEMORY) \
45 || defined(CONFIG_CMD_I2C) \
46 || defined(CONFIG_CMD_ITEST) \
47 || defined(CONFIG_CMD_PCI) \
48 || defined(CONFIG_CMD_PORTIO)
50 int cmd_get_data_size(char* arg, int default_size)
52 /* Check for a size specification .b, .w or .l.
54 int len = strlen(arg);
55 if (len > 2 && arg[len-2] == '.') {
73 #if (CONFIG_COMMANDS & CFG_CMD_MEMORY) || defined(CONFIG_CMD_MEMORY)
76 #define PRINTF(fmt,args...) printf (fmt ,##args)
78 #define PRINTF(fmt,args...)
81 static int mod_mem(cmd_tbl_t *, int, int, int, char *[]);
83 /* Display values from last command.
84 * Memory modify remembered values are different from display memory.
86 uint dp_last_addr, dp_last_size;
87 uint dp_last_length = 0x40;
88 uint mm_last_addr, mm_last_size;
90 static ulong base_address = 0;
95 * md{.b, .w, .l} {addr} {len}
97 #define DISP_LINE_LEN 16
98 int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
101 #if defined(CONFIG_HAS_DATAFLASH)
102 ulong nbytes, linebytes;
107 /* We use the last specified parameters, unless new ones are
112 length = dp_last_length;
115 printf ("Usage:\n%s\n", cmdtp->usage);
119 if ((flag & CMD_FLAG_REPEAT) == 0) {
120 /* New command specified. Check for a size specification.
121 * Defaults to long if no or incorrect specification.
123 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
126 /* Address is specified since argc > 1
128 addr = simple_strtoul(argv[1], NULL, 16);
129 addr += base_address;
131 /* If another parameter, it is the length to display.
132 * Length is the number of objects, not number of bytes.
135 length = simple_strtoul(argv[2], NULL, 16);
138 #if defined(CONFIG_HAS_DATAFLASH)
141 * We buffer all read data, so we can make sure data is read only
142 * once, and all accesses are with the specified bus width.
144 nbytes = length * size;
146 char linebuf[DISP_LINE_LEN];
148 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
150 rc = read_dataflash(addr, (linebytes/size)*size, linebuf);
151 p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr;
152 print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size);
160 } while (nbytes > 0);
162 /* Print the lines. */
163 print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size);
168 dp_last_length = length;
173 int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
175 return mod_mem (cmdtp, 1, flag, argc, argv);
177 int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
179 return mod_mem (cmdtp, 0, flag, argc, argv);
182 int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
184 ulong addr, writeval, count;
187 if ((argc < 3) || (argc > 4)) {
188 printf ("Usage:\n%s\n", cmdtp->usage);
192 /* Check for size specification.
194 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
197 /* Address is specified since argc > 1
199 addr = simple_strtoul(argv[1], NULL, 16);
200 addr += base_address;
202 /* Get the value to write.
204 writeval = simple_strtoul(argv[2], NULL, 16);
208 count = simple_strtoul(argv[3], NULL, 16);
213 while (count-- > 0) {
215 *((ulong *)addr) = (ulong )writeval;
217 *((ushort *)addr) = (ushort)writeval;
219 *((u_char *)addr) = (u_char)writeval;
225 #ifdef CONFIG_MX_CYCLIC
226 int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
232 printf ("Usage:\n%s\n", cmdtp->usage);
236 count = simple_strtoul(argv[3], NULL, 10);
239 do_mem_md (NULL, 0, 3, argv);
241 /* delay for <count> ms... */
242 for (i=0; i<count; i++)
245 /* check for ctrl-c to abort... */
255 int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
261 printf ("Usage:\n%s\n", cmdtp->usage);
265 count = simple_strtoul(argv[3], NULL, 10);
268 do_mem_mw (NULL, 0, 3, argv);
270 /* delay for <count> ms... */
271 for (i=0; i<count; i++)
274 /* check for ctrl-c to abort... */
283 #endif /* CONFIG_MX_CYCLIC */
285 int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
287 ulong addr1, addr2, count, ngood;
292 printf ("Usage:\n%s\n", cmdtp->usage);
296 /* Check for size specification.
298 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
301 addr1 = simple_strtoul(argv[1], NULL, 16);
302 addr1 += base_address;
304 addr2 = simple_strtoul(argv[2], NULL, 16);
305 addr2 += base_address;
307 count = simple_strtoul(argv[3], NULL, 16);
309 #ifdef CONFIG_HAS_DATAFLASH
310 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
311 puts ("Comparison with DataFlash space not supported.\n\r");
318 while (count-- > 0) {
320 ulong word1 = *(ulong *)addr1;
321 ulong word2 = *(ulong *)addr2;
322 if (word1 != word2) {
323 printf("word at 0x%08lx (0x%08lx) "
324 "!= word at 0x%08lx (0x%08lx)\n",
325 addr1, word1, addr2, word2);
330 else if (size == 2) {
331 ushort hword1 = *(ushort *)addr1;
332 ushort hword2 = *(ushort *)addr2;
333 if (hword1 != hword2) {
334 printf("halfword at 0x%08lx (0x%04x) "
335 "!= halfword at 0x%08lx (0x%04x)\n",
336 addr1, hword1, addr2, hword2);
342 u_char byte1 = *(u_char *)addr1;
343 u_char byte2 = *(u_char *)addr2;
344 if (byte1 != byte2) {
345 printf("byte at 0x%08lx (0x%02x) "
346 "!= byte at 0x%08lx (0x%02x)\n",
347 addr1, byte1, addr2, byte2);
357 printf("Total of %ld %s%s were the same\n",
358 ngood, size == 4 ? "word" : size == 2 ? "halfword" : "byte",
359 ngood == 1 ? "" : "s");
363 int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
365 ulong addr, dest, count;
369 printf ("Usage:\n%s\n", cmdtp->usage);
373 /* Check for size specification.
375 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
378 addr = simple_strtoul(argv[1], NULL, 16);
379 addr += base_address;
381 dest = simple_strtoul(argv[2], NULL, 16);
382 dest += base_address;
384 count = simple_strtoul(argv[3], NULL, 16);
387 puts ("Zero length ???\n");
392 /* check if we are copying to Flash */
393 if ( (addr2info(dest) != NULL)
394 #ifdef CONFIG_HAS_DATAFLASH
395 && (!addr_dataflash(addr))
400 puts ("Copy to Flash... ");
402 rc = flash_write ((char *)addr, dest, count*size);
412 #if (CONFIG_COMMANDS & CFG_CMD_MMC) || defined(CONFIG_CMD_MMC)
413 if (mmc2info(dest)) {
416 puts ("Copy to MMC... ");
417 switch (rc = mmc_write ((uchar *)addr, dest, count*size)) {
425 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
432 if (mmc2info(addr)) {
435 puts ("Copy from MMC... ");
436 switch (rc = mmc_read (addr, (uchar *)dest, count*size)) {
444 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
452 #ifdef CONFIG_HAS_DATAFLASH
453 /* Check if we are copying from RAM or Flash to DataFlash */
454 if (addr_dataflash(dest) && !addr_dataflash(addr)){
457 puts ("Copy to DataFlash... ");
459 rc = write_dataflash (dest, addr, count*size);
462 dataflash_perror (rc);
469 /* Check if we are copying from DataFlash to RAM */
470 if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){
472 rc = read_dataflash(addr, count * size, (char *) dest);
474 dataflash_perror (rc);
480 if (addr_dataflash(addr) && addr_dataflash(dest)){
481 puts ("Unsupported combination of source/destination.\n\r");
486 while (count-- > 0) {
488 *((ulong *)dest) = *((ulong *)addr);
490 *((ushort *)dest) = *((ushort *)addr);
492 *((u_char *)dest) = *((u_char *)addr);
499 int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
502 /* Set new base address.
504 base_address = simple_strtoul(argv[1], NULL, 16);
506 /* Print the current base address.
508 printf("Base Address: 0x%08lx\n", base_address);
512 int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
514 ulong addr, length, i, junk;
516 volatile uint *longp;
517 volatile ushort *shortp;
521 printf ("Usage:\n%s\n", cmdtp->usage);
525 /* Check for a size spefication.
526 * Defaults to long if no or incorrect specification.
528 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
531 /* Address is always specified.
533 addr = simple_strtoul(argv[1], NULL, 16);
535 /* Length is the number of objects, not number of bytes.
537 length = simple_strtoul(argv[2], NULL, 16);
539 /* We want to optimize the loops to run as fast as possible.
540 * If we have only one object, just run infinite loops.
544 longp = (uint *)addr;
549 shortp = (ushort *)addr;
560 longp = (uint *)addr;
568 shortp = (ushort *)addr;
583 int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
585 ulong addr, length, i, data;
587 volatile uint *longp;
588 volatile ushort *shortp;
592 printf ("Usage:\n%s\n", cmdtp->usage);
596 /* Check for a size spefication.
597 * Defaults to long if no or incorrect specification.
599 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
602 /* Address is always specified.
604 addr = simple_strtoul(argv[1], NULL, 16);
606 /* Length is the number of objects, not number of bytes.
608 length = simple_strtoul(argv[2], NULL, 16);
611 data = simple_strtoul(argv[3], NULL, 16);
613 /* We want to optimize the loops to run as fast as possible.
614 * If we have only one object, just run infinite loops.
618 longp = (uint *)addr;
623 shortp = (ushort *)addr;
634 longp = (uint *)addr;
642 shortp = (ushort *)addr;
655 #endif /* CONFIG_LOOPW */
658 * Perform a memory test. A more complete alternative test can be
659 * configured using CFG_ALT_MEMTEST. The complete test loops until
660 * interrupted by ctrl-c or by a failure of one of the sub-tests.
662 int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
664 vu_long *addr, *start, *end;
668 #if defined(CFG_ALT_MEMTEST)
674 vu_long anti_pattern;
676 #if defined(CFG_MEMTEST_SCRATCH)
677 vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
679 vu_long *dummy = 0; /* yes, this is address 0x0, not NULL */
684 static const ulong bitpattern[] = {
685 0x00000001, /* single bit */
686 0x00000003, /* two adjacent bits */
687 0x00000007, /* three adjacent bits */
688 0x0000000F, /* four adjacent bits */
689 0x00000005, /* two non-adjacent bits */
690 0x00000015, /* three non-adjacent bits */
691 0x00000055, /* four non-adjacent bits */
692 0xaaaaaaaa, /* alternating 1/0 */
701 start = (ulong *)simple_strtoul(argv[1], NULL, 16);
703 start = (ulong *)CFG_MEMTEST_START;
707 end = (ulong *)simple_strtoul(argv[2], NULL, 16);
709 end = (ulong *)(CFG_MEMTEST_END);
713 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
718 #if defined(CFG_ALT_MEMTEST)
719 printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
720 PRINTF("%s:%d: start 0x%p end 0x%p\n",
721 __FUNCTION__, __LINE__, start, end);
729 printf("Iteration: %6d\r", iterations);
730 PRINTF("Iteration: %6d\n", iterations);
734 * Data line test: write a pattern to the first
735 * location, write the 1's complement to a 'parking'
736 * address (changes the state of the data bus so a
737 * floating bus doen't give a false OK), and then
738 * read the value back. Note that we read it back
739 * into a variable because the next time we read it,
740 * it might be right (been there, tough to explain to
741 * the quality guys why it prints a failure when the
742 * "is" and "should be" are obviously the same in the
745 * Rather than exhaustively testing, we test some
746 * patterns by shifting '1' bits through a field of
747 * '0's and '0' bits through a field of '1's (i.e.
748 * pattern and ~pattern).
751 for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
753 for(; val != 0; val <<= 1) {
755 *dummy = ~val; /* clear the test data off of the bus */
757 if(readback != val) {
758 printf ("FAILURE (data line): "
759 "expected %08lx, actual %08lx\n",
765 if(readback != ~val) {
766 printf ("FAILURE (data line): "
767 "Is %08lx, should be %08lx\n",
774 * Based on code whose Original Author and Copyright
775 * information follows: Copyright (c) 1998 by Michael
776 * Barr. This software is placed into the public
777 * domain and may be used for any purpose. However,
778 * this notice must not be changed or removed and no
779 * warranty is either expressed or implied by its
780 * publication or distribution.
786 * Description: Test the address bus wiring in a
787 * memory region by performing a walking
788 * 1's test on the relevant bits of the
789 * address and checking for aliasing.
790 * This test will find single-bit
791 * address failures such as stuck -high,
792 * stuck-low, and shorted pins. The base
793 * address and size of the region are
794 * selected by the caller.
796 * Notes: For best results, the selected base
797 * address should have enough LSB 0's to
798 * guarantee single address bit changes.
799 * For example, to test a 64-Kbyte
800 * region, select a base address on a
801 * 64-Kbyte boundary. Also, select the
802 * region size as a power-of-two if at
805 * Returns: 0 if the test succeeds, 1 if the test fails.
807 * ## NOTE ## Be sure to specify start and end
808 * addresses such that addr_mask has
809 * lots of bits set. For example an
810 * address range of 01000000 02000000 is
811 * bad while a range of 01000000
812 * 01ffffff is perfect.
814 addr_mask = ((ulong)end - (ulong)start)/sizeof(vu_long);
815 pattern = (vu_long) 0xaaaaaaaa;
816 anti_pattern = (vu_long) 0x55555555;
818 PRINTF("%s:%d: addr mask = 0x%.8lx\n",
819 __FUNCTION__, __LINE__,
822 * Write the default pattern at each of the
823 * power-of-two offsets.
825 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
826 start[offset] = pattern;
830 * Check for address bits stuck high.
833 start[test_offset] = anti_pattern;
835 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
836 temp = start[offset];
837 if (temp != pattern) {
838 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
839 " expected 0x%.8lx, actual 0x%.8lx\n",
840 (ulong)&start[offset], pattern, temp);
844 start[test_offset] = pattern;
847 * Check for addr bits stuck low or shorted.
849 for (test_offset = 1; (test_offset & addr_mask) != 0; test_offset <<= 1) {
850 start[test_offset] = anti_pattern;
852 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
853 temp = start[offset];
854 if ((temp != pattern) && (offset != test_offset)) {
855 printf ("\nFAILURE: Address bit stuck low or shorted @"
856 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
857 (ulong)&start[offset], pattern, temp);
861 start[test_offset] = pattern;
865 * Description: Test the integrity of a physical
866 * memory device by performing an
867 * increment/decrement test over the
868 * entire region. In the process every
869 * storage bit in the device is tested
870 * as a zero and a one. The base address
871 * and the size of the region are
872 * selected by the caller.
874 * Returns: 0 if the test succeeds, 1 if the test fails.
876 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
879 * Fill memory with a known pattern.
881 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
882 start[offset] = pattern;
886 * Check each location and invert it for the second pass.
888 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
889 temp = start[offset];
890 if (temp != pattern) {
891 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
892 " expected 0x%.8lx, actual 0x%.8lx)\n",
893 (ulong)&start[offset], pattern, temp);
897 anti_pattern = ~pattern;
898 start[offset] = anti_pattern;
902 * Check each location for the inverted pattern and zero it.
904 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
905 anti_pattern = ~pattern;
906 temp = start[offset];
907 if (temp != anti_pattern) {
908 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
909 " expected 0x%.8lx, actual 0x%.8lx)\n",
910 (ulong)&start[offset], anti_pattern, temp);
917 #else /* The original, quickie test */
925 printf ("\rPattern %08lX Writing..."
927 "\b\b\b\b\b\b\b\b\b\b",
930 for (addr=start,val=pattern; addr<end; addr++) {
937 for (addr=start,val=pattern; addr<end; addr++) {
939 if (readback != val) {
940 printf ("\nMem error @ 0x%08X: "
941 "found %08lX, expected %08lX\n",
942 (uint)addr, readback, val);
949 * Flip the pattern each time to make lots of zeros and
950 * then, the next time, lots of ones. We decrement
951 * the "negative" patterns and increment the "positive"
952 * patterns to preserve this feature.
954 if(pattern & 0x80000000) {
955 pattern = -pattern; /* complement & increment */
970 * mm{.b, .w, .l} {addr}
971 * nm{.b, .w, .l} {addr}
974 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
978 extern char console_buffer[];
981 printf ("Usage:\n%s\n", cmdtp->usage);
985 #ifdef CONFIG_BOOT_RETRY_TIME
986 reset_cmd_timeout(); /* got a good command to get here */
988 /* We use the last specified parameters, unless new ones are
994 if ((flag & CMD_FLAG_REPEAT) == 0) {
995 /* New command specified. Check for a size specification.
996 * Defaults to long if no or incorrect specification.
998 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1001 /* Address is specified since argc > 1
1003 addr = simple_strtoul(argv[1], NULL, 16);
1004 addr += base_address;
1007 #ifdef CONFIG_HAS_DATAFLASH
1008 if (addr_dataflash(addr)){
1009 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
1014 /* Print the address, followed by value. Then accept input for
1015 * the next value. A non-converted value exits.
1018 printf("%08lx:", addr);
1020 printf(" %08x", *((uint *)addr));
1022 printf(" %04x", *((ushort *)addr));
1024 printf(" %02x", *((u_char *)addr));
1026 nbytes = readline (" ? ");
1027 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1028 /* <CR> pressed as only input, don't modify current
1029 * location and move to next. "-" pressed will go back.
1032 addr += nbytes ? -size : size;
1034 #ifdef CONFIG_BOOT_RETRY_TIME
1035 reset_cmd_timeout(); /* good enough to not time out */
1038 #ifdef CONFIG_BOOT_RETRY_TIME
1039 else if (nbytes == -2) {
1040 break; /* timed out, exit the command */
1045 i = simple_strtoul(console_buffer, &endp, 16);
1046 nbytes = endp - console_buffer;
1048 #ifdef CONFIG_BOOT_RETRY_TIME
1049 /* good enough to not time out
1051 reset_cmd_timeout();
1054 *((uint *)addr) = i;
1056 *((ushort *)addr) = i;
1058 *((u_char *)addr) = i;
1065 mm_last_addr = addr;
1066 mm_last_size = size;
1070 #ifndef CONFIG_CRC32_VERIFY
1072 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1079 printf ("Usage:\n%s\n", cmdtp->usage);
1083 addr = simple_strtoul (argv[1], NULL, 16);
1084 addr += base_address;
1086 length = simple_strtoul (argv[2], NULL, 16);
1088 crc = crc32 (0, (const uchar *) addr, length);
1090 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1091 addr, addr + length - 1, crc);
1094 ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
1101 #else /* CONFIG_CRC32_VERIFY */
1103 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1115 printf ("Usage:\n%s\n", cmdtp->usage);
1121 if (strcmp(*av, "-v") == 0) {
1130 addr = simple_strtoul(*av++, NULL, 16);
1131 addr += base_address;
1132 length = simple_strtoul(*av++, NULL, 16);
1134 crc = crc32(0, (const uchar *) addr, length);
1137 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1138 addr, addr + length - 1, crc);
1140 ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
1144 vcrc = simple_strtoul(*av++, NULL, 16);
1146 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1147 addr, addr + length - 1, crc, vcrc);
1155 #endif /* CONFIG_CRC32_VERIFY */
1157 /**************************************************/
1158 #if (CONFIG_COMMANDS & CFG_CMD_MEMORY) || defined(CONFIG_CMD_MEMORY)
1160 md, 3, 1, do_mem_md,
1161 "md - memory display\n",
1162 "[.b, .w, .l] address [# of objects]\n - memory display\n"
1167 mm, 2, 1, do_mem_mm,
1168 "mm - memory modify (auto-incrementing)\n",
1169 "[.b, .w, .l] address\n" " - memory modify, auto increment address\n"
1174 nm, 2, 1, do_mem_nm,
1175 "nm - memory modify (constant address)\n",
1176 "[.b, .w, .l] address\n - memory modify, read and keep address\n"
1180 mw, 4, 1, do_mem_mw,
1181 "mw - memory write (fill)\n",
1182 "[.b, .w, .l] address value [count]\n - write memory\n"
1186 cp, 4, 1, do_mem_cp,
1187 "cp - memory copy\n",
1188 "[.b, .w, .l] source target count\n - copy memory\n"
1192 cmp, 4, 1, do_mem_cmp,
1193 "cmp - memory compare\n",
1194 "[.b, .w, .l] addr1 addr2 count\n - compare memory\n"
1197 #ifndef CONFIG_CRC32_VERIFY
1200 crc32, 4, 1, do_mem_crc,
1201 "crc32 - checksum calculation\n",
1202 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1205 #else /* CONFIG_CRC32_VERIFY */
1208 crc32, 5, 1, do_mem_crc,
1209 "crc32 - checksum calculation\n",
1210 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1211 "-v address count crc\n - verify crc of memory area\n"
1214 #endif /* CONFIG_CRC32_VERIFY */
1217 base, 2, 1, do_mem_base,
1218 "base - print or set address offset\n",
1219 "\n - print address offset for memory commands\n"
1220 "base off\n - set address offset for memory commands to 'off'\n"
1224 loop, 3, 1, do_mem_loop,
1225 "loop - infinite loop on address range\n",
1226 "[.b, .w, .l] address number_of_objects\n"
1227 " - loop on a set of addresses\n"
1232 loopw, 4, 1, do_mem_loopw,
1233 "loopw - infinite write loop on address range\n",
1234 "[.b, .w, .l] address number_of_objects data_to_write\n"
1235 " - loop on a set of addresses\n"
1237 #endif /* CONFIG_LOOPW */
1240 mtest, 4, 1, do_mem_mtest,
1241 "mtest - simple RAM test\n",
1242 "[start [end [pattern]]]\n"
1243 " - simple RAM read/write test\n"
1246 #ifdef CONFIG_MX_CYCLIC
1248 mdc, 4, 1, do_mem_mdc,
1249 "mdc - memory display cyclic\n",
1250 "[.b, .w, .l] address count delay(ms)\n - memory display cyclic\n"
1254 mwc, 4, 1, do_mem_mwc,
1255 "mwc - memory write cyclic\n",
1256 "[.b, .w, .l] address value delay(ms)\n - memory write cyclic\n"
1258 #endif /* CONFIG_MX_CYCLIC */
1261 #endif /* CFG_CMD_MEMORY */