]>
Commit | Line | Data |
---|---|---|
5dfa25f2 WD |
1 | /* |
2 | * (C) Copyright 2000 | |
3 | * Wolfgang Denk, DENX Software Engineering, [email protected]. | |
4 | * | |
5 | * See file CREDITS for list of people who contributed to this | |
6 | * project. | |
7 | * | |
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. | |
12 | * | |
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. | |
17 | * | |
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, | |
21 | * MA 02111-1307 USA | |
22 | */ | |
23 | ||
24 | /* | |
25 | * Command Processor Table | |
26 | */ | |
27 | ||
28 | #include <common.h> | |
29 | #include <command.h> | |
30 | #include <cmd_cache.h> | |
31 | #include <cmd_mem.h> | |
32 | #include <cmd_boot.h> | |
33 | #include <cmd_flash.h> | |
34 | #include <cmd_bootm.h> | |
35 | #include <cmd_net.h> | |
36 | #include <cmd_nvedit.h> | |
37 | #include <cmd_misc.h> | |
38 | #include <cmd_kgdb.h> | |
39 | #include <cmd_ide.h> | |
40 | #include <cmd_disk.h> | |
41 | #include <cmd_console.h> | |
42 | #include <cmd_reginfo.h> | |
43 | #include <cmd_pcmcia.h> | |
44 | #include <cmd_autoscript.h> | |
45 | #include <cmd_diag.h> | |
46 | ||
47 | #include <cmd_eeprom.h> | |
48 | #include <cmd_i2c.h> | |
eb9401e3 | 49 | #include <cmd_spi.h> |
5dfa25f2 WD |
50 | #include <cmd_immap.h> |
51 | #include <cmd_rtc.h> | |
52 | ||
53 | #include <cmd_elf.h> | |
54 | #include <cmd_fdc.h> /* Floppy support */ | |
55 | #include <cmd_usb.h> /* USB support */ | |
56 | #include <cmd_scsi.h> | |
57 | #include <cmd_pci.h> | |
58 | #include <cmd_mii.h> | |
59 | #include <cmd_dcr.h> /* 4xx DCR register access */ | |
60 | #include <cmd_doc.h> | |
dc7c9a1a | 61 | #include <cmd_nand.h> |
5dfa25f2 WD |
62 | #include <cmd_jffs2.h> |
63 | #include <cmd_fpga.h> | |
64 | ||
65 | #include <cmd_bsp.h> /* board special functions */ | |
66 | ||
67 | #include <cmd_bedbug.h> | |
68 | #include <cmd_elf.h> | |
69 | ||
70 | #include <cmd_dtt.h> | |
71 | ||
72 | #include <cmd_vfd.h> /* load a bitmap to the VFDs on TRAB */ | |
56f94be3 | 73 | #include <cmd_log.h> |
2262cfee | 74 | #include <cmd_fdos.h> |
d791b1dc | 75 | #include <cmd_bmp.h> |
7a8e9bed | 76 | #include <cmd_portio.h> |
5dfa25f2 | 77 | |
c7de829c WD |
78 | #ifdef CONFIG_AMIGAONEG3SE |
79 | #include <cmd_menu.h> | |
80 | #include <cmd_boota.h> | |
81 | #endif | |
82 | ||
5dfa25f2 WD |
83 | /* |
84 | * HELP command | |
85 | */ | |
86 | #define CMD_TBL_HELP MK_CMD_TBL_ENTRY( \ | |
87 | "help", 1, CFG_MAXARGS, 1, do_help, \ | |
88 | "help - print online help\n", \ | |
89 | "[command ...]\n" \ | |
90 | " - show help information (for 'command')\n" \ | |
91 | "'help' prints online help for the monitor commands.\n\n" \ | |
92 | "Without arguments, it prints a short usage message for all commands.\n\n" \ | |
93 | "To get detailed help information for specific commands you can type\n" \ | |
94 | "'help' with one or more command names as arguments.\n" \ | |
95 | ), | |
96 | ||
97 | #define CMD_TBL_QUES MK_CMD_TBL_ENTRY( \ | |
98 | "?", 1, CFG_MAXARGS, 1, do_help, \ | |
99 | "? - alias for 'help'\n", \ | |
100 | NULL \ | |
101 | ), | |
102 | ||
103 | #define CMD_TBL_VERS MK_CMD_TBL_ENTRY( \ | |
104 | "version", 4, 1, 1, do_version, \ | |
105 | "version - print monitor version\n", \ | |
106 | NULL \ | |
107 | ), | |
108 | ||
109 | #define CMD_TBL_ECHO MK_CMD_TBL_ENTRY( \ | |
110 | "echo", 4, CFG_MAXARGS, 1, do_echo, \ | |
111 | "echo - echo args to console\n", \ | |
112 | "[args..]\n" \ | |
113 | " - echo args to console; \\c suppresses newline\n" \ | |
114 | ), | |
115 | ||
116 | int | |
117 | do_version (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) | |
118 | { | |
119 | extern char version_string[]; | |
120 | printf ("\n%s\n", version_string); | |
121 | return 0; | |
122 | } | |
123 | ||
124 | int | |
125 | do_echo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) | |
126 | { | |
127 | int i, putnl = 1; | |
128 | ||
129 | for (i = 1; i < argc; i++) { | |
130 | char *p = argv[i], c; | |
131 | ||
132 | if (i > 1) | |
133 | putc(' '); | |
134 | while ((c = *p++) != '\0') | |
135 | if (c == '\\' && *p == 'c') { | |
136 | putnl = 0; | |
137 | p++; | |
138 | } | |
139 | else | |
140 | putc(c); | |
141 | } | |
142 | ||
143 | if (putnl) | |
144 | putc('\n'); | |
145 | return 0; | |
146 | } | |
147 | ||
148 | /* | |
149 | * Use puts() instead of printf() to avoid printf buffer overflow | |
150 | * for long help messages | |
151 | */ | |
152 | int | |
153 | do_help (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) | |
154 | { | |
155 | int i; | |
156 | int rcode = 0; | |
157 | ||
158 | if (argc == 1) { /* print short help (usage) */ | |
159 | ||
160 | for (cmdtp=&cmd_tbl[0]; cmdtp->name; cmdtp++) { | |
161 | /* allow user abort */ | |
162 | if (ctrlc()) | |
163 | return 1; | |
164 | ||
165 | if (cmdtp->usage == NULL) | |
166 | continue; | |
167 | puts (cmdtp->usage); | |
168 | } | |
169 | ||
170 | return 0; | |
171 | } | |
172 | ||
173 | /* | |
174 | * command help (long version) | |
175 | */ | |
176 | for (i=1; i<argc; ++i) { | |
177 | if ((cmdtp = find_cmd(argv[i])) != NULL) { | |
178 | #ifdef CFG_LONGHELP | |
179 | /* found - print (long) help info */ | |
180 | puts (cmdtp->name); | |
181 | putc (' '); | |
182 | if (cmdtp->help) { | |
183 | puts (cmdtp->help); | |
184 | } else { | |
185 | puts ("- No help available.\n"); | |
186 | rcode = 1; | |
187 | } | |
188 | putc ('\n'); | |
189 | #else /* no long help available */ | |
190 | if (cmdtp->usage) | |
191 | puts (cmdtp->usage); | |
192 | #endif /* CFG_LONGHELP */ | |
193 | } | |
194 | else { | |
195 | printf ("Unknown command '%s' - try 'help'" | |
196 | " without arguments for list of all" | |
197 | " known commands\n\n", | |
198 | argv[i] | |
199 | ); | |
200 | rcode = 1; | |
201 | } | |
202 | } | |
203 | return rcode; | |
204 | } | |
205 | ||
206 | /*************************************************************************** | |
207 | * find command table entry for a command | |
208 | */ | |
209 | cmd_tbl_t *find_cmd(const char *cmd) | |
210 | { | |
211 | cmd_tbl_t *cmdtp; | |
212 | ||
213 | /* Search command table - Use linear search - it's a small table */ | |
214 | for (cmdtp = &cmd_tbl[0]; cmdtp->name; cmdtp++) { | |
215 | if (strncmp (cmd, cmdtp->name, cmdtp->lmin) == 0) | |
216 | return cmdtp; | |
217 | } | |
218 | return NULL; /* not found */ | |
219 | } | |
220 | ||
221 | /* | |
222 | * The commands in this table are sorted alphabetically by the | |
223 | * command name and in descending order by the command name string | |
224 | * length. This is to prevent conflicts in command name parsing. | |
225 | * Please ensure that new commands are added according to that rule. | |
226 | * Please use $(TOPDIR)/doc/README.commands as a reference AND make | |
227 | * sure it gets updated. | |
228 | */ | |
229 | ||
230 | cmd_tbl_t cmd_tbl[] = { | |
231 | CMD_TBL_ASKENV | |
232 | CMD_TBL_ASM | |
233 | CMD_TBL_AUTOSCRIPT | |
234 | CMD_TBL_BASE | |
235 | CMD_TBL_BDINFO | |
d791b1dc | 236 | CMD_TBL_BMP |
c7de829c WD |
237 | #ifdef CONFIG_AMIGAONEG3SE |
238 | CMD_TBL_BOOTA | |
239 | #endif | |
5dfa25f2 WD |
240 | CMD_TBL_BOOTELF |
241 | CMD_TBL_BOOTM | |
242 | CMD_TBL_BOOTP | |
243 | CMD_TBL_BOOTVX | |
244 | CMD_TBL_BOOTD | |
245 | CMD_TBL_BREAK | |
246 | CMD_TBL_BRGINFO | |
247 | CMD_TBL_CARINFO | |
248 | CMD_TBL_JFFS2_CHPART | |
249 | CMD_TBL_CMP | |
250 | CMD_TBL_CONINFO | |
251 | CMD_TBL_CONTINUE | |
252 | CMD_TBL_CP | |
253 | CMD_TBL_CRC | |
254 | CMD_TBL_DATE | |
255 | CMD_TBL_DCACHE | |
256 | CMD_TBL_DHCP | |
257 | CMD_TBL_DIAG | |
258 | CMD_TBL_DISK | |
259 | CMD_TBL_DMAINFO | |
260 | CMD_TBL_DIS | |
261 | CMD_TBL_DOCBOOT | |
262 | CMD_TBL_DOC | |
263 | CMD_TBL_DTT | |
264 | CMD_TBL_ECHO | |
265 | CMD_TBL_EEPROM | |
266 | CMD_TBL_FCCINFO | |
267 | CMD_TBL_FLERASE | |
268 | CMD_TBL_FDC | |
2262cfee WD |
269 | CMD_TBL_FDOS_BOOT |
270 | CMD_TBL_FDOS_LS | |
5dfa25f2 WD |
271 | CMD_TBL_FLINFO |
272 | CMD_TBL_FPGA | |
273 | CMD_TBL_JFFS2_FSINFO | |
274 | CMD_TBL_JFFS2_FSLOAD | |
275 | CMD_TBL_GETDCR | |
276 | CMD_TBL_GO | |
277 | CMD_TBL_HELP | |
278 | CMD_TBL_HWFLOW | |
279 | CMD_TBL_I2CINFO | |
280 | CMD_TBL_ICACHE | |
281 | #ifdef CONFIG_8260 | |
282 | CMD_TBL_ICINFO | |
283 | #endif | |
284 | CMD_TBL_IMD | |
285 | CMD_TBL_IMM | |
286 | CMD_TBL_INM | |
287 | CMD_TBL_IMW | |
7a8e9bed | 288 | CMD_TBL_PORTIO_IN |
5dfa25f2 WD |
289 | CMD_TBL_ICRC |
290 | CMD_TBL_IPROBE | |
291 | CMD_TBL_ILOOP | |
292 | CMD_TBL_ISDRAM | |
293 | CMD_TBL_IDE | |
294 | CMD_TBL_IMINFO | |
295 | CMD_TBL_IOPINFO | |
296 | CMD_TBL_IOPSET | |
297 | CMD_TBL_IRQINFO | |
298 | CMD_TBL_KGDB | |
299 | CMD_TBL_LOADB | |
300 | CMD_TBL_LOADS | |
56f94be3 | 301 | CMD_TBL_LOG |
5dfa25f2 WD |
302 | CMD_TBL_LOOP |
303 | CMD_TBL_JFFS2_LS | |
304 | CMD_TBL_MCCINFO | |
305 | CMD_TBL_MD | |
306 | CMD_TBL_MEMCINFO | |
c7de829c WD |
307 | #ifdef CONFIG_AMIGAONEG3SE |
308 | CMD_TBL_MENU | |
309 | #endif | |
5dfa25f2 WD |
310 | CMD_TBL_MII |
311 | CMD_TBL_MM | |
312 | CMD_TBL_MTEST | |
313 | CMD_TBL_MUXINFO | |
314 | CMD_TBL_MW | |
dc7c9a1a WD |
315 | CMD_TBL_NAND |
316 | CMD_TBL_NANDBOOT | |
5dfa25f2 WD |
317 | CMD_TBL_NEXT |
318 | CMD_TBL_NM | |
73a8b27c | 319 | CMD_TBL_PING |
7a8e9bed | 320 | CMD_TBL_PORTIO_OUT |
5dfa25f2 WD |
321 | CMD_TBL_PCI |
322 | CMD_TBL_PRINTENV | |
323 | CMD_TBL_PROTECT | |
324 | CMD_TBL_RARPB | |
325 | CMD_TBL_RDUMP | |
326 | CMD_TBL_PINIT | |
327 | CMD_TBL_REGINFO | |
328 | CMD_TBL_RESET | |
329 | CMD_TBL_RUN | |
330 | CMD_TBL_SAVEENV | |
331 | CMD_TBL_SAVES | |
332 | CMD_TBL_SCCINFO | |
333 | CMD_TBL_SCSIBOOT | |
334 | CMD_TBL_SCSI | |
335 | CMD_TBL_SETDCR | |
336 | CMD_TBL_SETENV | |
337 | CMD_TBL_SIINFO | |
338 | CMD_TBL_SITINFO | |
339 | CMD_TBL_SIUINFO | |
340 | CMD_TBL_MISC /* sleep */ | |
341 | CMD_TBL_SMCINFO | |
342 | CMD_TBL_SPIINFO | |
eb9401e3 | 343 | CMD_TBL_SPI |
5dfa25f2 WD |
344 | CMD_TBL_STACK |
345 | CMD_TBL_STEP | |
346 | CMD_TBL_TFTPB | |
347 | CMD_TBL_USBBOOT | |
348 | CMD_TBL_USB | |
349 | CMD_TBL_VERS | |
350 | CMD_TBL_BSP | |
351 | CMD_TBL_VFD | |
352 | CMD_TBL_QUES /* keep this ("help") the last entry */ | |
353 | /* the following entry terminates this table */ | |
354 | MK_CMD_TBL_ENTRY( NULL, 0, 0, 0, NULL, NULL, NULL ) | |
355 | }; |