summaryrefslogtreecommitdiff
path: root/src/jtag/zy1000
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-03-01 20:00:59 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-03-08 08:12:25 +0100
commite018c7c1d29e8dabb9b4a90bb9eb3574eb1668bb (patch)
treee89d52d68c83186556ef6ae3ad6c82032fe26642 /src/jtag/zy1000
parentf7d1be714b91fcc12e56c8fa78c702e75a733019 (diff)
downloadopenocd_libswd-e018c7c1d29e8dabb9b4a90bb9eb3574eb1668bb.tar.gz
openocd_libswd-e018c7c1d29e8dabb9b4a90bb9eb3574eb1668bb.tar.bz2
openocd_libswd-e018c7c1d29e8dabb9b4a90bb9eb3574eb1668bb.tar.xz
openocd_libswd-e018c7c1d29e8dabb9b4a90bb9eb3574eb1668bb.zip
jtag: retire tap field
jtag_add_dr/ir_scan() now takes the tap as the first argument, rather than for each of the fields passed in. The code never exercised the path where there was more than one tap being scanned, who knows if it even worked. This simplifies the implementation and reduces clutter in the calling code. use jtag_add_ir/dr_plain_scan() for more fancy situations. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/jtag/zy1000')
-rw-r--r--src/jtag/zy1000/zy1000.c72
1 files changed, 19 insertions, 53 deletions
diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c
index c5bc0ffd..0b112589 100644
--- a/src/jtag/zy1000/zy1000.c
+++ b/src/jtag/zy1000/zy1000.c
@@ -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;
}