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)
35 #ifdef CONFIG_HAS_DATAFLASH
36 #include <dataflash.h>
39 #if (CONFIG_COMMANDS & (CFG_CMD_MEMORY | \
44 int cmd_get_data_size(char* arg, int default_size)
46 /* Check for a size specification .b, .w or .l.
48 int len = strlen(arg);
49 if (len > 2 && arg[len-2] == '.') {
67 #if (CONFIG_COMMANDS & CFG_CMD_MEMORY)
70 #define PRINTF(fmt,args...) printf (fmt ,##args)
72 #define PRINTF(fmt,args...)
75 static int mod_mem(cmd_tbl_t *, int, int, int, char *[]);
77 /* Display values from last command.
78 * Memory modify remembered values are different from display memory.
80 uint dp_last_addr, dp_last_size;
81 uint dp_last_length = 0x40;
82 uint mm_last_addr, mm_last_size;
84 static ulong base_address = 0;
89 * md{.b, .w, .l} {addr} {len}
91 #define DISP_LINE_LEN 16
92 int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
95 ulong i, nbytes, linebytes;
100 /* We use the last specified parameters, unless new ones are
105 length = dp_last_length;
108 printf ("Usage:\n%s\n", cmdtp->usage);
112 if ((flag & CMD_FLAG_REPEAT) == 0) {
113 /* New command specified. Check for a size specification.
114 * Defaults to long if no or incorrect specification.
116 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
119 /* Address is specified since argc > 1
121 addr = simple_strtoul(argv[1], NULL, 16);
122 addr += base_address;
124 /* If another parameter, it is the length to display.
125 * Length is the number of objects, not number of bytes.
128 length = simple_strtoul(argv[2], NULL, 16);
133 * We buffer all read data, so we can make sure data is read only
134 * once, and all accesses are with the specified bus width.
136 nbytes = length * size;
138 char linebuf[DISP_LINE_LEN];
139 uint *uip = (uint *)linebuf;
140 ushort *usp = (ushort *)linebuf;
141 u_char *ucp = (u_char *)linebuf;
142 #ifdef CONFIG_HAS_DATAFLASH
145 printf("%08lx:", addr);
146 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
148 #ifdef CONFIG_HAS_DATAFLASH
149 if ((rc = read_dataflash(addr, (linebytes/size)*size, linebuf)) == DATAFLASH_OK){
150 /* if outside dataflash */
152 dataflash_perror (rc);
155 for (i=0; i<linebytes; i+= size) {
157 printf(" %08x", *uip++);
158 } else if (size == 2) {
159 printf(" %04x", *usp++);
161 printf(" %02x", *ucp++);
166 } else { /* addr does not correspond to DataFlash */
168 for (i=0; i<linebytes; i+= size) {
170 printf(" %08x", (*uip++ = *((uint *)addr)));
171 } else if (size == 2) {
172 printf(" %04x", (*usp++ = *((ushort *)addr)));
174 printf(" %02x", (*ucp++ = *((u_char *)addr)));
178 #ifdef CONFIG_HAS_DATAFLASH
183 for (i=0; i<linebytes; i++) {
184 if ((*cp < 0x20) || (*cp > 0x7e))
196 } while (nbytes > 0);
199 dp_last_length = length;
204 int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
206 return mod_mem (cmdtp, 1, flag, argc, argv);
208 int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
210 return mod_mem (cmdtp, 0, flag, argc, argv);
213 int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
215 ulong addr, writeval, count;
218 if ((argc < 3) || (argc > 4)) {
219 printf ("Usage:\n%s\n", cmdtp->usage);
223 /* Check for size specification.
225 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
228 /* Address is specified since argc > 1
230 addr = simple_strtoul(argv[1], NULL, 16);
231 addr += base_address;
233 /* Get the value to write.
235 writeval = simple_strtoul(argv[2], NULL, 16);
239 count = simple_strtoul(argv[3], NULL, 16);
244 while (count-- > 0) {
246 *((ulong *)addr) = (ulong )writeval;
248 *((ushort *)addr) = (ushort)writeval;
250 *((u_char *)addr) = (u_char)writeval;
256 #ifdef CONFIG_MX_CYCLIC
257 int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
263 printf ("Usage:\n%s\n", cmdtp->usage);
267 count = simple_strtoul(argv[3], NULL, 10);
270 do_mem_md (NULL, 0, 3, argv);
272 /* delay for <count> ms... */
273 for (i=0; i<count; i++)
276 /* check for ctrl-c to abort... */
286 int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
292 printf ("Usage:\n%s\n", cmdtp->usage);
296 count = simple_strtoul(argv[3], NULL, 10);
299 do_mem_mw (NULL, 0, 3, argv);
301 /* delay for <count> ms... */
302 for (i=0; i<count; i++)
305 /* check for ctrl-c to abort... */
314 #endif /* CONFIG_MX_CYCLIC */
316 int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
318 ulong addr1, addr2, count, ngood;
323 printf ("Usage:\n%s\n", cmdtp->usage);
327 /* Check for size specification.
329 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
332 addr1 = simple_strtoul(argv[1], NULL, 16);
333 addr1 += base_address;
335 addr2 = simple_strtoul(argv[2], NULL, 16);
336 addr2 += base_address;
338 count = simple_strtoul(argv[3], NULL, 16);
340 #ifdef CONFIG_HAS_DATAFLASH
341 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
342 puts ("Comparison with DataFlash space not supported.\n\r");
349 while (count-- > 0) {
351 ulong word1 = *(ulong *)addr1;
352 ulong word2 = *(ulong *)addr2;
353 if (word1 != word2) {
354 printf("word at 0x%08lx (0x%08lx) "
355 "!= word at 0x%08lx (0x%08lx)\n",
356 addr1, word1, addr2, word2);
361 else if (size == 2) {
362 ushort hword1 = *(ushort *)addr1;
363 ushort hword2 = *(ushort *)addr2;
364 if (hword1 != hword2) {
365 printf("halfword at 0x%08lx (0x%04x) "
366 "!= halfword at 0x%08lx (0x%04x)\n",
367 addr1, hword1, addr2, hword2);
373 u_char byte1 = *(u_char *)addr1;
374 u_char byte2 = *(u_char *)addr2;
375 if (byte1 != byte2) {
376 printf("byte at 0x%08lx (0x%02x) "
377 "!= byte at 0x%08lx (0x%02x)\n",
378 addr1, byte1, addr2, byte2);
388 printf("Total of %ld %s%s were the same\n",
389 ngood, size == 4 ? "word" : size == 2 ? "halfword" : "byte",
390 ngood == 1 ? "" : "s");
394 int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
396 ulong addr, dest, count;
400 printf ("Usage:\n%s\n", cmdtp->usage);
404 /* Check for size specification.
406 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
409 addr = simple_strtoul(argv[1], NULL, 16);
410 addr += base_address;
412 dest = simple_strtoul(argv[2], NULL, 16);
413 dest += base_address;
415 count = simple_strtoul(argv[3], NULL, 16);
418 puts ("Zero length ???\n");
423 /* check if we are copying to Flash */
424 if ( (addr2info(dest) != NULL)
425 #ifdef CONFIG_HAS_DATAFLASH
426 && (!addr_dataflash(addr))
431 puts ("Copy to Flash... ");
433 rc = flash_write ((uchar *)addr, dest, count*size);
443 #if (CONFIG_COMMANDS & CFG_CMD_MMC)
444 if (mmc2info(dest)) {
447 puts ("Copy to MMC... ");
448 switch (rc = mmc_write ((uchar *)addr, dest, count*size)) {
456 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
463 if (mmc2info(addr)) {
466 puts ("Copy from MMC... ");
467 switch (rc = mmc_read (addr, (uchar *)dest, count*size)) {
475 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
483 #ifdef CONFIG_HAS_DATAFLASH
484 /* Check if we are copying from RAM or Flash to DataFlash */
485 if (addr_dataflash(dest) && !addr_dataflash(addr)){
488 puts ("Copy to DataFlash... ");
490 rc = write_dataflash (dest, addr, count*size);
493 dataflash_perror (rc);
500 /* Check if we are copying from DataFlash to RAM */
501 if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){
503 rc = read_dataflash(addr, count * size, (char *) dest);
505 dataflash_perror (rc);
511 if (addr_dataflash(addr) && addr_dataflash(dest)){
512 puts ("Unsupported combination of source/destination.\n\r");
517 while (count-- > 0) {
519 *((ulong *)dest) = *((ulong *)addr);
521 *((ushort *)dest) = *((ushort *)addr);
523 *((u_char *)dest) = *((u_char *)addr);
530 int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
533 /* Set new base address.
535 base_address = simple_strtoul(argv[1], NULL, 16);
537 /* Print the current base address.
539 printf("Base Address: 0x%08lx\n", base_address);
543 int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
545 ulong addr, length, i, junk;
547 volatile uint *longp;
548 volatile ushort *shortp;
552 printf ("Usage:\n%s\n", cmdtp->usage);
556 /* Check for a size spefication.
557 * Defaults to long if no or incorrect specification.
559 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
562 /* Address is always specified.
564 addr = simple_strtoul(argv[1], NULL, 16);
566 /* Length is the number of objects, not number of bytes.
568 length = simple_strtoul(argv[2], NULL, 16);
570 /* We want to optimize the loops to run as fast as possible.
571 * If we have only one object, just run infinite loops.
575 longp = (uint *)addr;
580 shortp = (ushort *)addr;
591 longp = (uint *)addr;
599 shortp = (ushort *)addr;
614 int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
616 ulong addr, length, i, data;
618 volatile uint *longp;
619 volatile ushort *shortp;
623 printf ("Usage:\n%s\n", cmdtp->usage);
627 /* Check for a size spefication.
628 * Defaults to long if no or incorrect specification.
630 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
633 /* Address is always specified.
635 addr = simple_strtoul(argv[1], NULL, 16);
637 /* Length is the number of objects, not number of bytes.
639 length = simple_strtoul(argv[2], NULL, 16);
642 data = simple_strtoul(argv[3], NULL, 16);
644 /* We want to optimize the loops to run as fast as possible.
645 * If we have only one object, just run infinite loops.
649 longp = (uint *)addr;
654 shortp = (ushort *)addr;
665 longp = (uint *)addr;
673 shortp = (ushort *)addr;
686 #endif /* CONFIG_LOOPW */
689 * Perform a memory test. A more complete alternative test can be
690 * configured using CFG_ALT_MEMTEST. The complete test loops until
691 * interrupted by ctrl-c or by a failure of one of the sub-tests.
693 int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
695 vu_long *addr, *start, *end;
699 #if defined(CFG_ALT_MEMTEST)
705 vu_long anti_pattern;
707 #if defined(CFG_MEMTEST_SCRATCH)
708 vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
710 vu_long *dummy = NULL;
715 static const ulong bitpattern[] = {
716 0x00000001, /* single bit */
717 0x00000003, /* two adjacent bits */
718 0x00000007, /* three adjacent bits */
719 0x0000000F, /* four adjacent bits */
720 0x00000005, /* two non-adjacent bits */
721 0x00000015, /* three non-adjacent bits */
722 0x00000055, /* four non-adjacent bits */
723 0xaaaaaaaa, /* alternating 1/0 */
732 start = (ulong *)simple_strtoul(argv[1], NULL, 16);
734 start = (ulong *)CFG_MEMTEST_START;
738 end = (ulong *)simple_strtoul(argv[2], NULL, 16);
740 end = (ulong *)(CFG_MEMTEST_END);
744 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
749 #if defined(CFG_ALT_MEMTEST)
750 printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
751 PRINTF("%s:%d: start 0x%p end 0x%p\n",
752 __FUNCTION__, __LINE__, start, end);
760 printf("Iteration: %6d\r", iterations);
761 PRINTF("Iteration: %6d\n", iterations);
765 * Data line test: write a pattern to the first
766 * location, write the 1's complement to a 'parking'
767 * address (changes the state of the data bus so a
768 * floating bus doen't give a false OK), and then
769 * read the value back. Note that we read it back
770 * into a variable because the next time we read it,
771 * it might be right (been there, tough to explain to
772 * the quality guys why it prints a failure when the
773 * "is" and "should be" are obviously the same in the
776 * Rather than exhaustively testing, we test some
777 * patterns by shifting '1' bits through a field of
778 * '0's and '0' bits through a field of '1's (i.e.
779 * pattern and ~pattern).
782 for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
784 for(; val != 0; val <<= 1) {
786 *dummy = ~val; /* clear the test data off of the bus */
788 if(readback != val) {
789 printf ("FAILURE (data line): "
790 "expected %08lx, actual %08lx\n",
796 if(readback != ~val) {
797 printf ("FAILURE (data line): "
798 "Is %08lx, should be %08lx\n",
805 * Based on code whose Original Author and Copyright
806 * information follows: Copyright (c) 1998 by Michael
807 * Barr. This software is placed into the public
808 * domain and may be used for any purpose. However,
809 * this notice must not be changed or removed and no
810 * warranty is either expressed or implied by its
811 * publication or distribution.
817 * Description: Test the address bus wiring in a
818 * memory region by performing a walking
819 * 1's test on the relevant bits of the
820 * address and checking for aliasing.
821 * This test will find single-bit
822 * address failures such as stuck -high,
823 * stuck-low, and shorted pins. The base
824 * address and size of the region are
825 * selected by the caller.
827 * Notes: For best results, the selected base
828 * address should have enough LSB 0's to
829 * guarantee single address bit changes.
830 * For example, to test a 64-Kbyte
831 * region, select a base address on a
832 * 64-Kbyte boundary. Also, select the
833 * region size as a power-of-two if at
836 * Returns: 0 if the test succeeds, 1 if the test fails.
838 * ## NOTE ## Be sure to specify start and end
839 * addresses such that addr_mask has
840 * lots of bits set. For example an
841 * address range of 01000000 02000000 is
842 * bad while a range of 01000000
843 * 01ffffff is perfect.
845 addr_mask = ((ulong)end - (ulong)start)/sizeof(vu_long);
846 pattern = (vu_long) 0xaaaaaaaa;
847 anti_pattern = (vu_long) 0x55555555;
849 PRINTF("%s:%d: addr mask = 0x%.8lx\n",
850 __FUNCTION__, __LINE__,
853 * Write the default pattern at each of the
854 * power-of-two offsets.
856 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
857 start[offset] = pattern;
861 * Check for address bits stuck high.
864 start[test_offset] = anti_pattern;
866 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
867 temp = start[offset];
868 if (temp != pattern) {
869 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
870 " expected 0x%.8lx, actual 0x%.8lx\n",
871 (ulong)&start[offset], pattern, temp);
875 start[test_offset] = pattern;
878 * Check for addr bits stuck low or shorted.
880 for (test_offset = 1; (test_offset & addr_mask) != 0; test_offset <<= 1) {
881 start[test_offset] = anti_pattern;
883 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
884 temp = start[offset];
885 if ((temp != pattern) && (offset != test_offset)) {
886 printf ("\nFAILURE: Address bit stuck low or shorted @"
887 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
888 (ulong)&start[offset], pattern, temp);
892 start[test_offset] = pattern;
896 * Description: Test the integrity of a physical
897 * memory device by performing an
898 * increment/decrement test over the
899 * entire region. In the process every
900 * storage bit in the device is tested
901 * as a zero and a one. The base address
902 * and the size of the region are
903 * selected by the caller.
905 * Returns: 0 if the test succeeds, 1 if the test fails.
907 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
910 * Fill memory with a known pattern.
912 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
913 start[offset] = pattern;
917 * Check each location and invert it for the second pass.
919 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
920 temp = start[offset];
921 if (temp != pattern) {
922 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
923 " expected 0x%.8lx, actual 0x%.8lx)\n",
924 (ulong)&start[offset], pattern, temp);
928 anti_pattern = ~pattern;
929 start[offset] = anti_pattern;
933 * Check each location for the inverted pattern and zero it.
935 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
936 anti_pattern = ~pattern;
937 temp = start[offset];
938 if (temp != anti_pattern) {
939 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
940 " expected 0x%.8lx, actual 0x%.8lx)\n",
941 (ulong)&start[offset], anti_pattern, temp);
948 #else /* The original, quickie test */
956 printf ("\rPattern %08lX Writing..."
958 "\b\b\b\b\b\b\b\b\b\b",
961 for (addr=start,val=pattern; addr<end; addr++) {
968 for (addr=start,val=pattern; addr<end; addr++) {
970 if (readback != val) {
971 printf ("\nMem error @ 0x%08X: "
972 "found %08lX, expected %08lX\n",
973 (uint)addr, readback, val);
980 * Flip the pattern each time to make lots of zeros and
981 * then, the next time, lots of ones. We decrement
982 * the "negative" patterns and increment the "positive"
983 * patterns to preserve this feature.
985 if(pattern & 0x80000000) {
986 pattern = -pattern; /* complement & increment */
1001 * mm{.b, .w, .l} {addr}
1002 * nm{.b, .w, .l} {addr}
1005 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
1009 extern char console_buffer[];
1012 printf ("Usage:\n%s\n", cmdtp->usage);
1016 #ifdef CONFIG_BOOT_RETRY_TIME
1017 reset_cmd_timeout(); /* got a good command to get here */
1019 /* We use the last specified parameters, unless new ones are
1022 addr = mm_last_addr;
1023 size = mm_last_size;
1025 if ((flag & CMD_FLAG_REPEAT) == 0) {
1026 /* New command specified. Check for a size specification.
1027 * Defaults to long if no or incorrect specification.
1029 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1032 /* Address is specified since argc > 1
1034 addr = simple_strtoul(argv[1], NULL, 16);
1035 addr += base_address;
1038 #ifdef CONFIG_HAS_DATAFLASH
1039 if (addr_dataflash(addr)){
1040 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
1045 /* Print the address, followed by value. Then accept input for
1046 * the next value. A non-converted value exits.
1049 printf("%08lx:", addr);
1051 printf(" %08x", *((uint *)addr));
1053 printf(" %04x", *((ushort *)addr));
1055 printf(" %02x", *((u_char *)addr));
1057 nbytes = readline (" ? ");
1058 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1059 /* <CR> pressed as only input, don't modify current
1060 * location and move to next. "-" pressed will go back.
1063 addr += nbytes ? -size : size;
1065 #ifdef CONFIG_BOOT_RETRY_TIME
1066 reset_cmd_timeout(); /* good enough to not time out */
1069 #ifdef CONFIG_BOOT_RETRY_TIME
1070 else if (nbytes == -2) {
1071 break; /* timed out, exit the command */
1076 i = simple_strtoul(console_buffer, &endp, 16);
1077 nbytes = endp - console_buffer;
1079 #ifdef CONFIG_BOOT_RETRY_TIME
1080 /* good enough to not time out
1082 reset_cmd_timeout();
1085 *((uint *)addr) = i;
1087 *((ushort *)addr) = i;
1089 *((u_char *)addr) = i;
1096 mm_last_addr = addr;
1097 mm_last_size = size;
1101 #ifndef CONFIG_CRC32_VERIFY
1103 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1110 printf ("Usage:\n%s\n", cmdtp->usage);
1114 addr = simple_strtoul (argv[1], NULL, 16);
1115 addr += base_address;
1117 length = simple_strtoul (argv[2], NULL, 16);
1119 crc = crc32 (0, (const uchar *) addr, length);
1121 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1122 addr, addr + length - 1, crc);
1125 ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
1132 #else /* CONFIG_CRC32_VERIFY */
1134 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1146 printf ("Usage:\n%s\n", cmdtp->usage);
1152 if (strcmp(*av, "-v") == 0) {
1161 addr = simple_strtoul(*av++, NULL, 16);
1162 addr += base_address;
1163 length = simple_strtoul(*av++, NULL, 16);
1165 crc = crc32(0, (const uchar *) addr, length);
1168 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1169 addr, addr + length - 1, crc);
1171 ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
1175 vcrc = simple_strtoul(*av++, NULL, 16);
1177 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1178 addr, addr + length - 1, crc, vcrc);
1186 #endif /* CONFIG_CRC32_VERIFY */
1188 /**************************************************/
1189 #if (CONFIG_COMMANDS & CFG_CMD_MEMORY)
1191 md, 3, 1, do_mem_md,
1192 "md - memory display\n",
1193 "[.b, .w, .l] address [# of objects]\n - memory display\n"
1198 mm, 2, 1, do_mem_mm,
1199 "mm - memory modify (auto-incrementing)\n",
1200 "[.b, .w, .l] address\n" " - memory modify, auto increment address\n"
1205 nm, 2, 1, do_mem_nm,
1206 "nm - memory modify (constant address)\n",
1207 "[.b, .w, .l] address\n - memory modify, read and keep address\n"
1211 mw, 4, 1, do_mem_mw,
1212 "mw - memory write (fill)\n",
1213 "[.b, .w, .l] address value [count]\n - write memory\n"
1217 cp, 4, 1, do_mem_cp,
1218 "cp - memory copy\n",
1219 "[.b, .w, .l] source target count\n - copy memory\n"
1223 cmp, 4, 1, do_mem_cmp,
1224 "cmp - memory compare\n",
1225 "[.b, .w, .l] addr1 addr2 count\n - compare memory\n"
1228 #ifndef CONFIG_CRC32_VERIFY
1231 crc32, 4, 1, do_mem_crc,
1232 "crc32 - checksum calculation\n",
1233 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1236 #else /* CONFIG_CRC32_VERIFY */
1239 crc32, 5, 1, do_mem_crc,
1240 "crc32 - checksum calculation\n",
1241 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1242 "-v address count crc\n - verify crc of memory area\n"
1245 #endif /* CONFIG_CRC32_VERIFY */
1248 base, 2, 1, do_mem_base,
1249 "base - print or set address offset\n",
1250 "\n - print address offset for memory commands\n"
1251 "base off\n - set address offset for memory commands to 'off'\n"
1255 loop, 3, 1, do_mem_loop,
1256 "loop - infinite loop on address range\n",
1257 "[.b, .w, .l] address number_of_objects\n"
1258 " - loop on a set of addresses\n"
1263 loopw, 4, 1, do_mem_loopw,
1264 "loopw - infinite write loop on address range\n",
1265 "[.b, .w, .l] address number_of_objects data_to_write\n"
1266 " - loop on a set of addresses\n"
1268 #endif /* CONFIG_LOOPW */
1271 mtest, 4, 1, do_mem_mtest,
1272 "mtest - simple RAM test\n",
1273 "[start [end [pattern]]]\n"
1274 " - simple RAM read/write test\n"
1277 #ifdef CONFIG_MX_CYCLIC
1279 mdc, 4, 1, do_mem_mdc,
1280 "mdc - memory display cyclic\n",
1281 "[.b, .w, .l] address count delay(ms)\n - memory display cyclic\n"
1285 mwc, 4, 1, do_mem_mwc,
1286 "mwc - memory write cyclic\n",
1287 "[.b, .w, .l] address value delay(ms)\n - memory write cyclic\n"
1289 #endif /* CONFIG_MX_CYCLIC */
1292 #endif /* CFG_CMD_MEMORY */