Commit | Line | Data |
---|---|---|
83d290c5 | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
78f6622a | 2 | /* |
2dce551e | 3 | * (C) Copyright 2000-2009 |
78f6622a | 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
78f6622a WD |
5 | */ |
6 | ||
7 | /* | |
8 | * Definitions for Command Processor | |
9 | */ | |
10 | #ifndef __COMMAND_H | |
11 | #define __COMMAND_H | |
12 | ||
9fb625ce | 13 | #include <env.h> |
6c7c946c | 14 | #include <linker_lists.h> |
f2302d44 | 15 | |
26f923c7 EB |
16 | #include <linux/compiler_attributes.h> |
17 | ||
78f6622a WD |
18 | #ifndef NULL |
19 | #define NULL 0 | |
20 | #endif | |
21 | ||
2fb2604d | 22 | /* Default to a width of 8 characters for help message command width */ |
6e7df1d1 TR |
23 | #ifndef CFG_SYS_HELP_CMD_WIDTH |
24 | #define CFG_SYS_HELP_CMD_WIDTH 10 | |
2fb2604d PT |
25 | #endif |
26 | ||
78f6622a WD |
27 | #ifndef __ASSEMBLY__ |
28 | /* | |
29 | * Monitor Command Table | |
30 | */ | |
31 | ||
09140113 | 32 | struct cmd_tbl { |
78f6622a | 33 | char *name; /* Command Name */ |
78f6622a | 34 | int maxargs; /* maximum number of arguments */ |
80a48dd4 BB |
35 | /* |
36 | * Same as ->cmd() except the command | |
37 | * tells us if it can be repeated. | |
38 | * Replaces the old ->repeatable field | |
39 | * which was not able to make | |
40 | * repeatable property different for | |
41 | * the main command and sub-commands. | |
42 | */ | |
09140113 SG |
43 | int (*cmd_rep)(struct cmd_tbl *cmd, int flags, int argc, |
44 | char *const argv[], int *repeatable); | |
78f6622a | 45 | /* Implementation function */ |
09140113 SG |
46 | int (*cmd)(struct cmd_tbl *cmd, int flags, int argc, |
47 | char *const argv[]); | |
78f6622a | 48 | char *usage; /* Usage message (short) */ |
6d0f6bcf | 49 | #ifdef CONFIG_SYS_LONGHELP |
6b034487 | 50 | const char *help; /* Help message (long) */ |
78f6622a | 51 | #endif |
04a85b3b WD |
52 | #ifdef CONFIG_AUTO_COMPLETE |
53 | /* do auto completion on the arguments */ | |
09140113 SG |
54 | int (*complete)(int argc, char *const argv[], |
55 | char last_char, int maxv, char *cmdv[]); | |
04a85b3b | 56 | #endif |
78f6622a WD |
57 | }; |
58 | ||
d09b1787 | 59 | #if defined(CONFIG_CMD_RUN) |
d3a3d44f KM |
60 | int do_run(struct cmd_tbl *cmdtp, int flag, int argc, |
61 | char *const argv[]); | |
d09b1787 | 62 | #endif |
78f6622a WD |
63 | |
64 | /* common/command.c */ | |
09140113 SG |
65 | int _do_help(struct cmd_tbl *cmd_start, int cmd_items, struct cmd_tbl *cmdtp, |
66 | int flag, int argc, char *const argv[]); | |
67 | struct cmd_tbl *find_cmd(const char *cmd); | |
68 | struct cmd_tbl *find_cmd_tbl(const char *cmd, struct cmd_tbl *table, | |
69 | int table_len); | |
70 | int complete_subcmdv(struct cmd_tbl *cmdtp, int count, int argc, | |
71 | char *const argv[], char last_char, int maxv, | |
6fb61445 | 72 | char *cmdv[]); |
78f6622a | 73 | |
d3a3d44f | 74 | int cmd_usage(const struct cmd_tbl *cmdtp); |
62c3ae7c | 75 | |
80a48dd4 | 76 | /* Dummy ->cmd and ->cmd_rep wrappers. */ |
09140113 SG |
77 | int cmd_always_repeatable(struct cmd_tbl *cmdtp, int flag, int argc, |
78 | char *const argv[], int *repeatable); | |
79 | int cmd_never_repeatable(struct cmd_tbl *cmdtp, int flag, int argc, | |
80 | char *const argv[], int *repeatable); | |
81 | int cmd_discard_repeatable(struct cmd_tbl *cmdtp, int flag, int argc, | |
82 | char *const argv[]); | |
83 | ||
84 | static inline bool cmd_is_repeatable(struct cmd_tbl *cmdtp) | |
80a48dd4 BB |
85 | { |
86 | return cmdtp->cmd_rep == cmd_always_repeatable; | |
87 | } | |
88 | ||
04a85b3b | 89 | #ifdef CONFIG_AUTO_COMPLETE |
d3a3d44f KM |
90 | int var_complete(int argc, char *const argv[], char last_char, int maxv, |
91 | char *cmdv[]); | |
92 | int cmd_auto_complete(const char *const prompt, char *buf, int *np, | |
93 | int *colp); | |
04a85b3b WD |
94 | #endif |
95 | ||
16ff9902 SG |
96 | /** |
97 | * cmd_process_error() - report and process a possible error | |
98 | * | |
99 | * @cmdtp: Command which caused the error | |
100 | * @err: Error code (0 if none, -ve for error, like -EIO) | |
185f812c | 101 | * Return: 0 (CMD_RET_SUCCESS) if there is not error, |
27eb7bce MS |
102 | * 1 (CMD_RET_FAILURE) if an error is found |
103 | * -1 (CMD_RET_USAGE) if 'usage' error is found | |
16ff9902 | 104 | */ |
09140113 | 105 | int cmd_process_error(struct cmd_tbl *cmdtp, int err); |
16ff9902 | 106 | |
78f6622a WD |
107 | /* |
108 | * Monitor Command | |
109 | * | |
110 | * All commands use a common argument format: | |
111 | * | |
09140113 SG |
112 | * void function(struct cmd_tbl *cmdtp, int flag, int argc, |
113 | * char *const argv[]); | |
78f6622a WD |
114 | */ |
115 | ||
6f62d7c4 SG |
116 | #if defined(CONFIG_CMD_MEMORY) || \ |
117 | defined(CONFIG_CMD_I2C) || \ | |
118 | defined(CONFIG_CMD_ITEST) || \ | |
75846445 BG |
119 | defined(CONFIG_CMD_PCI) || \ |
120 | defined(CONFIG_CMD_SETEXPR) | |
8a40fb14 | 121 | #define CMD_DATA_SIZE |
7526deec SG |
122 | #define CMD_DATA_SIZE_ERR (-1) |
123 | #define CMD_DATA_SIZE_STR (-2) | |
124 | ||
125 | /** | |
126 | * cmd_get_data_size() - Get the data-size specifier from a command | |
127 | * | |
128 | * This reads a '.x' size specifier appended to a command. For example 'md.b' | |
129 | * is the 'md' command with a '.b' specifier, meaning that the command should | |
130 | * use bytes. | |
131 | * | |
132 | * Valid characters are: | |
133 | * | |
134 | * b - byte | |
135 | * w - word (16 bits) | |
136 | * l - long (32 bits) | |
137 | * q - quad (64 bits) | |
138 | * s - string | |
139 | * | |
140 | * @arg: Pointers to the command to check. If a valid specifier is present it | |
141 | * will be the last character of the string, following a '.' | |
142 | * @default_size: Default size to return if there is no specifier | |
185f812c | 143 | * Return: data size in bytes (1, 2, 4, 8) or CMD_DATA_SIZE_ERR for an invalid |
7526deec SG |
144 | * character, or CMD_DATA_SIZE_STR for a string |
145 | */ | |
146 | int cmd_get_data_size(char *arg, int default_size); | |
8a40fb14 JCPV |
147 | #endif |
148 | ||
7842fb7c | 149 | #ifdef CONFIG_CMD_BOOTD |
d3a3d44f KM |
150 | int do_bootd(struct cmd_tbl *cmdtp, int flag, int argc, |
151 | char *const argv[]); | |
7842fb7c | 152 | #endif |
d3a3d44f KM |
153 | int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, |
154 | char *const argv[]); | |
be43a35b | 155 | #ifdef CONFIG_CMD_BOOTM |
d3a3d44f | 156 | int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd); |
67d668bf | 157 | #else |
09140113 | 158 | static inline int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd) |
67d668bf MF |
159 | { |
160 | return 0; | |
161 | } | |
162 | #endif | |
7405a133 | 163 | |
d3a3d44f KM |
164 | int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc, |
165 | char *const argv[]); | |
da620222 | 166 | |
d3a3d44f KM |
167 | int do_booti(struct cmd_tbl *cmdtp, int flag, int argc, |
168 | char *const argv[]); | |
8b5c738b | 169 | |
18c25821 KM |
170 | int do_zboot_parent(struct cmd_tbl *cmdtp, int flag, int argc, |
171 | char *const argv[], int *repeatable); | |
172 | ||
d3a3d44f | 173 | int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc, |
09140113 | 174 | char *const argv[]); |
36ebb787 | 175 | |
d3a3d44f KM |
176 | int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, |
177 | char *const argv[]); | |
178 | int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, | |
179 | char *const argv[]); | |
180 | ||
181 | unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, | |
182 | char *const argv[]); | |
49d81fdf AT |
183 | |
184 | #if defined(CONFIG_CMD_NVEDIT_EFI) | |
d3a3d44f KM |
185 | int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc, |
186 | char *const argv[]); | |
187 | int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc, | |
188 | char *const argv[]); | |
49d81fdf AT |
189 | #endif |
190 | ||
d422c77a SG |
191 | /** |
192 | * setexpr_regex_sub() - Replace a regex pattern with a string | |
193 | * | |
194 | * @data: Buffer containing the string to update | |
195 | * @data_size: Size of buffer (must be large enough for the new string) | |
196 | * @nbuf: Back-reference buffer | |
197 | * @nbuf_size: Size of back-reference buffer (must be larger enough for @s plus | |
198 | * all back-reference expansions) | |
199 | * @r: Regular expression to find | |
200 | * @s: String to replace with | |
201 | * @global: true to replace all matches in @data, false to replace just the | |
202 | * first | |
185f812c | 203 | * Return: 0 if OK, 1 on error |
d422c77a SG |
204 | */ |
205 | int setexpr_regex_sub(char *data, uint data_size, char *nbuf, uint nbuf_size, | |
206 | const char *r, const char *s, bool global); | |
207 | ||
9d12d5d4 SG |
208 | /* |
209 | * Error codes that commands return to cmd_process(). We use the standard 0 | |
210 | * and 1 for success and failure, but add one more case - failure with a | |
211 | * request to call cmd_usage(). But the cmd_process() function handles | |
212 | * CMD_RET_USAGE itself and after calling cmd_usage() it will return 1. | |
213 | * This is just a convenience for commands to avoid them having to call | |
214 | * cmd_usage() all over the place. | |
215 | */ | |
216 | enum command_ret_t { | |
217 | CMD_RET_SUCCESS, /* 0 = Success */ | |
218 | CMD_RET_FAILURE, /* 1 = Failure */ | |
219 | CMD_RET_USAGE = -1, /* Failure, please report 'usage' error */ | |
220 | }; | |
221 | ||
222 | /** | |
223 | * Process a command with arguments. We look up the command and execute it | |
224 | * if valid. Otherwise we print a usage message. | |
225 | * | |
226 | * @param flag Some flags normally 0 (see CMD_FLAG_.. above) | |
227 | * @param argc Number of arguments (arg 0 must be the command text) | |
228 | * @param argv Arguments | |
229 | * @param repeatable This function sets this to 0 if the command is not | |
230 | * repeatable. If the command is repeatable, the value | |
231 | * is left unchanged. | |
34765e88 RG |
232 | * @param ticks If ticks is not null, this function set it to the |
233 | * number of ticks the command took to complete. | |
8b8accb8 | 234 | * Return: 0 if command succeeded, else non-zero (CMD_RET_...) |
9d12d5d4 | 235 | */ |
8b8accb8 HS |
236 | enum command_ret_t cmd_process(int flag, int argc, char *const argv[], |
237 | int *repeatable, unsigned long *ticks); | |
bdf8e34b | 238 | |
09140113 | 239 | void fixup_cmdtable(struct cmd_tbl *cmdtp, int size); |
f8bb6964 SG |
240 | |
241 | /** | |
242 | * board_run_command() - Fallback function to execute a command | |
243 | * | |
244 | * When no command line features are enabled in U-Boot, this function is | |
245 | * called to execute a command. Typically the function can look at the | |
246 | * command and perform a few very specific tasks, such as booting the | |
247 | * system in a particular way. | |
248 | * | |
249 | * This function is only used when CONFIG_CMDLINE is not enabled. | |
250 | * | |
251 | * In normal situations this function should not return, since U-Boot will | |
252 | * simply hang. | |
253 | * | |
254 | * @cmdline: Command line string to execute | |
185f812c | 255 | * Return: 0 if OK, 1 for error |
f8bb6964 SG |
256 | */ |
257 | int board_run_command(const char *cmdline); | |
288b29e4 SG |
258 | |
259 | int run_command(const char *cmd, int flag); | |
260 | int run_command_repeatable(const char *cmd, int flag); | |
261 | ||
74724484 SG |
262 | /** |
263 | * run_commandf() - Run a command created by a format string | |
264 | * | |
74724484 SG |
265 | * @fmt: printf() format string |
266 | * @...: Arguments to use (flag is always 0) | |
26f923c7 EB |
267 | * |
268 | * The command cannot be larger than (CONFIG_SYS_CBSIZE - 1) characters. | |
269 | * | |
270 | * Return: | |
271 | * Returns 0 on success, -EIO if internal output error occurred, -ENOSPC in | |
272 | * case of 'fmt' string truncation, or != 0 on error, specific for | |
273 | * run_command(). | |
74724484 | 274 | */ |
26f923c7 | 275 | int run_commandf(const char *fmt, ...) __printf(1, 2); |
74724484 | 276 | |
288b29e4 SG |
277 | /** |
278 | * Run a list of commands separated by ; or even \0 | |
279 | * | |
280 | * Note that if 'len' is not -1, then the command does not need to be nul | |
281 | * terminated, Memory will be allocated for the command in that case. | |
282 | * | |
283 | * @param cmd List of commands to run, each separated bu semicolon | |
284 | * @param len Length of commands excluding terminator if known (-1 if not) | |
285 | * @param flag Execution flags (CMD_FLAG_...) | |
185f812c | 286 | * Return: 0 on success, or != 0 on error. |
288b29e4 SG |
287 | */ |
288 | int run_command_list(const char *cmd, int len, int flag); | |
30f3333d SG |
289 | |
290 | /** | |
291 | * cmd_source_script() - Execute a script | |
292 | * | |
293 | * Executes a U-Boot script at a particular address in memory. The script should | |
294 | * have a header (FIT or legacy) with the script type (IH_TYPE_SCRIPT). | |
295 | * | |
296 | * @addr: Address of script | |
297 | * @fit_uname: FIT subimage name | |
298 | * Return: result code (enum command_ret_t) | |
299 | */ | |
300 | int cmd_source_script(ulong addr, const char *fit_uname, const char *confname); | |
78f6622a WD |
301 | #endif /* __ASSEMBLY__ */ |
302 | ||
303 | /* | |
304 | * Command Flags: | |
305 | */ | |
306 | #define CMD_FLAG_REPEAT 0x0001 /* repeat last command */ | |
307 | #define CMD_FLAG_BOOTD 0x0002 /* command is from bootd */ | |
87b6398b | 308 | #define CMD_FLAG_ENV 0x0004 /* command is from the environment */ |
78f6622a | 309 | |
722b061b MF |
310 | #ifdef CONFIG_AUTO_COMPLETE |
311 | # define _CMD_COMPLETE(x) x, | |
312 | #else | |
313 | # define _CMD_COMPLETE(x) | |
314 | #endif | |
315 | #ifdef CONFIG_SYS_LONGHELP | |
316 | # define _CMD_HELP(x) x, | |
317 | #else | |
318 | # define _CMD_HELP(x) | |
319 | #endif | |
8bde7f77 | 320 | |
c0cf06e5 BB |
321 | #ifdef CONFIG_NEEDS_MANUAL_RELOC |
322 | #define U_BOOT_SUBCMDS_RELOC(_cmdname) \ | |
323 | static void _cmdname##_subcmds_reloc(void) \ | |
324 | { \ | |
325 | static int relocated; \ | |
326 | \ | |
327 | if (relocated) \ | |
328 | return; \ | |
329 | \ | |
330 | fixup_cmdtable(_cmdname##_subcmds, \ | |
331 | ARRAY_SIZE(_cmdname##_subcmds)); \ | |
332 | relocated = 1; \ | |
333 | } | |
334 | #else | |
335 | #define U_BOOT_SUBCMDS_RELOC(_cmdname) \ | |
336 | static void _cmdname##_subcmds_reloc(void) { } | |
337 | #endif | |
338 | ||
339 | #define U_BOOT_SUBCMDS_DO_CMD(_cmdname) \ | |
09140113 SG |
340 | static int do_##_cmdname(struct cmd_tbl *cmdtp, int flag, \ |
341 | int argc, char *const argv[], \ | |
342 | int *repeatable) \ | |
c0cf06e5 | 343 | { \ |
09140113 | 344 | struct cmd_tbl *subcmd; \ |
c0cf06e5 BB |
345 | \ |
346 | _cmdname##_subcmds_reloc(); \ | |
347 | \ | |
348 | /* We need at least the cmd and subcmd names. */ \ | |
349 | if (argc < 2 || argc > CONFIG_SYS_MAXARGS) \ | |
350 | return CMD_RET_USAGE; \ | |
351 | \ | |
352 | subcmd = find_cmd_tbl(argv[1], _cmdname##_subcmds, \ | |
353 | ARRAY_SIZE(_cmdname##_subcmds)); \ | |
354 | if (!subcmd || argc - 1 > subcmd->maxargs) \ | |
355 | return CMD_RET_USAGE; \ | |
356 | \ | |
357 | if (flag == CMD_FLAG_REPEAT && \ | |
358 | !cmd_is_repeatable(subcmd)) \ | |
359 | return CMD_RET_SUCCESS; \ | |
360 | \ | |
361 | return subcmd->cmd_rep(subcmd, flag, argc - 1, \ | |
362 | argv + 1, repeatable); \ | |
363 | } | |
364 | ||
365 | #ifdef CONFIG_AUTO_COMPLETE | |
366 | #define U_BOOT_SUBCMDS_COMPLETE(_cmdname) \ | |
09140113 | 367 | static int complete_##_cmdname(int argc, char *const argv[], \ |
c0cf06e5 BB |
368 | char last_char, int maxv, \ |
369 | char *cmdv[]) \ | |
370 | { \ | |
371 | return complete_subcmdv(_cmdname##_subcmds, \ | |
372 | ARRAY_SIZE(_cmdname##_subcmds), \ | |
373 | argc - 1, argv + 1, last_char, \ | |
374 | maxv, cmdv); \ | |
375 | } | |
376 | #else | |
377 | #define U_BOOT_SUBCMDS_COMPLETE(_cmdname) | |
378 | #endif | |
379 | ||
380 | #define U_BOOT_SUBCMDS(_cmdname, ...) \ | |
09140113 | 381 | static struct cmd_tbl _cmdname##_subcmds[] = { __VA_ARGS__ }; \ |
c0cf06e5 BB |
382 | U_BOOT_SUBCMDS_RELOC(_cmdname) \ |
383 | U_BOOT_SUBCMDS_DO_CMD(_cmdname) \ | |
384 | U_BOOT_SUBCMDS_COMPLETE(_cmdname) | |
385 | ||
d99e6f78 | 386 | #if CONFIG_IS_ENABLED(CMDLINE) |
80a48dd4 BB |
387 | #define U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep, \ |
388 | _usage, _help, _comp) \ | |
389 | { #_name, _maxargs, _cmd_rep, cmd_discard_repeatable, \ | |
390 | _usage, _CMD_HELP(_help) _CMD_COMPLETE(_comp) } | |
391 | ||
6c7c946c MV |
392 | #define U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, \ |
393 | _usage, _help, _comp) \ | |
80a48dd4 BB |
394 | { #_name, _maxargs, \ |
395 | _rep ? cmd_always_repeatable : cmd_never_repeatable, \ | |
396 | _cmd, _usage, _CMD_HELP(_help) _CMD_COMPLETE(_comp) } | |
8bde7f77 | 397 | |
6c7c946c | 398 | #define U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, _comp) \ |
09140113 | 399 | ll_entry_declare(struct cmd_tbl, _name, cmd) = \ |
6c7c946c MV |
400 | U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, \ |
401 | _usage, _help, _comp); | |
8bde7f77 | 402 | |
80a48dd4 BB |
403 | #define U_BOOT_CMDREP_COMPLETE(_name, _maxargs, _cmd_rep, _usage, \ |
404 | _help, _comp) \ | |
09140113 | 405 | ll_entry_declare(struct cmd_tbl, _name, cmd) = \ |
80a48dd4 BB |
406 | U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep, \ |
407 | _usage, _help, _comp) | |
408 | ||
fb24112c | 409 | #else |
09140113 | 410 | #define U_BOOT_SUBCMD_START(name) static struct cmd_tbl name[] = {}; |
fb24112c SG |
411 | #define U_BOOT_SUBCMD_END |
412 | ||
413 | #define _CMD_REMOVE(_name, _cmd) \ | |
414 | int __remove_ ## _name(void) \ | |
415 | { \ | |
416 | if (0) \ | |
417 | _cmd(NULL, 0, 0, NULL); \ | |
418 | return 0; \ | |
419 | } | |
80a48dd4 | 420 | |
45cd2e55 SG |
421 | #define _CMD_REMOVE_REP(_name, _cmd) \ |
422 | int __remove_ ## _name(void) \ | |
423 | { \ | |
424 | if (0) \ | |
425 | _cmd(NULL, 0, 0, NULL, NULL); \ | |
426 | return 0; \ | |
427 | } | |
428 | ||
80a48dd4 BB |
429 | #define U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep, \ |
430 | _usage, _help, _comp) \ | |
431 | { #_name, _maxargs, 0 ? _cmd_rep : NULL, NULL, _usage, \ | |
432 | _CMD_HELP(_help) _CMD_COMPLETE(_comp) } | |
433 | ||
fb24112c SG |
434 | #define U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, \ |
435 | _help, _comp) \ | |
80a48dd4 | 436 | { #_name, _maxargs, NULL, 0 ? _cmd : NULL, _usage, \ |
fb24112c SG |
437 | _CMD_HELP(_help) _CMD_COMPLETE(_comp) } |
438 | ||
439 | #define U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, \ | |
440 | _comp) \ | |
441 | _CMD_REMOVE(sub_ ## _name, _cmd) | |
442 | ||
80a48dd4 BB |
443 | #define U_BOOT_CMDREP_COMPLETE(_name, _maxargs, _cmd_rep, _usage, \ |
444 | _help, _comp) \ | |
45cd2e55 | 445 | _CMD_REMOVE_REP(sub_ ## _name, _cmd_rep) |
80a48dd4 | 446 | |
fb24112c SG |
447 | #endif /* CONFIG_CMDLINE */ |
448 | ||
6c7c946c MV |
449 | #define U_BOOT_CMD(_name, _maxargs, _rep, _cmd, _usage, _help) \ |
450 | U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, NULL) | |
8bde7f77 | 451 | |
fb24112c SG |
452 | #define U_BOOT_CMD_MKENT(_name, _maxargs, _rep, _cmd, _usage, _help) \ |
453 | U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd, \ | |
454 | _usage, _help, NULL) | |
455 | ||
c0cf06e5 BB |
456 | #define U_BOOT_SUBCMD_MKENT_COMPLETE(_name, _maxargs, _rep, _do_cmd, \ |
457 | _comp) \ | |
458 | U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _do_cmd, \ | |
459 | "", "", _comp) | |
460 | ||
461 | #define U_BOOT_SUBCMD_MKENT(_name, _maxargs, _rep, _do_cmd) \ | |
462 | U_BOOT_SUBCMD_MKENT_COMPLETE(_name, _maxargs, _rep, _do_cmd, \ | |
463 | NULL) | |
464 | ||
465 | #define U_BOOT_CMD_WITH_SUBCMDS(_name, _usage, _help, ...) \ | |
466 | U_BOOT_SUBCMDS(_name, __VA_ARGS__) \ | |
467 | U_BOOT_CMDREP_COMPLETE(_name, CONFIG_SYS_MAXARGS, do_##_name, \ | |
468 | _usage, _help, complete_##_name) | |
469 | ||
78f6622a | 470 | #endif /* __COMMAND_H */ |