From c4a2fdbc39dd31170e61e7fe0be332826825acbd Mon Sep 17 00:00:00 2001 From: oharboe Date: Fri, 11 Apr 2008 14:06:42 +0000 Subject: Reset wip. Just adding hooks. This is just to reduce the size of the actual change, no change in behaviour. git-svn-id: svn://svn.berlios.de/openocd/trunk@565 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/jtag/jtag.c | 13 +++++++++---- src/jtag/jtag.h | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/jtag') diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index 8ebd92b1..fa439ec5 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -1482,6 +1482,9 @@ int jtag_register_commands(struct command_context_s *cmd_ctx) int jtag_interface_init(struct command_context_s *cmd_ctx) { + if (jtag) + return ERROR_OK; + if (!jtag_interface) { /* nothing was previously specified by "interface" command */ @@ -1511,11 +1514,12 @@ static int jtag_init_inner(struct command_context_s *cmd_ctx) { int validate_tries = 0; jtag_device_t *device; + int retval; LOG_DEBUG("-"); - if (!jtag && jtag_interface_init(cmd_ctx) != ERROR_OK) - return ERROR_JTAG_INIT_FAILED; + if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK) + return retval; device = jtag_devices; jtag_ir_scan_size = 0; @@ -1528,7 +1532,8 @@ static int jtag_init_inner(struct command_context_s *cmd_ctx) } jtag_add_tlr(); - jtag_execute_queue(); + if ((retval=jtag_execute_queue())==ERROR_OK) + return retval; /* examine chain first, as this could discover the real chain layout */ if (jtag_examine_chain() != ERROR_OK) @@ -1930,7 +1935,7 @@ int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_COMMAND_SYNTAX_ERROR; } - if (!jtag && jtag_interface_init(cmd_ctx) != ERROR_OK) + if (jtag_interface_init(cmd_ctx) != ERROR_OK) return ERROR_JTAG_INIT_FAILED; jtag_add_reset(trst, srst); diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index b7ce094d..27ffbf87 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -241,6 +241,10 @@ enum reset_types extern enum reset_types jtag_reset_config; +/* initialize interface upon startup. A successful no-op + * upon subsequent invocations + */ +extern int jtag_interface_init(struct command_context_s *cmd_ctx); /* initialize JTAG chain using only a TLR reset. If init fails, * try reset + init. */ -- cgit v1.2.3