summaryrefslogtreecommitdiff
path: root/include/command.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/command.h')
-rw-r--r--include/command.h35
1 files changed, 19 insertions, 16 deletions
diff --git a/include/command.h b/include/command.h
index 9ca460d..75b5a0d 100644
--- a/include/command.h
+++ b/include/command.h
@@ -46,10 +46,10 @@ typedef enum {
struct cmd_tbl_s {
const FLASH char *name; /* Command Name */
- int maxargs; /* maximum number of arguments */
- int repeatable; /* autorepeat allowed? */
+ uint8_t maxargs; /* maximum number of arguments */
+ uint8_t flags; /* autorepeat allowed? */
/* Implementation function */
- command_ret_t (*cmd)(const FLASH struct cmd_tbl_s *, int, int, char * const []);
+ command_ret_t (*cmd)(const FLASH struct cmd_tbl_s *, uint_fast8_t, int, char * const []);
const FLASH char *usage; /* Usage message (short) */
#ifdef CONFIG_SYS_LONGHELP
const FLASH char *help; /* Help message (long) */
@@ -75,12 +75,11 @@ typedef const FLASH struct cmd_tbl_s cmd_tbl_t;
* @return 0 if the command succeeded, 1 if it failed
*/
command_ret_t
-cmd_process(int flag, int argc, char * const argv[], uint_fast8_t *repeatable);
+cmd_process(uint_fast8_t flag, int argc, char * const argv[], uint_fast8_t *repeatable);
/* command.c */
-command_ret_t _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
- flag, int argc, char * const argv[]);
+command_ret_t _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, uint_fast8_t flag, int argc, char * const argv[]);
cmd_tbl_t *find_cmd(const char *cmd);
cmd_tbl_t *find_cmd_tbl (const char *cmd, cmd_tbl_t *table, int table_len);
@@ -106,21 +105,19 @@ int cmd_process_error(cmd_tbl_t *cmdtp, int err);
*
* All commands use a common argument format:
*
- * void function (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+ * void function (cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]);
*/
#ifdef CONFIG_CMD_BOOTD
-extern command_ret_t do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern command_ret_t do_bootd(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]);
#endif
#ifdef CONFIG_CMD_BOOTM
-extern command_ret_t do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern command_ret_t do_bootm(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]);
extern int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd);
#else
-static inline int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
+static inline int bootm_maybe_autostart(cmd_tbl_t *cmdtp UNUSED, const char *cmd UNUSED)
{
- (void) cmdtp; (void) cmd;
-
return 0;
}
#endif
@@ -128,13 +125,19 @@ static inline int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
extern int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
char *const argv[]);
-extern command_ret_t do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern command_ret_t do_reset(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]);
/*
* Command Flags:
*/
-#define CMD_FLAG_REPEAT 0x0001 /* repeat last command */
-#define CMD_FLAG_BOOTD 0x0002 /* command is from bootd */
+#define CMD_FLAG_REPEAT 0x01 /* repeat last command */
+#define CMD_FLAG_BOOTD 0x02 /* command is from bootd */
+
+/*
+ * Flags for command table:
+ */
+#define CTBL_REPEAT 0x01 /* command is repeatable */
+#define CTBL_SUBCMD 0x02 /* command has subcommands */
#ifdef CONFIG_AUTO_COMPLETE
# define _CMD_COMPLETE(x) x,
@@ -157,7 +160,7 @@ extern command_ret_t do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const
CMD_TBL_ITEM_COMPLETE(_name, _maxargs, _rep, _cmd, \
_usage, _help, NULL)
-typedef command_ret_t (*do_cmd_t)(cmd_tbl_t *, int, int, char * const []);
+typedef command_ret_t (*do_cmd_t)(cmd_tbl_t *, uint_fast8_t, int, char * const []);
extern cmd_tbl_t cmd_tbl[];