summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--avr/cmd_attach.c4
-rw-r--r--avr/cmd_boot.c3
-rw-r--r--avr/cmd_date.c4
-rw-r--r--avr/cmd_fat.c4
-rw-r--r--avr/cmd_gpio.c5
-rw-r--r--avr/cmd_loadcpm3.c5
-rw-r--r--avr/cmd_loadihex.c5
-rw-r--r--avr/cmd_misc.c3
-rw-r--r--avr/cmd_run.c6
-rw-r--r--avr/cmd_sd.c4
-rw-r--r--avr/command.c2
-rw-r--r--avr/command_tbl.c44
-rw-r--r--avr/env.c7
-rw-r--r--avr/eval_arg.c4
-rw-r--r--include/cmd_attach.h14
-rw-r--r--include/cmd_boot.h22
-rw-r--r--include/cmd_date.h14
-rw-r--r--include/cmd_fat.h8
-rw-r--r--include/cmd_gpio.h15
-rw-r--r--include/cmd_loadcpm3.h14
-rw-r--r--include/cmd_loadihex.h14
-rw-r--r--include/cmd_mem.h1
-rw-r--r--include/cmd_misc.h15
-rw-r--r--include/cmd_run.h16
-rw-r--r--include/cmd_sd.h16
-rw-r--r--include/command.h2
-rw-r--r--include/common.h3
-rw-r--r--include/debug.h15
-rw-r--r--include/env.h8
29 files changed, 191 insertions, 86 deletions
diff --git a/avr/cmd_attach.c b/avr/cmd_attach.c
index 361ba6d..fcc4f49 100644
--- a/avr/cmd_attach.c
+++ b/avr/cmd_attach.c
@@ -8,9 +8,7 @@
* attach channels to devices
*/
-#include "common.h"
-#include <string.h>
-#include <stdbool.h>
+#include "cmd_attach.h"
#include "command.h"
#include "z180-serv.h"
diff --git a/avr/cmd_boot.c b/avr/cmd_boot.c
index 6e117d9..b4aa5c0 100644
--- a/avr/cmd_boot.c
+++ b/avr/cmd_boot.c
@@ -10,11 +10,10 @@
/*
* Misc boot support
*/
-#include "common.h"
+#include "cmd_boot.h"
#include <ctype.h>
#include <util/atomic.h>
-#include "command.h"
#include "cli_readline.h" /* console_buffer[] */
#include "cli.h" /* run_command() */
#include "env.h"
diff --git a/avr/cmd_date.c b/avr/cmd_date.c
index 91a3d44..cbc4a32 100644
--- a/avr/cmd_date.c
+++ b/avr/cmd_date.c
@@ -10,11 +10,9 @@
/*
* RTC, Date & Time support: get and set date & time
*/
-#include "common.h"
-#include <string.h>
+#include "cmd_date.h"
#include "time.h"
#include "rtc.h"
-#include "command.h"
/*
diff --git a/avr/cmd_fat.c b/avr/cmd_fat.c
index bb0eca1..76304bc 100644
--- a/avr/cmd_fat.c
+++ b/avr/cmd_fat.c
@@ -9,11 +9,7 @@
*/
#include "cmd_fat.h"
-#include "common.h"
-#include <string.h>
-#include <stdbool.h>
-#include "command.h"
#include "ff.h"
#include "z80-if.h"
#include "eval_arg.h"
diff --git a/avr/cmd_gpio.c b/avr/cmd_gpio.c
index 5d7eb6c..8f50ca3 100644
--- a/avr/cmd_gpio.c
+++ b/avr/cmd_gpio.c
@@ -4,12 +4,9 @@
* SPDX-License-Identifier: GPL-2.0
*/
-#include "common.h"
-#include <stdlib.h>
-#include <string.h>
+#include "cmd_gpio.h"
#include <ctype.h>
-#include "command.h"
#include "print-utils.h"
#include "getopt-min.h"
#include "env.h"
diff --git a/avr/cmd_loadcpm3.c b/avr/cmd_loadcpm3.c
index f847290..39e3278 100644
--- a/avr/cmd_loadcpm3.c
+++ b/avr/cmd_loadcpm3.c
@@ -8,12 +8,9 @@
* See CP/M 3 System Manual, Appendix D: CPM3.SYS File Format
*/
-#include "common.h"
+#include "cmd_loadcpm3.h"
#include <ctype.h>
-#include <string.h>
-#include <stdbool.h>
-#include "command.h"
#include "env.h"
#include "ff.h"
#include "eval_arg.h"
diff --git a/avr/cmd_loadihex.c b/avr/cmd_loadihex.c
index ee4b40b..2c0fa9e 100644
--- a/avr/cmd_loadihex.c
+++ b/avr/cmd_loadihex.c
@@ -4,12 +4,9 @@
* SPDX-License-Identifier: GPL-2.0
*/
-#include "common.h"
-#include <stdlib.h>
+#include "cmd_loadihex.h"
#include <ctype.h>
-#include <stdbool.h>
-#include "command.h"
#include "con-utils.h"
#include "z80-if.h"
#include "debug.h"
diff --git a/avr/cmd_misc.c b/avr/cmd_misc.c
index a0ee26e..a88ba72 100644
--- a/avr/cmd_misc.c
+++ b/avr/cmd_misc.c
@@ -7,11 +7,10 @@
* SPDX-License-Identifier: GPL-2.0
*/
-#include "common.h"
+#include "cmd_misc.h"
#include "eval_arg.h"
#include <stdbool.h>
-#include "command.h"
#include "timer.h"
#include "con-utils.h"
#include "getopt-min.h"
diff --git a/avr/cmd_run.c b/avr/cmd_run.c
index 719b9a8..9c6f20f 100644
--- a/avr/cmd_run.c
+++ b/avr/cmd_run.c
@@ -4,13 +4,9 @@
* SPDX-License-Identifier: GPL-2.0
*/
-#include "common.h"
-#include <string.h>
-#include <stdio.h>
+#include "cmd_run.h"
#include "ff.h"
-#include "config.h"
-#include "command.h"
#include "cli_readline.h" /* console_buffer[] */
#include "cli.h" /* run_command() */
#include "env.h"
diff --git a/avr/cmd_sd.c b/avr/cmd_sd.c
index 9cd664b..366bdfc 100644
--- a/avr/cmd_sd.c
+++ b/avr/cmd_sd.c
@@ -4,10 +4,8 @@
* SPDX-License-Identifier: GPL-2.0
*/
-#include "common.h"
-//#include <stdlib.h>
+#include "cmd_sd.h"
-#include "command.h"
#include "diskio.h"
#include "ff.h"
#include "eval_arg.h"
diff --git a/avr/command.c b/avr/command.c
index 938edc3..b9c5e56 100644
--- a/avr/command.c
+++ b/avr/command.c
@@ -497,6 +497,8 @@ command_ret_t cmd_call(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * con
return result;
}
+#pragma GCC diagnostic ignored "-Wclobbered"
+
command_ret_t cmd_process(uint_fast8_t flag, int argc, char * const argv[],
uint_fast8_t *repeatable)
{
diff --git a/avr/command_tbl.c b/avr/command_tbl.c
index 1b34ec1..ce06081 100644
--- a/avr/command_tbl.c
+++ b/avr/command_tbl.c
@@ -7,39 +7,19 @@
#include "common.h"
#include "command.h"
#include "cmd_mem.h"
+#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"
-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 []);
-
-extern cmd_tbl_t cmd_tbl_fat[];
-extern cmd_tbl_t cmd_tbl_sd[];
cmd_tbl_t cmd_tbl[] = {
diff --git a/avr/env.c b/avr/env.c
index 1b2e627..4f37590 100644
--- a/avr/env.c
+++ b/avr/env.c
@@ -4,10 +4,7 @@
* SPDX-License-Identifier: GPL-2.0
*/
-#include "common.h"
-#include <string.h>
-#include <stdlib.h>
-#include <stdbool.h>
+#include "env.h"
#include <avr/eeprom.h>
#include "config.h"
@@ -15,8 +12,6 @@
#include "xmalloc.h"
#include "crc.h"
#include "getopt-min.h"
-#include "command.h"
-#include "env.h"
#define ENV_SIZE (CONFIG_ENV_SIZE - sizeof(uint16_t) -1)
diff --git a/avr/eval_arg.c b/avr/eval_arg.c
index b931509..fd8b067 100644
--- a/avr/eval_arg.c
+++ b/avr/eval_arg.c
@@ -5,12 +5,10 @@
*/
#include "eval_arg.h"
-#include "common.h"
-#include <stdlib.h>
+#include "command.h" /* jump_buf */
#include <ctype.h>
#include <setjmp.h>
#include "print-utils.h"
-#include "command.h" /* jump_buf */
static jmp_buf eval_jbuf;
static char ch;
diff --git a/include/cmd_attach.h b/include/cmd_attach.h
new file mode 100644
index 0000000..2bd7363
--- /dev/null
+++ b/include/cmd_attach.h
@@ -0,0 +1,14 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef CMD_ATTACH_H
+#define CMD_ATTACH_H
+
+#include "command.h"
+
+command_ret_t do_attach(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+
+#endif /* CMD_ATTACH_H */
diff --git a/include/cmd_boot.h b/include/cmd_boot.h
new file mode 100644
index 0000000..015a215
--- /dev/null
+++ b/include/cmd_boot.h
@@ -0,0 +1,22 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef CMD_BOOT_H
+#define CMD_BOOT_H
+
+#include "command.h"
+
+command_ret_t do_loadf(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_bootcf(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_busreq_pulse(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_go(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_restart(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_reset(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]);
+command_ret_t do_console(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+
+
+
+#endif /* CMD_BOOT_H */
diff --git a/include/cmd_date.h b/include/cmd_date.h
new file mode 100644
index 0000000..cd98f2a
--- /dev/null
+++ b/include/cmd_date.h
@@ -0,0 +1,14 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef CMD_DATE_H
+#define CMD_DATE_H
+
+#include "command.h"
+
+command_ret_t do_date(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+
+#endif /* CMD_DATE_H */
diff --git a/include/cmd_fat.h b/include/cmd_fat.h
index 66be559..ed96a52 100644
--- a/include/cmd_fat.h
+++ b/include/cmd_fat.h
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ * (C) Copyright 2014-2018 Leo C. <erbl259-lmu@yahoo.de>
*
* SPDX-License-Identifier: GPL-2.0
*/
@@ -7,6 +7,12 @@
#ifndef CMD_FAT_H
#define CMD_FAT_H
+#include "command.h"
+
+extern cmd_tbl_t cmd_tbl_fat[];
+
+command_ret_t do_fat(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+
void setup_fatfs(void);
#endif /* CMD_FAT_H */
diff --git a/include/cmd_gpio.h b/include/cmd_gpio.h
new file mode 100644
index 0000000..d2f211d
--- /dev/null
+++ b/include/cmd_gpio.h
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef CMD_GPIO_H
+#define CMD_GPIO_H
+
+#include "command.h"
+
+command_ret_t do_gpio(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+
+
+#endif /* CMD_GPIO_H */
diff --git a/include/cmd_loadcpm3.h b/include/cmd_loadcpm3.h
new file mode 100644
index 0000000..5ef2a9d
--- /dev/null
+++ b/include/cmd_loadcpm3.h
@@ -0,0 +1,14 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef CMD_LOADCPM3_H
+#define CMD_LOADCPM3_H
+
+#include "command.h"
+
+command_ret_t do_loadcpm3(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+
+#endif /* CMD_LOADCPM3_H */
diff --git a/include/cmd_loadihex.h b/include/cmd_loadihex.h
new file mode 100644
index 0000000..7ca53cf
--- /dev/null
+++ b/include/cmd_loadihex.h
@@ -0,0 +1,14 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef CMD_LOADIHEX_H
+#define CMD_LOADIHEX_H
+
+#include "command.h"
+
+command_ret_t do_loadihex(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+
+#endif /* CMD_LOADIHEX_H */
diff --git a/include/cmd_mem.h b/include/cmd_mem.h
index 625ab8d..b019d27 100644
--- a/include/cmd_mem.h
+++ b/include/cmd_mem.h
@@ -8,7 +8,6 @@
#define CMD_MEM_H
#include "command.h"
-#include "cmd_mem.h"
extern command_ret_t do_mem_md(cmd_tbl_t *, uint_fast8_t, int, char * const []);
diff --git a/include/cmd_misc.h b/include/cmd_misc.h
new file mode 100644
index 0000000..f0f56a7
--- /dev/null
+++ b/include/cmd_misc.h
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef CMD_MISC_H
+#define CMD_MISC_H
+
+#include "command.h"
+
+command_ret_t do_echo(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]);
+command_ret_t do_sleep(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]);
+
+#endif /* CMD_MISC_H */
diff --git a/include/cmd_run.h b/include/cmd_run.h
new file mode 100644
index 0000000..4691a55
--- /dev/null
+++ b/include/cmd_run.h
@@ -0,0 +1,16 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef CMD_RUN_H
+#define CMD_RUN_H
+
+#include "command.h"
+
+command_ret_t do_source(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_run(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+
+
+#endif /* CMD_RUN_H */
diff --git a/include/cmd_sd.h b/include/cmd_sd.h
new file mode 100644
index 0000000..0a5f5e5
--- /dev/null
+++ b/include/cmd_sd.h
@@ -0,0 +1,16 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef CMD_SD_H
+#define CMD_SD_H
+
+#include "command.h"
+
+extern cmd_tbl_t cmd_tbl_sd[];
+
+command_ret_t do_sd(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+
+#endif /* CMD_SD_H */
diff --git a/include/command.h b/include/command.h
index 2ea7505..e44512e 100644
--- a/include/command.h
+++ b/include/command.h
@@ -124,8 +124,6 @@ static inline int bootm_maybe_autostart(cmd_tbl_t *cmdtp UNUSED, const char *cmd
extern int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
char *const argv[]);
-extern command_ret_t do_reset(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]);
-
/*
* Command Flags:
*/
diff --git a/include/common.h b/include/common.h
index 1064bf3..eb38853 100644
--- a/include/common.h
+++ b/include/common.h
@@ -9,6 +9,9 @@
#include <stdio.h>
#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stdlib.h>
#define GCC_VERSION (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
diff --git a/include/debug.h b/include/debug.h
index 0ee0129..0d60177 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -11,7 +11,16 @@
#ifndef DEBUG_H_
#define DEBUG_H_
-#include "common.h"
+#include "command.h"
+
+command_ret_t do_dump_mem(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_mem_mm_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_mem_nm_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_eep_cp(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_pr_free_avr(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+
+void printfreelist(const char * title);
+
#ifdef DEBUG
#define _DEBUG 1
@@ -43,8 +52,4 @@
#endif
#endif /* 0 */
-
-void printfreelist(const char * title);
-
-
#endif /* DEBUG_H_ */
diff --git a/include/env.h b/include/env.h
index bc44413..1dbe30f 100644
--- a/include/env.h
+++ b/include/env.h
@@ -7,10 +7,14 @@
#ifndef ENV_H
#define ENV_H
-#include <stdbool.h>
+#include "command.h"
-int env_init(void);
+command_ret_t do_env_print(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_env_default(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_env_set(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+command_ret_t do_env_save(cmd_tbl_t *, uint_fast8_t, int, char * const []);
+int env_init(void);
char *getenv_str(const MEMX char *name);
unsigned long getenv_ulong(const MEMX char *name, int base, unsigned long default_val);
bool getenv_yesno(const MEMX char *name);