From 9a69c1c096a5498900c997daa17f23fbc5d7b87d Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Fri, 20 Apr 2018 16:28:24 -0700 Subject: [PATCH] Fix mingw32 build. Change-Id: If7a57749ba8c49385a4020ce8d2d8dbb94242122 --- src/helper/log.h | 3 ++- src/target/riscv/riscv-013.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/helper/log.h b/src/helper/log.h index c2398ca7b..d60587f72 100644 --- a/src/helper/log.h +++ b/src/helper/log.h @@ -149,7 +149,8 @@ extern int debug_level; */ #define ERROR_FAIL (-4) #define ERROR_WAIT (-5) -#define ERROR_TIMEOUT (-6) +/* ERROR_TIMEOUT is already taken by winerror.h. */ +#define ERROR_TIMEOUT_REACHED (-6) #endif /* OPENOCD_HELPER_LOG_H */ diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 116d82a76..9a628bbc8 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -521,7 +521,7 @@ static int dmi_op_timeout(struct target *target, uint32_t *data_in, int dmi_op, return ERROR_FAIL; } if (time(NULL) - start > timeout_sec) - return ERROR_TIMEOUT; + return ERROR_TIMEOUT_REACHED; } if (status != DMI_STATUS_SUCCESS) { @@ -545,7 +545,7 @@ static int dmi_op_timeout(struct target *target, uint32_t *data_in, int dmi_op, return ERROR_FAIL; } if (time(NULL) - start > timeout_sec) - return ERROR_TIMEOUT; + return ERROR_TIMEOUT_REACHED; } if (status != DMI_STATUS_SUCCESS) { @@ -567,7 +567,7 @@ static int dmi_op(struct target *target, uint32_t *data_in, int dmi_op, { int result = dmi_op_timeout(target, data_in, dmi_op, address, data_out, riscv_command_timeout_sec); - if (result == ERROR_TIMEOUT) { + if (result == ERROR_TIMEOUT_REACHED) { LOG_ERROR("DMI operation didn't complete in %d seconds. The target is " "either really slow or broken. You could increase the " "timeout with riscv set_command_timeout_sec.", @@ -1619,7 +1619,7 @@ static int deassert_reset(struct target *target) while (1) { int result = dmstatus_read_timeout(target, &dmstatus, true, riscv_reset_timeout_sec); - if (result == ERROR_TIMEOUT) + if (result == ERROR_TIMEOUT_REACHED) LOG_ERROR("Hart %d didn't complete a DMI read coming out of " "reset in %ds; Increase the timeout with riscv " "set_reset_timeout_sec.",