From c25fda2c95f130d758c7784277fe5f2693ff3dd4 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sun, 14 Mar 2010 13:13:39 -0700 Subject: [PATCH] rename jtag_interface_{init,quit}() These routines apply to non-JTAG debug adapters too. To reduce confusion, give them better (non-misleading) names. Signed-off-by: David Brownell --- src/jtag/core.c | 18 ++++++++++++------ src/jtag/jtag.h | 11 ++++------- src/jtag/tcl.c | 2 +- src/openocd.c | 8 ++++---- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/jtag/core.c b/src/jtag/core.c index 706f2f2595..e7cb48d764 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -1346,7 +1346,11 @@ void jtag_tap_free(struct jtag_tap *tap) free(tap); } -int jtag_interface_init(struct command_context *cmd_ctx) +/** + * Do low-level setup like initializing registers, output signals, + * and clocking. + */ +int adapter_init(struct command_context *cmd_ctx) { if (jtag) return ERROR_OK; @@ -1354,7 +1358,8 @@ int jtag_interface_init(struct command_context *cmd_ctx) if (!jtag_interface) { /* nothing was previously specified by "interface" command */ - LOG_ERROR("JTAG interface has to be specified, see \"interface\" command"); + LOG_ERROR("Debug Adapter has to be specified, " + "see \"interface\" command"); return ERROR_JTAG_INVALID_INTERFACE; } @@ -1369,9 +1374,10 @@ int jtag_interface_init(struct command_context *cmd_ctx) int actual_khz = requested_khz; int retval = jtag_get_speed_readable(&actual_khz); if (ERROR_OK != retval) - LOG_INFO("interface specific clock speed value %d", jtag_get_speed()); + LOG_INFO("adapter-specific clock speed value %d", jtag_get_speed()); else if (actual_khz) { + /* Adaptive clocking -- JTAG-specific */ if ((CLOCK_MODE_RCLK == clock_mode) || ((CLOCK_MODE_KHZ == clock_mode) && !requested_khz)) { @@ -1459,7 +1465,7 @@ int jtag_init_inner(struct command_context *cmd_ctx) return ERROR_OK; } -int jtag_interface_quit(void) +int adapter_quit(void) { if (!jtag || !jtag->quit) return ERROR_OK; @@ -1477,7 +1483,7 @@ int jtag_init_reset(struct command_context *cmd_ctx) { int retval; - if ((retval = jtag_interface_init(cmd_ctx)) != ERROR_OK) + if ((retval = adapter_init(cmd_ctx)) != ERROR_OK) return retval; LOG_DEBUG("Initializing with hard TRST+SRST reset"); @@ -1531,7 +1537,7 @@ int jtag_init(struct command_context *cmd_ctx) { int retval; - if ((retval = jtag_interface_init(cmd_ctx)) != ERROR_OK) + if ((retval = adapter_init(cmd_ctx)) != ERROR_OK) return retval; /* guard against oddball hardware: force resets to be inactive */ diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index ae85961818..0bbea5f561 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -305,14 +305,11 @@ void jtag_set_verify_capture_ir(bool enable); /// @returns True if IR scan verification will be performed. bool jtag_will_verify_capture_ir(void); -/** - * Initialize interface upon startup. Return a successful no-op upon - * subsequent invocations. - */ -int jtag_interface_init(struct command_context* cmd_ctx); +/** Initialize debug adapter upon startup. */ +int adapter_init(struct command_context* cmd_ctx); -/// Shutdown the JTAG interface upon program exit. -int jtag_interface_quit(void); +/// Shutdown the debug adapter upon program exit. +int adapter_quit(void); /** * Initialize JTAG chain using only a RESET reset. If init fails, diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 3ffa930d0b..ce17e4b85a 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -1430,7 +1430,7 @@ COMMAND_HANDLER(handle_jtag_reset_command) else return ERROR_COMMAND_SYNTAX_ERROR; - if (jtag_interface_init(CMD_CTX) != ERROR_OK) + if (adapter_init(CMD_CTX) != ERROR_OK) return ERROR_JTAG_INIT_FAILED; jtag_add_reset(trst, srst); diff --git a/src/openocd.c b/src/openocd.c index 4250434355..d376f5f8e1 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -115,12 +115,12 @@ COMMAND_HANDLER(handle_init_command) if (ERROR_OK != retval) return ERROR_FAIL; - if ((retval = jtag_interface_init(CMD_CTX)) != ERROR_OK) + if ((retval = adapter_init(CMD_CTX)) != ERROR_OK) { - /* we must be able to set up the jtag interface */ + /* we must be able to set up the debug adapter */ return retval; } - LOG_DEBUG("jtag interface init complete"); + LOG_DEBUG("Debug Adapter init complete"); /* Try to initialize & examine the JTAG chain at this point, * but continue startup regardless. Note that platforms @@ -297,7 +297,7 @@ int openocd_main(int argc, char *argv[]) /* free commandline interface */ command_done(cmd_ctx); - jtag_interface_quit(); + adapter_quit(); return ret; } -- 2.30.2