From 62d9f60f03ea3c8c6b0e865d827c88d6d27066a5 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Sun, 8 Nov 2020 16:18:11 +0100 Subject: [PATCH] hosted/firmware: Waits for read response as long as cortexm_wait_timeout. --- src/platforms/pc/cl_utils.h | 2 +- src/platforms/pc/serial_unix.c | 3 ++- src/platforms/pc/serial_win.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/platforms/pc/cl_utils.h b/src/platforms/pc/cl_utils.h index f6f7b1f..1560672 100644 --- a/src/platforms/pc/cl_utils.h +++ b/src/platforms/pc/cl_utils.h @@ -24,7 +24,7 @@ #if !defined(__CL_UTILS_H) #define __CL_UTILS_H -#define RESP_TIMEOUT (100) +#include "cortexm.h" enum bmp_cl_mode { BMP_MODE_DEBUG, diff --git a/src/platforms/pc/serial_unix.c b/src/platforms/pc/serial_unix.c index aa7d30d..1100035 100644 --- a/src/platforms/pc/serial_unix.c +++ b/src/platforms/pc/serial_unix.c @@ -29,6 +29,7 @@ #include "general.h" #include "remote.h" #include "cl_utils.h" +#include "cortexm.h" static int fd; /* File descriptor for connection to GDB remote */ @@ -189,7 +190,7 @@ int platform_buffer_read(uint8_t *data, int maxsize) c = data; tv.tv_sec = 0; - tv.tv_usec = 1000 * RESP_TIMEOUT; + tv.tv_usec = 1000 * cortexm_wait_timeout; /* Look for start of response */ do { diff --git a/src/platforms/pc/serial_win.c b/src/platforms/pc/serial_win.c index 4290428..86ac364 100644 --- a/src/platforms/pc/serial_win.c +++ b/src/platforms/pc/serial_win.c @@ -145,7 +145,7 @@ int platform_buffer_read(uint8_t *data, int maxsize) DWORD s; uint8_t response = 0; uint32_t startTime = platform_time_ms(); - uint32_t endTime = platform_time_ms() + RESP_TIMEOUT; + uint32_t endTime = platform_time_ms() + cortexm_wait_timeout; do { if (!ReadFile(hComm, &response, 1, &s, NULL)) { DEBUG_WARN("ERROR on read RESP\n");