From cb93bb9035056f832b72bf7e64c47cff68e40882 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Tue, 11 Oct 2016 16:26:19 -0700 Subject: [PATCH] Use an easily changed constant for timeout. Change-Id: I7aace463b0bd9916580e950d60b2940879b27b2a --- src/target/riscv/riscv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 7bfe93f4e..c21cbcf2a 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -111,6 +111,7 @@ typedef enum slot { /*** Info about the core being debugged. ***/ #define DBUS_ADDRESS_UNKNOWN 0xffff +#define WALL_CLOCK_TIMEOUT 2 // gdb's register list is defined in riscv_gdb_reg_names gdb/riscv-tdep.c in // its source tree. We must interpret the numbers the same here. @@ -715,7 +716,7 @@ static int wait_for_debugint_clear(struct target *target, bool ignore_first) if (!bits.interrupt) { return ERROR_OK; } - if (time(NULL) - start > 2) { + if (time(NULL) - start > WALL_CLOCK_TIMEOUT) { LOG_ERROR("Timed out waiting for debug int to clear."); return ERROR_FAIL; } @@ -1004,7 +1005,7 @@ static int wait_for_state(struct target *target, enum target_state state) if (target->state == state) { return ERROR_OK; } - if (time(NULL) - start > 2) { + if (time(NULL) - start > WALL_CLOCK_TIMEOUT) { LOG_ERROR("Timed out waiting for state %d.", state); return ERROR_FAIL; } @@ -1142,7 +1143,7 @@ static int full_step(struct target *target, bool announce) return result; if (target->state != TARGET_DEBUG_RUNNING) break; - if (time(NULL) - start > 2) { + if (time(NULL) - start > WALL_CLOCK_TIMEOUT) { LOG_ERROR("Timed out waiting for step to complete."); return ERROR_FAIL; }