- Set up ICE registers after TRST
[openocd.git] / src / jtag / jtag.c
index b177c8e2434d9f41b2ea7b0d9348b9b1084bc035..fe76a32213067e4510fa215e805e2b8256e77368 100644 (file)
@@ -1288,8 +1288,6 @@ void jtag_sleep(u32 us)
        usleep(us);
 }
 
-int cwvx_device_num = -1, cwvx_version_num, cwvx_part_num;
-
 /* Try to examine chain layout according to IEEE 1149.1 ยง12
  */
 int jtag_examine_chain()
@@ -1370,13 +1368,6 @@ int jtag_examine_chain()
                        LOG_INFO("JTAG device found: 0x%8.8x (Manufacturer: 0x%3.3x, Part: 0x%4.4x, Version: 0x%1.1x)", 
                                idcode, manufacturer, part, version);
                        
-                       /* Total hacky hack!    PORGES */
-                       if (manufacturer == 0x1a2) {
-                           cwvx_device_num = device_count-1;
-                           cwvx_part_num = part;
-                           cwvx_version_num = version;
-                       }
-                       
                        bit_count += 32;
                }
        }
@@ -1491,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 */
@@ -1520,12 +1514,10 @@ 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;
-
        device = jtag_devices;
        jtag_ir_scan_size = 0;
        jtag_num_devices = 0;
@@ -1537,7 +1529,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)
@@ -1563,6 +1556,10 @@ static int jtag_init_inner(struct command_context_s *cmd_ctx)
 int jtag_init_reset(struct command_context_s *cmd_ctx)
 {
        int retval;
+
+       if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK)
+               return retval;
+
        LOG_DEBUG("Trying to bring the JTAG controller to life by asserting TRST / tms");
 
        /* Reset can happen after a power cycle.
@@ -1603,6 +1600,9 @@ int jtag_init_reset(struct command_context_s *cmd_ctx)
 
 int jtag_init(struct command_context_s *cmd_ctx)
 {
+       int retval;
+       if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK)
+               return retval;
        if (jtag_init_inner(cmd_ctx)==ERROR_OK)
        {
                return ERROR_OK;
@@ -1939,7 +1939,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);

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)