From d684c21619905153eff68c43927207248925f6c2 Mon Sep 17 00:00:00 2001 From: Leo C Date: Tue, 12 Aug 2014 12:35:28 +0200 Subject: New U-Boot like AVR main program. Uses U-Boot source code taken from: git://git.denx.de/u-boot.git --- avr/command_tbl.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 avr/command_tbl.c (limited to 'avr/command_tbl.c') diff --git a/avr/command_tbl.c b/avr/command_tbl.c new file mode 100644 index 0000000..c0579bc --- /dev/null +++ b/avr/command_tbl.c @@ -0,0 +1,76 @@ + +#include "common.h" + +#include "command.h" + + + +extern int do_help(cmd_tbl_t *, int, int, char * const []); +extern int do_echo(cmd_tbl_t *, int, int, char * const []); +extern int do_env_print(cmd_tbl_t *, int, int, char * const []); +extern int do_env_set(cmd_tbl_t *, int, int, char * const []); + + +cmd_tbl_t cmd_tbl[] = { + +CMD_TBL_ITEM( + echo, CONFIG_SYS_MAXARGS, 1, do_echo, + "echo args to console", + "[args..]\n" + " - echo args to console; \\c suppresses newline" +), +CMD_TBL_ITEM_COMPLETE( + run, CONFIG_SYS_MAXARGS, 1, do_run, + "run commands in an environment variable", + "var [...]\n" + " - run the commands in the environment variable(s) 'var'", + var_complete +), +CMD_TBL_ITEM_COMPLETE( + printenv, CONFIG_SYS_MAXARGS, 1, do_env_print, + "print environment variables", + "\n - print [all] values of all environment variables\n" + "printenv name ...\n" + " - print value of environment variable 'name'", + var_complete +), +CMD_TBL_ITEM_COMPLETE( + setenv, CONFIG_SYS_MAXARGS, 0, do_env_set, + "set environment variables", + "[-f] name value ...\n" + " - [forcibly] set environment variable 'name' to 'value ...'\n" + "setenv [-f] name\n" + " - [forcibly] delete environment variable 'name'", + var_complete +), +CMD_TBL_ITEM( + help, CONFIG_SYS_MAXARGS, 1, do_help, + "print command description/usage", + "\n" + " - print brief description of all commands\n" + "help command ...\n" + " - print detailed usage of 'command'" +), + +/* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */ + {FSTR("?"), CONFIG_SYS_MAXARGS, 1, do_help, + FSTR("alias for 'help'"), +#ifdef CONFIG_SYS_LONGHELP + FSTR(""), +#endif /* CONFIG_SYS_LONGHELP */ +#ifdef CONFIG_AUTO_COMPLETE + 0, +#endif +}, +/* Mark end of table */ +{ 0 }, +}; + + + + + + + + + -- cgit v1.2.3