From e4421799baeba883584beba4bde4183b343ce5e3 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Fri, 14 May 2021 22:25:39 +0200 Subject: [PATCH] More header cleanup --- src/platforms/common/cdcacm.c | 1 - src/platforms/hosted/bmp_remote.c | 2 -- src/platforms/hosted/bmp_serial.c | 4 +--- src/platforms/hosted/cmsis_dap.h | 2 +- src/platforms/hosted/dap.c | 1 - src/platforms/hosted/ftdi_bmp.c | 1 - src/platforms/hosted/jlink_jtagtap.c | 5 +---- src/platforms/hosted/jtagtap.c | 0 src/platforms/hosted/libftdi_jtagtap.c | 5 +---- src/platforms/hosted/libftdi_swdptap.c | 4 +--- src/platforms/hosted/remote_jtagtap.c | 4 +--- src/platforms/hosted/swdptap.c | 0 src/platforms/pc/cl_utils.c | 2 -- src/platforms/pc/gdb_if.c | 4 +--- src/platforms/pc/hid.c | 4 +--- src/platforms/pc/serial_unix.c | 7 +++---- src/platforms/pc/serial_win.c | 1 - src/platforms/pc/utils.c | 9 ++++++++- src/remote.c | 1 - src/target/cortexm.c | 1 - src/target/target.c | 2 -- 21 files changed, 19 insertions(+), 41 deletions(-) delete mode 100644 src/platforms/hosted/jtagtap.c delete mode 100644 src/platforms/hosted/swdptap.c diff --git a/src/platforms/common/cdcacm.c b/src/platforms/common/cdcacm.c index b28f197..b1a9126 100644 --- a/src/platforms/common/cdcacm.c +++ b/src/platforms/common/cdcacm.c @@ -41,7 +41,6 @@ #include #include #include -#include #define DFU_IF_NO 4 diff --git a/src/platforms/hosted/bmp_remote.c b/src/platforms/hosted/bmp_remote.c index b8dc1d2..1ca6862 100644 --- a/src/platforms/hosted/bmp_remote.c +++ b/src/platforms/hosted/bmp_remote.c @@ -22,7 +22,6 @@ #include "general.h" #include "gdb_if.h" #include "version.h" -#include "platform.h" #include "remote.h" #include "target.h" #include "bmp_remote.h" @@ -33,7 +32,6 @@ #include #include #include -#include #include "adiv5.h" diff --git a/src/platforms/hosted/bmp_serial.c b/src/platforms/hosted/bmp_serial.c index a7baa77..4f0333c 100644 --- a/src/platforms/hosted/bmp_serial.c +++ b/src/platforms/hosted/bmp_serial.c @@ -19,11 +19,9 @@ /* Find all known serial connected debuggers */ +#include "general.h" #include #include -#include -#include "general.h" -#include "platform.h" #include "bmp_hosted.h" #include "version.h" diff --git a/src/platforms/hosted/cmsis_dap.h b/src/platforms/hosted/cmsis_dap.h index d23726d..9e8054f 100644 --- a/src/platforms/hosted/cmsis_dap.h +++ b/src/platforms/hosted/cmsis_dap.h @@ -47,7 +47,7 @@ int cmsis_dap_jtagtap_init(jtag_proc_t *jtag_proc) {return -1;} int dap_swdptap_init(swd_proc_t *swd_proc) {return -1;} int dap_jtag_dp_init(ADIv5_DP_t *dp) {return -1;} void dap_swd_configure(uint8_t cfg) {}; -## pragma GCC diagnostic pop +# pragma GCC diagnostic pop #endif diff --git a/src/platforms/hosted/dap.c b/src/platforms/hosted/dap.c index 9d93ab7..5acc03e 100644 --- a/src/platforms/hosted/dap.c +++ b/src/platforms/hosted/dap.c @@ -32,7 +32,6 @@ /*- Includes ----------------------------------------------------------------*/ #include -#include #include "dap.h" #include "jtag_scan.h" diff --git a/src/platforms/hosted/ftdi_bmp.c b/src/platforms/hosted/ftdi_bmp.c index 77cb369..5386815 100644 --- a/src/platforms/hosted/ftdi_bmp.c +++ b/src/platforms/hosted/ftdi_bmp.c @@ -20,7 +20,6 @@ */ #include "general.h" #include "gdb_if.h" -#include "platform.h" #include "target.h" #include diff --git a/src/platforms/hosted/jlink_jtagtap.c b/src/platforms/hosted/jlink_jtagtap.c index 3903fe5..17dd3a2 100644 --- a/src/platforms/hosted/jlink_jtagtap.c +++ b/src/platforms/hosted/jlink_jtagtap.c @@ -21,13 +21,10 @@ * */ -#include +#include "general.h" #include -#include -#include #include -#include "general.h" #include "exception.h" #include "jlink.h" diff --git a/src/platforms/hosted/jtagtap.c b/src/platforms/hosted/jtagtap.c deleted file mode 100644 index e69de29..0000000 diff --git a/src/platforms/hosted/libftdi_jtagtap.c b/src/platforms/hosted/libftdi_jtagtap.c index 905faaf..9443df5 100644 --- a/src/platforms/hosted/libftdi_jtagtap.c +++ b/src/platforms/hosted/libftdi_jtagtap.c @@ -22,15 +22,12 @@ * */ -#include +#include "general.h" #include -#include #include #include -#include "platform.h" #include "ftdi_bmp.h" -#include "general.h" extern cable_desc_t *active_cable; extern struct ftdi_context *ftdic; diff --git a/src/platforms/hosted/libftdi_swdptap.c b/src/platforms/hosted/libftdi_swdptap.c index 13a981b..4878437 100644 --- a/src/platforms/hosted/libftdi_swdptap.c +++ b/src/platforms/hosted/libftdi_swdptap.c @@ -21,12 +21,10 @@ * Speed is sensible. */ -#include +#include "general.h" #include -#include "general.h" #include -#include "platform.h" #include "ftdi_bmp.h" enum swdio_status{ diff --git a/src/platforms/hosted/remote_jtagtap.c b/src/platforms/hosted/remote_jtagtap.c index d98663b..601a3e9 100644 --- a/src/platforms/hosted/remote_jtagtap.c +++ b/src/platforms/hosted/remote_jtagtap.c @@ -26,13 +26,11 @@ * Should share interface with swdptap.c or at least clean up... */ -#include +#include "general.h" #include -#include #include -#include "general.h" #include "remote.h" #include "jtagtap.h" #include "bmp_remote.h" diff --git a/src/platforms/hosted/swdptap.c b/src/platforms/hosted/swdptap.c deleted file mode 100644 index e69de29..0000000 diff --git a/src/platforms/pc/cl_utils.c b/src/platforms/pc/cl_utils.c index b67bd9b..a70074c 100644 --- a/src/platforms/pc/cl_utils.c +++ b/src/platforms/pc/cl_utils.c @@ -24,12 +24,10 @@ #include "general.h" #include -#include #include #include #include #include "version.h" -#include "target.h" #include "target_internal.h" #include "cortexm.h" #include "command.h" diff --git a/src/platforms/pc/gdb_if.c b/src/platforms/pc/gdb_if.c index 35c1261..2734a7e 100644 --- a/src/platforms/pc/gdb_if.c +++ b/src/platforms/pc/gdb_if.c @@ -36,13 +36,11 @@ # include #endif -#include +#include "general.h" #include #include -#include #include -#include "general.h" #include "gdb_if.h" static int gdb_if_serv, gdb_if_conn; diff --git a/src/platforms/pc/hid.c b/src/platforms/pc/hid.c index 3d0425c..75fc309 100755 --- a/src/platforms/pc/hid.c +++ b/src/platforms/pc/hid.c @@ -61,9 +61,7 @@ extern "C" { } /* extern "C" */ #endif -#include -#include - +#include #include "hidapi.h" diff --git a/src/platforms/pc/serial_unix.c b/src/platforms/pc/serial_unix.c index c4f4f74..08f0113 100644 --- a/src/platforms/pc/serial_unix.c +++ b/src/platforms/pc/serial_unix.c @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include +#include "general.h" #include #include #include @@ -25,9 +25,7 @@ #include #include #include -#include -#include "general.h" #include "remote.h" #include "cl_utils.h" #include "cortexm.h" @@ -61,8 +59,9 @@ static int set_interface_attribs(void) tty.c_cflag |= (CLOCAL | CREAD);// ignore modem controls, // enable reading tty.c_cflag &= ~CSTOPB; +#if defined(CRTSCTS) tty.c_cflag &= ~CRTSCTS; - +#endif if (tcsetattr (fd, TCSANOW, &tty) != 0) { DEBUG_WARN("error %d from tcsetattr", errno); return -1; diff --git a/src/platforms/pc/serial_win.c b/src/platforms/pc/serial_win.c index 57f7806..b08e87e 100644 --- a/src/platforms/pc/serial_win.c +++ b/src/platforms/pc/serial_win.c @@ -17,7 +17,6 @@ * along with this program. If not, see . */ -#include #include "general.h" #include #include "remote.h" diff --git a/src/platforms/pc/utils.c b/src/platforms/pc/utils.c index b74c8ae..e5de714 100644 --- a/src/platforms/pc/utils.c +++ b/src/platforms/pc/utils.c @@ -44,7 +44,14 @@ int vasprintf(char **strp, const char *fmt, va_list ap) void platform_delay(uint32_t ms) { - usleep(ms * 1000); +#if defined(_WIN32) && !defined(__MINGW32__) + Sleep(ms); +#else +# if !defined(usleep) + int usleep(unsigned int); +# endif + usleep(ms); +#endif } uint32_t platform_time_ms(void) diff --git a/src/remote.c b/src/remote.c index 955c2f1..691f1e9 100644 --- a/src/remote.c +++ b/src/remote.c @@ -24,7 +24,6 @@ #include "gdb_packet.h" #include "jtagtap.h" #include "gdb_if.h" -#include "platform.h" #include "version.h" #include "exception.h" #include diff --git a/src/target/cortexm.c b/src/target/cortexm.c index 32c262d..36a472b 100644 --- a/src/target/cortexm.c +++ b/src/target/cortexm.c @@ -33,7 +33,6 @@ #include "target.h" #include "target_internal.h" #include "cortexm.h" -#include "platform.h" #include "command.h" #include "gdb_packet.h" diff --git a/src/target/target.c b/src/target/target.c index c17e915..4f4bcac 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -19,7 +19,6 @@ */ #include "general.h" -#include "target.h" #include "target_internal.h" #include @@ -342,7 +341,6 @@ void target_detach(target *t) t->detach(t); t->attached = false; #if PC_HOSTED == 1 -# include "platform.h" platform_buffer_flush(); #endif }