]> git.sur5r.net Git - openocd/commitdiff
zy1000: jtag_add_dr_scan() performance improvement
authorØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 8 Feb 2010 14:40:53 +0000 (15:40 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 22 Feb 2010 07:00:10 +0000 (08:00 +0100)
Reduce overhead in jtag_add_dr_scan() a bit.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/jtag/zy1000/zy1000.c

index 2c205b7a5bddbe608a2605665db240092f536c79..ef4f48217b3a3eb3cfffc6c32deaa1b70f19ac44 100644 (file)
@@ -650,22 +650,29 @@ int interface_jtag_add_dr_scan(int num_fields, const struct scan_field *fields,
 
                for (j = 0; j < num_fields; j++)
                {
+                       /* 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);
 
-                               scanFields(1, fields+j, TAP_DRSHIFT, pause);
+                               j = i;
                        }
                }
+
                if (!found)
                {
-                       struct scan_field tmp;
-                       /* program the scan field to 1 bit length, and ignore it's value */
-                       tmp.num_bits = 1;
-                       tmp.out_value = NULL;
-                       tmp.in_value = NULL;
-
-                       scanFields(1, &tmp, TAP_DRSHIFT, pause);
+                       /* Shift out a 0 for disabled tap's */
+                       shiftValueInner(TAP_DRSHIFT, pause?TAP_DRPAUSE:TAP_DRSHIFT, 1, 0);
                }
                else
                {