[U-Boot] [PATCH 3/3] digsy MTC: Add 'mtc' command.
Detlev Zundel
dzu at denx.de
Mon Jun 8 18:06:05 CEST 2009
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 at 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
More information about the U-Boot
mailing list