#pragma once #include struct console; struct cmd { const char *cmd; int (* exec)(struct console *con, size_t argc, const char **argv); }; struct shell { char line[128]; struct cmd *cmds; const char *prompt; struct console *con; unsigned flags; }; #define SHELL_SHOW_EXIT_CODE BIT(0) size_t count_args(const char *line); char **parse_args(const char *line, size_t *argc); int cmd_exec(struct cmd *cmds, struct console *con, size_t argc, const char **argv); int cmd_parse(struct cmd *cmds, struct console *con, const char *line); int shell_init(struct shell *shell, struct cmd *cmds, struct console *con, const char *prompt, unsigned flags); int shell_parse(struct shell *shell); int shell_flash_probe(struct console *con, size_t argc, const char **argv); int shell_flash_release(struct console *con, size_t argc, const char **argv); int shell_flash_info(struct console *con, size_t argc, const char **argv); int shell_flash_read(struct console *con, size_t argc, const char **argv); int shell_flash_write(struct console *con, size_t argc, const char **argv); int shell_flash_erase(struct console *con, size_t argc, const char **argv); int shell_ftl_probe(struct console *con, size_t argc, const char **argv);