From: Dirk Eibach Date: Thu, 27 Nov 2008 14:17:45 +0100 Subject: [U-Boot] [PATCH] Added optional iteration limit for alternative memory test. Message-ID: <1227791865-8843-1-git-send-email-eibach@gdsys.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de We want to use mtest for production memory test. I implemented an iteration limit, so expect can parse the results. The iteration limit is passed to mtest as a fourth parameter: [start [end [pattern [iterations]]]] If no fourth parameter is supplied, there is no iteration limit and the test will loop forever. Signed-off-by: Dirk Eibach --- common/cmd_mem.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index d7666c2..c26e15d 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -674,6 +674,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int rcode = 0; #if defined(CONFIG_SYS_ALT_MEMTEST) + int iteration_limit; vu_long len; vu_long offset; vu_long test_offset; @@ -723,6 +724,12 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } #if defined(CONFIG_SYS_ALT_MEMTEST) + if (argc > 4) { + iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16); + } else { + iteration_limit = 0; + } + printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end); PRINTF("%s:%d: start 0x%p end 0x%p\n", __FUNCTION__, __LINE__, start, end); @@ -733,6 +740,12 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } + + if (iteration_limit && iterations > iteration_limit) { + printf("Tested %d iteration(s) without errors.\n", iterations-1); + return 0; + } + printf("Iteration: %6d\r", iterations); PRINTF("Iteration: %6d\n", iterations); iterations++; @@ -1277,9 +1290,15 @@ U_BOOT_CMD( #endif /* CONFIG_LOOPW */ U_BOOT_CMD( +#ifdef CONFIG_SYS_ALT_MEMTEST + mtest, 5, 1, do_mem_mtest, + "mtest - simple RAM test\n", + "[start [end [pattern [iterations]]]]\n" +#else mtest, 4, 1, do_mem_mtest, "mtest - simple RAM test\n", "[start [end [pattern]]]\n" +#endif /* CONFIG_SYS_ALT_MEMTEST */ " - simple RAM read/write test\n" ); -- 1.5.6.5