From 55be316dbf13dcb1cc54c41330ac37960e82630e Mon Sep 17 00:00:00 2001 From: zwelch Date: Tue, 9 Jun 2009 08:41:00 +0000 Subject: Cleanup and encapsulate IR Capture verification: - Add accessors for setting the jtag_verify_capture_ir flag. - Use them in handle_verify_ircapture_cpmmand - Change variable type to bool; make it static. git-svn-id: svn://svn.berlios.de/openocd/trunk@2164 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/jtag/core.c | 11 ++++++++++- src/jtag/jtag.h | 5 +++-- src/jtag/tcl.c | 20 ++++++++------------ 3 files changed, 21 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/jtag/core.c b/src/jtag/core.c index 4c393dc2..165e1966 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -87,7 +87,7 @@ static enum reset_types jtag_reset_config = RESET_NONE; static tap_state_t cmd_queue_end_state = TAP_RESET; tap_state_t cmd_queue_cur_state = TAP_RESET; -int jtag_verify_capture_ir = 1; +static bool jtag_verify_capture_ir = true; static int jtag_verify = 1; /* how long the OpenOCD should wait before attempting JTAG communication after reset lines deasserted (in ms) */ @@ -1201,6 +1201,15 @@ bool jtag_will_verify() return jtag_verify; } +void jtag_set_verify_capture_ir(bool enable) +{ + jtag_verify_capture_ir = enable; +} + +bool jtag_will_verify_capture_ir() +{ + return jtag_verify_capture_ir; +} int jtag_power_dropout(int *dropout) { diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index d7698ac7..be6a055c 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -611,8 +611,6 @@ extern void jtag_sleep(u32 us); extern int jtag_call_event_callbacks(enum jtag_event event); extern int jtag_register_event_callback(int (* callback)(enum jtag_event event, void* priv), void* priv); -extern int jtag_verify_capture_ir; - void jtag_tap_handle_event(jtag_tap_t* tap, enum jtag_tap_event e); /* @@ -708,4 +706,7 @@ unsigned jtag_get_speed_khz(void); void jtag_set_verify(bool enable); bool jtag_will_verify(void); +void jtag_set_verify_capture_ir(bool enable); +bool jtag_will_verify_capture_ir(void); + #endif /* JTAG_H */ diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 121c19ab..1ec307ab 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -1304,25 +1304,21 @@ static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { + if (argc > 1) + return ERROR_COMMAND_SYNTAX_ERROR; + if (argc == 1) { if (strcmp(args[0], "enable") == 0) - { - jtag_verify_capture_ir = 1; - } + jtag_set_verify_capture_ir(true); else if (strcmp(args[0], "disable") == 0) - { - jtag_verify_capture_ir = 0; - } else - { + jtag_set_verify_capture_ir(false); + else return ERROR_COMMAND_SYNTAX_ERROR; - } - } else if (argc != 0) - { - return ERROR_COMMAND_SYNTAX_ERROR; } - command_print(cmd_ctx, "verify Capture-IR is %s", (jtag_verify_capture_ir) ? "enabled": "disabled"); + const char *status = jtag_will_verify_capture_ir() ? "enabled": "disabled"; + command_print(cmd_ctx, "verify Capture-IR is %s", status); return ERROR_OK; } -- cgit v1.2.3