main: implement user commands
This commit is contained in:
parent
501b80e87c
commit
0261989724
1 changed files with 20 additions and 10 deletions
|
@ -1,35 +1,45 @@
|
|||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <console.h>
|
||||
#include <gpio.h>
|
||||
#include <flash.h>
|
||||
#include <ftl.h>
|
||||
#include <fs/mufs.h>
|
||||
#include <rcc.h>
|
||||
#include <rtc.h>
|
||||
#include <shell.h>
|
||||
|
||||
#include <libopencm3/stm32/usart.h>
|
||||
#include <shell/echo.h>
|
||||
#include <shell/mufs.h>
|
||||
#include <shell/rtc.h>
|
||||
#include <shell/version.h>
|
||||
|
||||
struct console *user_con, *admin_con;
|
||||
struct shell user_shell, admin_shell;
|
||||
|
||||
static void do_echo(struct console *con, const char **argv, size_t argc)
|
||||
{
|
||||
if (argc < 1)
|
||||
return;
|
||||
|
||||
fprintf(con->fp, "%s\n", argv[0]);
|
||||
}
|
||||
extern struct flash_dev *flash;
|
||||
extern struct mufs *mufs;
|
||||
|
||||
struct cmd user_cmds[] = {
|
||||
{ "echo", "", do_echo },
|
||||
{ "hi", "", shell_version },
|
||||
{ "cat", "", shell_cat },
|
||||
{ "ls", "", shell_ls },
|
||||
{ "date", "", shell_date },
|
||||
{ "time", "", shell_time },
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
struct cmd admin_cmds[] = {
|
||||
{ "echo", "", do_echo },
|
||||
{ "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 },
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue