#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct console *user_con, *admin_con; struct shell user_shell, admin_shell; extern struct flash_dev *flash; extern struct mufs *mufs; struct cmd user_cmds[] = { { "hi", "", shell_version }, { "cat", "", shell_cat }, { "ls", "", shell_ls }, { "date", "", shell_date }, { "time", "", shell_time }, { "booting", "", shell_prepare }, { NULL, NULL, NULL }, }; struct cmd admin_cmds[] = { { "echo", "", shell_echo }, { "flash", "", do_flash_cmd }, { "ftl", "", do_ftl_cmd }, { "mufs", "", do_mufs_cmd }, { "date", "", shell_date }, { "time", "", shell_time }, { "set-date", "", shell_set_date }, { NULL, NULL, NULL }, }; int main(void) { rcc_init(); gpio_init(); rtc_init(NULL); user_con = console_init(0); admin_con = console_init(1); flash = flash_probe(); flash = ftl_mount(flash); mufs = mufs_mount(flash); fprintf(user_con->fp, "TBM-dev (built on " __DATE__ ")\n"); fprintf(admin_con->fp, "TBM-dev (built on " __DATE__ ")\n"); shell_init(&user_shell, user_cmds, user_con, "tbm $", SHELL_SHOW_EXIT_CODE); shell_init(&admin_shell, admin_cmds, admin_con, "tbm #", 0); while (1) { shell_parse(&user_shell); shell_parse(&admin_shell); } return 0; }