main: implement user commands

tags/0.1.0
S.J.R. van Schaik 8 years ago
parent 501b80e87c
commit 0261989724
  1. 30
      source/main.c

@ -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…
Cancel
Save