]> cloudbase.mooo.com Git - z180-stamp.git/commitdiff
Remove extern declarations from command_tbl.c, create .h files for that.
authorLeo C <erbl259-lmu@yahoo.de>
Sun, 8 Apr 2018 12:35:22 +0000 (14:35 +0200)
committerLeo C <erbl259-lmu@yahoo.de>
Sun, 8 Apr 2018 12:35:22 +0000 (14:35 +0200)
29 files changed:
avr/cmd_attach.c
avr/cmd_boot.c
avr/cmd_date.c
avr/cmd_fat.c
avr/cmd_gpio.c
avr/cmd_loadcpm3.c
avr/cmd_loadihex.c
avr/cmd_misc.c
avr/cmd_run.c
avr/cmd_sd.c
avr/command.c
avr/command_tbl.c
avr/env.c
avr/eval_arg.c
include/cmd_attach.h [new file with mode: 0644]
include/cmd_boot.h [new file with mode: 0644]
include/cmd_date.h [new file with mode: 0644]
include/cmd_fat.h
include/cmd_gpio.h [new file with mode: 0644]
include/cmd_loadcpm3.h [new file with mode: 0644]
include/cmd_loadihex.h [new file with mode: 0644]
include/cmd_mem.h
include/cmd_misc.h [new file with mode: 0644]
include/cmd_run.h [new file with mode: 0644]
include/cmd_sd.h [new file with mode: 0644]
include/command.h
include/common.h
include/debug.h
include/env.h

index 361ba6da71949873d73982c92d308b1a6cf7d536..fcc4f4951e02ae07249f4e6104b3253d756c2dbf 100644 (file)
@@ -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"
index 6e117d9ef9eeea6da1c4dbdfb3e8cf2c4ef871a7..b4aa5c027c8e75f66ec1d68c7ecf4b4f9e499118 100644 (file)
 /*
  * 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"
index 91a3d4439dbe9816817ead63d936dc097fc4b22f..cbc4a32088ec2996095af7102e148a5be1f04ca1 100644 (file)
 /*
  * 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"
 
 
 /*
index 9e3114dc1377e8295d4e11a592a9e81de89d82db..cd35c8abe7e72ae2ccceb42a8a0fac73f9b3206c 100644 (file)
@@ -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"
index 5d7eb6cdd149eebdbd4d67ecfe35697505913ca4..8f50ca3a2cfd9c59fd2a4bd86e9e93534e0ec599 100644 (file)
@@ -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"
index f847290a8ef0be32fa8af4feb3ca6aa5fd220b97..39e3278eee9def269fd31e3892ee5438a70c0ae6 100644 (file)
@@ -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"
index ee4b40b8bd35e730f6347bbd0e53210d6b479a00..2c0fa9e709eca2f3641fac13fa79fbc14c137236 100644 (file)
@@ -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"
index a0ee26e7afedafd9e91b59f3a273d072bc66007f..a88ba7292e57d71c541a4fa4cc2a6cb0c7f9949e 100644 (file)
@@ -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"
index 6ad758bf9e7705f0eade7b9ce8188d06bda0762a..467739c6daff5c1744fc84d31f26e409bb986db4 100644 (file)
@@ -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"
index 10b5bb5d8e79066747e53f3ad6575089fcaf55f1..e2adbe795e678e579e2c972b5288f713c6c206ca 100644 (file)
@@ -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"
index 938edc33d88962e7f5291ae1f6bfdd2bbc694621..b9c5e56f6985a27d98ce31011be11aab582f5e26 100644 (file)
@@ -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)
 {
index 61804286971769c6dd82beb1fcda3972a1111725..b65db5468661917adff02ee5636b8324e257e17f 100644 (file)
@@ -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[] = {
 
index 39effac509419425b9fdd4c10b4c6fac94d26e97..3a123255ca01633144d0a635275fa3e977ec9176 100644 (file)
--- a/avr/env.c
+++ b/avr/env.c
@@ -4,18 +4,13 @@
  * 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"
 #include "debug.h"
 #include "xmalloc.h"
 #include "crc.h"
-#include "command.h"
-#include "env.h"
 
 
 #define ENV_SIZE       (CONFIG_ENV_SIZE - sizeof(uint16_t) -1)
index b93150935cdb1983dabf8b66ff2ee39b3d81307d..fd8b067acf53bed4339feed7a82045cec96db2c2 100644 (file)
@@ -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 (file)
index 0000000..2bd7363
--- /dev/null
@@ -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 (file)
index 0000000..015a215
--- /dev/null
@@ -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 (file)
index 0000000..cd98f2a
--- /dev/null
@@ -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 */
index 66be55989e92b8da574cdfc6abe6768e27ac6ec6..ed96a524d143d8a1f0262ae8f3dc8616e889a3b6 100644 (file)
@@ -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 (file)
index 0000000..d2f211d
--- /dev/null
@@ -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 (file)
index 0000000..5ef2a9d
--- /dev/null
@@ -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 (file)
index 0000000..7ca53cf
--- /dev/null
@@ -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 */
index 625ab8dfaa6d3f9dd77b5234371c0f40848502b5..b019d27e023690deb0382209ddafafa519901efc 100644 (file)
@@ -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 (file)
index 0000000..f0f56a7
--- /dev/null
@@ -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 (file)
index 0000000..4691a55
--- /dev/null
@@ -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 (file)
index 0000000..0a5f5e5
--- /dev/null
@@ -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 */
index 2ea7505039d261307066d2a9cb54b67750ff82aa..e44512e4b492fb4fb8eed7bd8ad0ad4bde14ca54 100644 (file)
@@ -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:
  */
index 1064bf3d050272d8711a535e125b311e62ca2000..eb38853cbe96ad0f8870df023a1bd32691079949 100644 (file)
@@ -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__)
 
index 0ee0129fa45dae5ebeeb14a71f2f7f43b7c0a881..0d60177eaa16d71c8007765d62f33663ed595cd7 100644 (file)
 #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_ */
index bc4441302bc3ef18c919cfd0894bab86da4df051..1dbe30f413cf33e02c99882c5bcf2d932afed62f 100644 (file)
@@ -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);