diff options
author | wdenk <wdenk> | 2004-03-14 15:20:55 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2004-03-14 15:20:55 +0000 |
commit | aaf224ab4ec400abefa17982cbd2ae995adc9978 (patch) | |
tree | 68a329c03bf5b31851c26a7bc6f48e6931fd6c82 /board/ssv/common/cmd_sled.c | |
parent | 3d3befa754fedb320f779320ac0ab11deb0a6275 (diff) | |
download | u-boot-imx-aaf224ab4ec400abefa17982cbd2ae995adc9978.zip u-boot-imx-aaf224ab4ec400abefa17982cbd2ae995adc9978.tar.gz u-boot-imx-aaf224ab4ec400abefa17982cbd2ae995adc9978.tar.bz2 |
* Patch by Stephan Linz, 09 Mar 2004
- Add support for the SSV ADNP/ESC1 (Nios Softcore)
* Patch by George G. Davis, 9 Mar 2004:
fix recent build failure for SA1100 target
* Patch by Travis Sawyer, 09 Mar 2004:
Support native interrupt mode for the IBM440GX.
Previously it was running in 440GP compatibility mode.
Diffstat (limited to 'board/ssv/common/cmd_sled.c')
-rw-r--r-- | board/ssv/common/cmd_sled.c | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/board/ssv/common/cmd_sled.c b/board/ssv/common/cmd_sled.c new file mode 100644 index 0000000..6ca054c --- /dev/null +++ b/board/ssv/common/cmd_sled.c @@ -0,0 +1,162 @@ +/* + * (C) Copyright 2004, Li-Pro.Net <www.li-pro.net> + * Stephan Linz <linz@li-pro.net> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <command.h> +#include <status_led.h> + +#if defined(CONFIG_STATUS_LED) + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !!!!! Q u i c k & D i r t y H a c k !!!!! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !!!!! !!!!! + * !!!!! Next type definition was coming from original !!!!! + * !!!!! status LED driver drivers/status_led.c and !!!!! + * !!!!! should exported for using here. !!!!! + * !!!!! !!!!! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +typedef struct { + led_id_t mask; + int state; + int period; + int cnt; +} led_dev_t; + +extern led_dev_t led_dev[]; + +#if (CONFIG_COMMANDS & CFG_CMD_BSP) +int do_sled (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +{ + int led_id = 0; + + if (argc > 1) { +#ifdef STATUS_LED_BOOT + if (!strcmp (argv[1], "boot")) { + led_id = STATUS_LED_BOOT + 1; + } +#endif +#ifdef STATUS_LED_RED + if (!strcmp (argv[1], "red")) { + led_id = STATUS_LED_RED + 1; + } +#endif +#ifdef STATUS_LED_YELLOW + if (!strcmp (argv[1], "yellow")) { + led_id = STATUS_LED_YELLOW + 1; + } +#endif +#ifdef STATUS_LED_GREEN + if (!strcmp (argv[1], "green")) { + led_id = STATUS_LED_GREEN + 1; + } +#endif + } + + switch (argc) { + case 1: +#if (STATUS_LED_BITS > 3) + for (; led_id < 4; led_id++) +#elif (STATUS_LED_BITS > 2) + for (; led_id < 3; led_id++) +#elif (STATUS_LED_BITS > 1) + for (; led_id < 2; led_id++) +#elif (STATUS_LED_BITS > 0) + for (; led_id < 1; led_id++) +#else +#error "*** STATUS_LED_BITS not correct defined ***" +#endif + { + printf ("Status LED '%s' is %s\n", + led_id == STATUS_LED_BOOT ? "boot" + : led_id == STATUS_LED_RED ? "red" + : led_id == STATUS_LED_YELLOW ? "yellow" + : led_id == + STATUS_LED_GREEN ? "green" : "unknown", + led_dev[led_id].state == + STATUS_LED_ON ? "on" : led_dev[led_id]. + state == + STATUS_LED_OFF ? "off" : led_dev[led_id]. + state == + STATUS_LED_BLINKING ? "blinking" : "unknown"); + } + return 0; + case 2: + if (led_id) { + printf ("Status LED '%s' is %s\n", argv[1], + led_dev[led_id - 1].state == + STATUS_LED_ON ? "on" : led_dev[led_id - + 1].state == + STATUS_LED_OFF ? "off" : led_dev[led_id - + 1].state == + STATUS_LED_BLINKING ? "blinking" : "unknown"); + return 0; + } else + break; + case 3: + if (led_id) { + if (!strcmp (argv[2], "on")) { + status_led_set (led_id - 1, STATUS_LED_ON); + return 0; + } else if (!strcmp (argv[2], "off")) { + status_led_set (led_id - 1, STATUS_LED_OFF); + return 0; + } else if (!strcmp (argv[2], "blink")) { + status_led_set (led_id - 1, + STATUS_LED_BLINKING); + return 0; + } else + break; + } else + break; + default: + break; + } + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; +} + +#ifdef STATUS_LED_BOOT +#ifdef STATUS_LED_RED +#ifdef STATUS_LED_YELLOW +#ifdef STATUS_LED_GREEN +#define __NAME_STR " - name: boot|red|yellow|green\n" +#else +#define __NAME_STR " - name: boot|red|yellow\n" +#endif +#else +#define __NAME_STR " - name: boot|red\n" +#endif +#else +#define __NAME_STR " - name: boot\n" +#endif +#else +#define __NAME_STR " - name: (no such defined)\n" +#endif + +U_BOOT_CMD (sled, 3, 0, do_sled, + "sled - check and set status led\n", + "sled [name [state]]\n" __NAME_STR " - state: on|off|blink\n"); +#endif /* CFG_CMD_BSP */ +#endif /* CONFIG_STATUS_LED */ |