added template for removing in_handler
[openocd.git] / src / jtag / jtag.c
index a75c9c54a6609aa89479ea38b7aba5026d408a59..242eb56bf6b3fd0d6a12ab78eef3688b0253c406 100644 (file)
@@ -42,6 +42,8 @@
 #include <strings.h>
 #endif
 
+static void jtag_execute_queue_noclear(void);
+
 /* note that this is not marked as static as it must be available from outside jtag.c for those
    that implement the jtag_xxx() minidriver layer
 */
@@ -670,6 +672,12 @@ void jtag_add_dr_scan(int num_fields, scan_field_t *fields, tap_state_t state)
                jtag_error=retval;
 }
 
+void jtag_add_dr_scan_now(int num_fields, scan_field_t *fields, tap_state_t state)
+{
+       jtag_add_dr_scan(num_fields, fields, state);
+       jtag_execute_queue_noclear();
+}
+
 int MINIDRIVER(interface_jtag_add_dr_scan)(int num_fields, scan_field_t *fields, tap_state_t state)
 {
        int j;
@@ -1438,13 +1446,21 @@ int MINIDRIVER(interface_jtag_execute_queue)(void)
        return retval;
 }
 
-int jtag_execute_queue(void)
+static void jtag_execute_queue_noclear(void)
 {
        int retval=interface_jtag_execute_queue();
-       if (retval==ERROR_OK)
+       /* we keep the first error */
+       if ((jtag_error==ERROR_OK)&&(retval!=ERROR_OK))
        {
-               retval=jtag_error;
+               jtag_error=retval;
        }
+}
+
+int jtag_execute_queue(void)
+{
+       int retval;
+       jtag_execute_queue_noclear();
+       retval=jtag_error;
        jtag_error=ERROR_OK;
        return retval;
 }
@@ -1485,10 +1501,10 @@ int jtag_examine_chain(void)
        field.tap = NULL;
        field.num_bits = sizeof(idcode_buffer) * 8;
        field.out_value = idcode_buffer;
-       
+
        field.in_value = idcode_buffer;
-       
-       
+
+
        field.in_handler = NULL;
 
        for (i = 0; i < JTAG_MAX_CHAIN_SIZE; i++)
@@ -1662,10 +1678,7 @@ int jtag_validate_chain(void)
        field.tap = NULL;
        field.num_bits = total_ir_length;
        field.out_value = ir_test;
-       
        field.in_value = ir_test;
-       
-       
        field.in_handler = NULL;
 
        jtag_add_plain_ir_scan(1, &field, TAP_RESET);
@@ -3116,7 +3129,7 @@ static struct
 
 #define B8(bits,count)         { ((u8)B8__(HEX__(bits))), (count) }
 
-#if 0 && ((BUILD_FT2232_FTD2XX==1) || (BUILD_FT2232_LIBFTDI==1))
+#if 0 && ((BUILD_FT2232_FTD2XX==1) || (BUILD_FT2232_LIBFTDI==1) || (BUILD_JLINK==1))
        /*      this is the table submitted by Jeff Williams on 3/30/2009 with this comment:
 
                OK, I added Peter's version of the state table, and it works OK for

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)