Source code for the Trusted Boot Module.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tbm-mcu/include/shell.h

37 lines
936 B

#pragma once
#include <macros.h>
struct console;
struct cmd {
const char *cmd;
const char *desc;
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 do_flash_cmd(struct console *con, size_t argc, const char **argv);
int do_ftl_cmd(struct console *con, size_t argc, const char **argv);
int do_mufs_cmd(struct console *con, size_t argc, const char **argv);