From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] digsy MTC: Add 'mtc' command.
Date: Mon, 08 Jun 2009 18:06:05 +0200 [thread overview]
Message-ID: <m2bpoy6782.fsf@ohwell.denx.de> (raw)
In-Reply-To: <1243416179-64368-3-git-send-email-gjb@semihalf.com> (Grzegorz Bernacki's message of "Wed, 27 May 2009 11:22:59 +0200")
Hi Grzegorz,
> New command allows to:
> o check FW version
> o set LED status
> o set digital output status
> o get digital input status
>
> Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
> ---
> board/digsy_mtc/Makefile | 2 +-
> board/digsy_mtc/cmd_mtc.c | 287 +++++++++++++++++++++++++++++++++++++++++++++
> board/digsy_mtc/cmd_mtc.h | 60 ++++++++++
> 3 files changed, 348 insertions(+), 1 deletions(-)
> create mode 100644 board/digsy_mtc/cmd_mtc.c
> create mode 100644 board/digsy_mtc/cmd_mtc.h
[...]
> +int cmd_mtc(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> +{
> + int err = 0;
> +
> + if (argc > 1) {
> + if (strncmp(argv[1], "led", 3) == 0)
> + err = subcmd_led(cmdtp, flag, argc, argv);
> + else if (strncmp(argv[1], "key", 3) == 0)
> + err = subcmd_key(cmdtp, flag, argc, argv);
> + else if (strncmp(argv[1], "version", 7) == 0)
> + err = subcmd_version(cmdtp, flag, argc, argv);
> + else if (strncmp(argv[1], "appreg", 6) == 0)
> + err = subcmd_appreg(cmdtp, flag, argc, argv);
> + else if (strncmp(argv[1], "digin", 5) == 0)
> + err = subcmd_digin(cmdtp, flag, argc, argv);
> + else if (strncmp(argv[1], "digout", 6) == 0)
> + err = subcmd_digout(cmdtp, flag, argc, argv);
> + else {
> + printf("Usage:\n%s\n", cmdtp->help);
> + err = 1;
> + }
> + } else {
> + printf("Usage:\n%s\n", cmdtp->help);
> + err = 1;
> + }
> +
> + return err;
> +}
Please use your own cmd_tblt_t to implement sub-commands re-using
existing infrastructure. Check board/inka4x0/inkadiag.c for an example.
Cheers
Detlev
--
X-Windows has to be the most expensive way ever of popping up an Emacs
window.
-- The UNIX Haters Handbook
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
next prev parent reply other threads:[~2009-06-08 16:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 9:22 [U-Boot] [PATCH 1/3] mpc52xx: Add SPI driver Grzegorz Bernacki
2009-05-27 9:22 ` [U-Boot] [PATCH 2/3] digsy MTC: Add SPI support Grzegorz Bernacki
2009-06-08 15:57 ` Detlev Zundel
2009-05-27 9:22 ` [U-Boot] [PATCH 3/3] digsy MTC: Add 'mtc' command Grzegorz Bernacki
2009-06-08 16:06 ` Detlev Zundel [this message]
2009-06-08 15:58 ` [U-Boot] [PATCH 1/3] mpc52xx: Add SPI driver Detlev Zundel
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=m2bpoy6782.fsf@ohwell.denx.de \
--to=dzu@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.