#include #include #include #include #include #include #include #include struct usart_console *user_con, *admin_con; struct shell user_shell, admin_shell; static void do_echo(FILE *out, const char **argv, size_t argc) { if (argc < 1) return; fprintf(out, "%s\n", argv[0]); } struct cmd user_cmds[] = { { "echo", "", do_echo }, { NULL, NULL, NULL }, }; struct cmd admin_cmds[] = { { "echo", "", do_echo }, { "flash", "", do_flash_cmd }, { "ftl", "", do_ftl_cmd }, { "mufs", "", do_mufs_cmd }, { NULL, NULL, NULL }, }; int main(void) { FILE *fp; rcc_init(); gpio_init(); user_con = console_init(0); admin_con = console_init(1); fp = console_to_fp(user_con); fprintf(fp, "TBM-dev (built on " __DATE__ ")\n"); fp = console_to_fp(admin_con); fprintf(fp, "TBM-dev (built on " __DATE__ ")\n"); shell_init(&user_shell, user_cmds, user_con, "tbm $"); shell_init(&admin_shell, admin_cmds, admin_con, "tbm #"); while (1) { shell_parse(&user_shell); shell_parse(&admin_shell); } return 0; }