3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * Command Processor Table
30 #include <cmd_cache.h>
33 #include <cmd_flash.h>
34 #include <cmd_bootm.h>
36 #include <cmd_nvedit.h>
41 #include <cmd_console.h>
42 #include <cmd_reginfo.h>
43 #include <cmd_pcmcia.h>
44 #include <cmd_autoscript.h>
47 #include <cmd_eeprom.h>
50 #include <cmd_immap.h>
54 #include <cmd_fdc.h> /* Floppy support */
55 #include <cmd_usb.h> /* USB support */
59 #include <cmd_dcr.h> /* 4xx DCR register access */
62 #include <cmd_jffs2.h>
65 #include <cmd_bsp.h> /* board special functions */
67 #include <cmd_bedbug.h>
72 #include <cmd_vfd.h> /* load a bitmap to the VFDs on TRAB */
76 #include <cmd_portio.h>
80 #ifdef CONFIG_AMIGAONEG3SE
82 #include <cmd_boota.h>
88 #define CMD_TBL_HELP MK_CMD_TBL_ENTRY( \
89 "help", 1, CFG_MAXARGS, 1, do_help, \
90 "help - print online help\n", \
92 " - show help information (for 'command')\n" \
93 "'help' prints online help for the monitor commands.\n\n" \
94 "Without arguments, it prints a short usage message for all commands.\n\n" \
95 "To get detailed help information for specific commands you can type\n" \
96 "'help' with one or more command names as arguments.\n" \
99 #define CMD_TBL_QUES MK_CMD_TBL_ENTRY( \
100 "?", 1, CFG_MAXARGS, 1, do_help, \
101 "? - alias for 'help'\n", \
105 #define CMD_TBL_VERS MK_CMD_TBL_ENTRY( \
106 "version", 4, 1, 1, do_version, \
107 "version - print monitor version\n", \
111 #define CMD_TBL_ECHO MK_CMD_TBL_ENTRY( \
112 "echo", 4, CFG_MAXARGS, 1, do_echo, \
113 "echo - echo args to console\n", \
115 " - echo args to console; \\c suppresses newline\n" \
119 do_version (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
121 extern char version_string[];
122 printf ("\n%s\n", version_string);
127 do_echo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
131 for (i = 1; i < argc; i++) {
132 char *p = argv[i], c;
136 while ((c = *p++) != '\0') {
137 if (c == '\\' && *p == 'c') {
152 * Use puts() instead of printf() to avoid printf buffer overflow
153 * for long help messages
156 do_help (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
161 if (argc == 1) { /* print short help (usage) */
163 for (cmdtp=&cmd_tbl[0]; cmdtp->name; cmdtp++) {
164 /* allow user abort */
168 if (cmdtp->usage == NULL)
177 * command help (long version)
179 for (i=1; i<argc; ++i) {
180 if ((cmdtp = find_cmd(argv[i])) != NULL) {
182 /* found - print (long) help info */
188 puts ("- No help available.\n");
192 #else /* no long help available */
195 #endif /* CFG_LONGHELP */
197 printf ("Unknown command '%s' - try 'help'"
198 " without arguments for list of all"
199 " known commands\n\n",
208 /***************************************************************************
209 * find command table entry for a command
211 cmd_tbl_t *find_cmd(const char *cmd)
215 /* Search command table - Use linear search - it's a small table */
216 for (cmdtp = &cmd_tbl[0]; cmdtp->name; cmdtp++) {
217 if (strncmp (cmd, cmdtp->name, cmdtp->lmin) == 0)
220 return NULL; /* not found */
224 * The commands in this table are sorted alphabetically by the
225 * command name and in descending order by the command name string
226 * length. This is to prevent conflicts in command name parsing.
227 * Please ensure that new commands are added according to that rule.
228 * Please use $(TOPDIR)/doc/README.commands as a reference AND make
229 * sure it gets updated.
232 cmd_tbl_t cmd_tbl[] = {
239 #ifdef CONFIG_AMIGAONEG3SE
311 #ifdef CONFIG_AMIGAONEG3SE
344 CMD_TBL_MISC /* sleep */
356 CMD_TBL_QUES /* keep this ("help") the last entry */
357 /* the following entry terminates this table */
358 MK_CMD_TBL_ENTRY( NULL, 0, 0, 0, NULL, NULL, NULL )