All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH]ppc_4xx:netstal/common define routines used by all boards
Date: Mon, 14 Jan 2008 21:16:24 +0100	[thread overview]
Message-ID: <20080114201624.F1291248DE@gemini.denx.de> (raw)
In-Reply-To: Your message of "Mon, 14 Jan 2008 15:26:09 +0100." <200801141526.09784.niklausgiger@gmx.ch>

In message <200801141526.09784.niklausgiger@gmx.ch> you wrote:
> Added some routines used by all Netstal boards  nm_show_print and
> common_misc_init_r and the very specific code to handle our SW installation
> procedure (set_params_for_sw_install).
> 
> Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>
> ---
>  board/netstal/common/nm_bsp.c |  131 ++++++++++++++++++++++++++++++++++++-----
>  1 files changed, 116 insertions(+), 15 deletions(-)
> 
> diff --git a/board/netstal/common/nm_bsp.c b/board/netstal/common/nm_bsp.c
> index a9de45e..2c1d483 100644
> --- a/board/netstal/common/nm_bsp.c
> +++ b/board/netstal/common/nm_bsp.c
> @@ -20,22 +20,123 @@
>  
>  #include <common.h>
>  #include <command.h>
> +#include <net.h>
>  
> -#ifdef CONFIG_CMD_BSP
> -/*
> - * Command nm_bsp: Netstal Maschinen BSP specific command
> - */
> -int nm_bsp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +#define DEFAULT_ETH_ADDR  "ethaddr"
> +
> +extern void hcu_led_set(u32 value);
> +extern u32 get_serial_number(void);
> +extern u32 hcu_get_slot(void);
> +
> +enum {
> +	/* HW_GENERATION_HCU1 is no longer supported */
> +	HW_GENERATION_HCU2  = 0x10,
> +	HW_GENERATION_HCU3  = 0x10,
> +	HW_GENERATION_HCU4  = 0x20,
> +	HW_GENERATION_HCU5  = 0x30,
> +	HW_GENERATION_MCU   = 0x08,
> +	HW_GENERATION_MCU20 = 0x0a,
> +	HW_GENERATION_MCU25 = 0x09,
> +};
> +
> +
> +void nm_show_print(int generation, int index, int hw_capabilities)
> +{
> +	int j;
> +	/* reset ANSI terminal color mode */
> +	printf ("\x1B""[0m""Netstal Maschinen AG: ");
> +	if (generation == HW_GENERATION_HCU3)
> +		printf("HCU3: index %d", index);
> +	else if (generation == HW_GENERATION_HCU4)
> +		printf("HCU4: index %d", index);
> +	else if (generation == HW_GENERATION_HCU5)
> +		printf("HCU5: index %d", index);
> +	else if (generation == HW_GENERATION_MCU25)
> +		printf("MCU25: index %d", index);

	else
		???
	
You probably want to do this in a loop over an array of structs
matching "generation" IDs with names - will become more readable and
less error prone. And eventually smaller code, too.

> +	}
> +
> +	/* IP-Adress update */
> +	{
> +		IPaddr_t ipaddr;
> +		char *ipstring;

Please don't do this. Declare the vaiable at entry into this funtion.

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
A direct quote from the Boss: "We passed over a lot of good people to
get the ones we hired."

      parent reply	other threads:[~2008-01-14 20:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-14 14:26 [U-Boot-Users] [PATCH]ppc_4xx:netstal/common define routines used by all boards Niklaus Giger
2008-01-14 15:05 ` Stefan Roese
2008-01-14 20:16 ` Wolfgang Denk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080114201624.F1291248DE@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.