]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/command_tbl.c
Find subcommands without prefix
[z180-stamp.git] / avr / command_tbl.c
index ba9293325c34e41ecf37723bba6967732b439392..07c96843b05deaf1387573ebf97972a631ff349b 100644 (file)
@@ -7,43 +7,18 @@
 #include "common.h"
 #include "command.h"
 #include "cmd_mem.h"
-
-extern command_ret_t do_help(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_echo(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_sleep(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_env_print(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_env_default(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_env_set(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_env_save(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_loadf(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_bootcf(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_loadcpm3(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_loadihex(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-#if defined(CONFIG_CMD_LOADB)
-extern command_ret_t do_load_serial_bin(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-#endif
-extern command_ret_t do_go(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_restart(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_console(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_dump_mem(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_mem_mm_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_mem_nm_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_eep_cp(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_busreq_pulse(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_date(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_gpio(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_sd(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_fat(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_run(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_source(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_attach(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-extern command_ret_t do_pr_free_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []);
-
-#ifdef CONFIG_SYS_LONGHELP
-const FLASH char sd_help_text[] =
-       "bla \t- do bla\n"
-       ;
-#endif /* CONFIG_SYS_LONGHELP */
+#include "cmd_boot.h"
+#include "cmd_misc.h"
+#include "cmd_date.h"
+#include "cmd_run.h"
+#include "cmd_loadcpm3.h"
+#include "cmd_loadihex.h"
+#include "cmd_gpio.h"
+#include "cmd_sd.h"
+#include "cmd_fat.h"
+#include "cmd_attach.h"
+#include "env.h"
+#include "debug.h"
 
 
 cmd_tbl_t cmd_tbl[] = {
@@ -343,19 +318,21 @@ CMD_TBL_ITEM(
 ),
 #endif /* CONFIG_MX_CYCLIC */
 
-CMD_TBL_ITEM(
-       sd,   CONFIG_SYS_MAXARGS, 1, do_sd,
+CMD_TBL_ITEM_TOP(
+       sd,   CONFIG_SYS_MAXARGS, CTBL_SUBCMDAUTO, do_sd,
        "SD/MMC card handling commands",
        "<subcommand> args ...\n"
        "sd help\n"
-       "    - print help on subcommands"
+       "    - print help on subcommands",
+       cmd_tbl_sd
 ),
-CMD_TBL_ITEM(
-       fat,   CONFIG_SYS_MAXARGS, 1, do_fat,
+CMD_TBL_ITEM_TOP(
+       fat,   CONFIG_SYS_MAXARGS, CTBL_SUBCMD|CTBL_SUBCMDAUTO, do_fat,
        "fat filesystem commands",
        "<subcommand> args ...\n"
        "fat help\n"
-       "    - print help on subcommands"
+       "    - print help on subcommands",
+       cmd_tbl_fat
 ),
 
 CMD_TBL_ITEM(
@@ -379,7 +356,7 @@ CMD_TBL_ITEM(
        "    -a      Detach all.\n"
        "\n"
        "attach\n"
-       "    Without arguments, list current assignments\n"
+       "    Without arguments, list current assignments"
 ),
 CMD_TBL_ITEM(
        detach, 2,      CTBL_REPEAT,    do_attach,
@@ -403,10 +380,11 @@ CMD_TBL_ITEM(
 #ifdef  CONFIG_SYS_LONGHELP
        FSTR(""),
 #endif /* CONFIG_SYS_LONGHELP */
+       NULL,
 #ifdef CONFIG_AUTO_COMPLETE
-       0,
+       NULL,
 #endif
 },
 /* Mark end of table */
-{ 0 },
+CMD_TBL_END(cmd_tbl)
 };