[U-Boot] [PATCH] common: Iteration limit for memory test.

Wolfgang Denk wd at denx.de
Tue Dec 16 00:52:46 CET 2008


Dear Dirk Eibach,

In message <1229338818-4209-1-git-send-email-eibach at gdsys.de> you wrote:
> We want to use mtest for production memory test (though I know it is
> not recommended). I implemented an iteration limit, so expect can parse
> the results.

Do you really want to use this text as part of the commit message?
Maybe not.

> 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 <eibach at gdsys.de>
> ---
> 
>  - Modified original patch title "Added optional iteration limit for 
>    alternative  memory test."
>  - Iteration limit is now implemented for both original and alternative 
>    memory test.
> 
>  common/cmd_mem.c |   29 +++++++++++++++++++++++++----
>  1 files changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/common/cmd_mem.c b/common/cmd_mem.c
> index d7666c2..f87170c 100644
> --- a/common/cmd_mem.c
> +++ b/common/cmd_mem.c
> @@ -672,6 +672,8 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>  	ulong	val;
>  	ulong	readback;
>  	int     rcode = 0;
> +	int iterations = 1;
> +	int iteration_limit;
>  
>  #if defined(CONFIG_SYS_ALT_MEMTEST)
>  	vu_long	len;
> @@ -687,7 +689,6 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>  	vu_long *dummy = 0;	/* yes, this is address 0x0, not NULL */
>  #endif
>  	int	j;
> -	int iterations = 1;
>  
>  	static const ulong bitpattern[] = {
>  		0x00000001,	/* single bit */
> @@ -722,6 +723,12 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>  		pattern = 0;
>  	}
>  
> +	if (argc > 4) {
> +		iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16);
> +	} else {
> +		iteration_limit = 0;
> +	}

No braces for one-line commands, please.

>  		printf("Iteration: %6d\r", iterations);
>  		PRINTF("Iteration: %6d\n", iterations);

Seems we have some duplicated code here?

>  U_BOOT_CMD(
> -	mtest,	4,	1,	do_mem_mtest,
> -	"mtest	- simple RAM test\n",
> -	"[start [end [pattern]]]\n"
> +	mtest,    5,    1,     do_mem_mtest,

Please use here TABs for indentation, as in the original code.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If God wanted me to touch my toes, he'd have put them on my knees.


More information about the U-Boot mailing list