CFG_CMD_ITEST | \
CFG_CMD_PCI | \
CMD_CMD_PORTIO) )
+
+DECLARE_GLOBAL_DATA_PTR;
+
/*
* Check for a size specification .b, .w or .l.
*/
* interrupted by ctrl-c or by a failure of one of the sub-tests.
*/
int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
+ bd_t *bd = gd->bd;
vu_long *addr, *start, *end;
ulong val;
ulong readback;
if(argc > 2){
end = (ulong *)simple_strtoul(argv[2], NULL, 16);
} else {
- end = (ulong *)(CFG_MEMTEST_END);
+ end = (ulong *)CFG_MEMTEST_END;
+ }
+
+ if((uint)start >= (uint)end){
+ puts("## Error: end address must be bigger than start address!\n");
+ return(1);
+ }
+
+ if(((uint)start < (uint)CFG_MEMTEST_START) || ((uint)end > (uint)CFG_MEMTEST_END)){
+ printf("## Error: start and end addresses should be in 0x%08X...0x%08X range!\n", (uint)CFG_MEMTEST_START, (uint)CFG_MEMTEST_END);
+ return(1);
}
+#if !defined(CFG_ALT_MEMTEST)
if(argc > 3){
pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
} else {
pattern = 0;
}
+#endif
#if defined(CFG_ALT_MEMTEST)
printf("Testing RAM 0x%08X...0x%08X:\n", (uint)start, (uint)end);
U_BOOT_CMD(mm, 2, 1, do_mem_mm, "memory modify (auto-incrementing)\n", "[.b, .w, .l] address\n\t- memory modify, auto increment address\n");
U_BOOT_CMD(nm, 2, 1, do_mem_nm, "memory modify (constant address)\n", "[.b, .w, .l] address\n\t- memory modify, read and keep address\n");
U_BOOT_CMD(mw, 4, 1, do_mem_mw, "memory write (fill)\n", "[.b, .w, .l] address value [count]\n\t- write memory\n");
+#if defined(CFG_ALT_MEMTEST)
+U_BOOT_CMD(mtest, 3, 1, do_mem_mtest, "RAM test\n", "[start [end]]\n\t- complete, alternative RAM test\n");
+#else
U_BOOT_CMD(mtest, 4, 1, do_mem_mtest, "simple RAM test\n", "[start [end [pattern]]]\n\t- simple RAM read/write test\n");
+#endif
U_BOOT_CMD(cp, 4, 1, do_mem_cp, "memory copy\n", "[.b, .w, .l] source target count\n\t- copy memory\n");
#endif /* CFG_CMD_MEMORY */
* Miscellaneous configurable options
*/
#define CFG_ALT_MEMTEST
-#define CFG_LONGHELP /* undef to save memory */
-#define CFG_PROMPT "uboot> " /* Monitor Command Prompt */
-#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
-#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size, was: def + 16 */
-#define CFG_MAXARGS 16 /* max number of command */
-#define CFG_MALLOC_LEN 512*1024 // def: 128*1024
-#define CFG_BOOTPARAMS_LEN 512*1024 // def: 128
-#define CFG_SDRAM_BASE 0x80000000 /* Cached addr */
-#define CFG_MEMTEST_START 0x80200000
-#define CFG_MEMTEST_END 0x83800000
+#define CFG_LONGHELP /* undef to save memory */
+#define CFG_PROMPT "uboot> " /* Monitor Command Prompt */
+#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
+#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size, was: def + 16 */
+#define CFG_MAXARGS 16 /* max number of command */
+#define CFG_MALLOC_LEN 512*1024 /* def: 128*1024 */
+#define CFG_BOOTPARAMS_LEN 512*1024 /* def: 128 */
+#define CFG_SDRAM_BASE 0x80000000 /* Cached addr */
+#define CFG_MEMTEST_START (CFG_SDRAM_BASE + 0x200000) /* RAM test start = CFG_SDRAM_BASE + 2 MB */
+#define CFG_MEMTEST_END (CFG_SDRAM_BASE + bd->bi_memsize - 0x200001) /* RAM test end = CFG_SDRAM_BASE + RAM size - 2 MB - 1 Byte */
#define CFG_RX_ETH_BUFFER 16
#if defined(CONFIG_SILENT_CONSOLE)