jtag: retire tap field
[openocd.git] / src / jtag / zy1000 / zy1000.c
index c5bc0ffd927ca47821b8b918fba030853d3a8a08..0b112589d5c82b1bc50cbe12ea6c3fbada4bb8f8 100644 (file)
@@ -574,38 +574,28 @@ static __inline void scanFields(int num_fields, const struct scan_field *fields,
        }
 }
 
-int interface_jtag_add_ir_scan(int num_fields, const struct scan_field *fields, tap_state_t state)
+int interface_jtag_add_ir_scan(struct jtag_tap *active, int num_fields, const struct scan_field *fields, tap_state_t state)
 {
-
-       int j;
        int scan_size = 0;
        struct jtag_tap *tap, *nextTap;
+
+       assert(num_fields == 1);
+
        for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap = nextTap)
        {
                nextTap = jtag_tap_next_enabled(tap);
-               int pause = (nextTap==NULL);
-
-               int found = 0;
-
+               bool pause = (nextTap==NULL);
                scan_size = tap->ir_length;
 
                /* search the list */
-               for (j = 0; j < num_fields; j++)
+               if (tap == active)
                {
-                       if (tap == fields[j].tap)
-                       {
-                               found = 1;
-
-                               scanFields(1, fields + j, TAP_IRSHIFT, pause);
-                               /* update device information */
-                               buf_cpy(fields[j].out_value, tap->cur_instr, scan_size);
+                       scanFields(num_fields, fields, TAP_IRSHIFT, pause);
+                       /* update device information */
+                       buf_cpy(fields[0].out_value, tap->cur_instr, scan_size);
 
-                               tap->bypass = 0;
-                               break;
-                       }
-               }
-
-               if (!found)
+                       tap->bypass = 0;
+               } else
                {
                        /* if a device isn't listed, set it to BYPASS */
                        assert(scan_size <= 32);
@@ -631,46 +621,26 @@ int interface_jtag_add_plain_ir_scan(int num_fields, const struct scan_field *fi
        return ERROR_OK;
 }
 
-int interface_jtag_add_dr_scan(int num_fields, const struct scan_field *fields, tap_state_t state)
+int interface_jtag_add_dr_scan(struct jtag_tap *active, int num_fields, const struct scan_field *fields, tap_state_t state)
 {
-
-       int j;
        struct jtag_tap *tap, *nextTap;
        for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap = nextTap)
        {
                nextTap = jtag_tap_next_enabled(tap);
-               int found = 0;
-               int pause = (nextTap==NULL);
+               bool pause = (nextTap==NULL);
 
-               for (j = 0; j < num_fields; j++)
+               /* Find a range of fields to write to this tap */
+               if (tap == active)
                {
-                       /* Find a range of fields to write to this tap */
-                       if (tap == fields[j].tap)
-                       {
-                               found = 1;
-                               int i;
-                               for (i = j + 1; i < num_fields; i++)
-                               {
-                                       if (tap != fields[j].tap)
-                                       {
-                                               break;
-                                       }
-                               }
-
-                               scanFields(i - j, fields + j, TAP_DRSHIFT, pause);
+                       assert(!tap->bypass);
 
-                               j = i;
-                       }
-               }
-
-               if (!found)
+                       scanFields(num_fields, fields, TAP_DRSHIFT, pause);
+               } else
                {
                        /* Shift out a 0 for disabled tap's */
+                       assert(tap->bypass);
                        shiftValueInner(TAP_DRSHIFT, pause?TAP_DRPAUSE:TAP_DRSHIFT, 1, 0);
                }
-               else
-               {
-               }
        }
        gotoEndState(state);
        return ERROR_OK;
@@ -683,7 +653,6 @@ int interface_jtag_add_plain_dr_scan(int num_fields, const struct scan_field *fi
        return ERROR_OK;
 }
 
-
 int interface_jtag_add_tlr()
 {
        setCurrentState(TAP_RESET);
@@ -691,8 +660,6 @@ int interface_jtag_add_tlr()
 }
 
 
-
-
 int interface_jtag_add_reset(int req_trst, int req_srst)
 {
        zy1000_reset(req_trst, req_srst);
@@ -737,7 +704,6 @@ static int zy1000_jtag_add_clocks(int num_cycles, tap_state_t state, tap_state_t
        ZY1000_POKE(ZY1000_JTAG_BASE + 0x20, state);
 #endif
 
-
        return ERROR_OK;
 }
 

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)