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>
This commit is contained in:
Øyvind Harboe
2010-03-01 20:00:59 +01:00
parent f7d1be714b
commit e018c7c1d2
30 changed files with 155 additions and 359 deletions

View File

@@ -64,7 +64,6 @@ static void jtag_callback_queue_reset(void)
*/
static void cmd_queue_scan_field_clone(struct scan_field * dst, const struct scan_field * src)
{
dst->tap = src->tap;
dst->num_bits = src->num_bits;
dst->out_value = buf_cpy(src->out_value, cmd_queue_alloc(DIV_ROUND_UP(src->num_bits, 8)), src->num_bits);
dst->in_value = src->in_value;
@@ -75,7 +74,7 @@ static void cmd_queue_scan_field_clone(struct scan_field * dst, const struct sca
* see jtag_add_ir_scan()
*
*/
int interface_jtag_add_ir_scan(int in_num_fields, const struct scan_field *in_fields, tap_state_t state)
int interface_jtag_add_ir_scan(struct jtag_tap* active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state)
{
size_t num_taps = jtag_tap_count_enabled();
@@ -102,33 +101,19 @@ int interface_jtag_add_ir_scan(int in_num_fields, const struct scan_field *in_fi
{
/* search the input field list for fields for the current TAP */
bool found = false;
for (int j = 0; j < in_num_fields; j++)
if (tap == active)
{
if (tap != in_fields[j].tap)
continue;
/* if TAP is listed in input fields, copy the value */
found = true;
tap->bypass = 0;
assert(in_fields[j].num_bits == tap->ir_length); /* input fields must have the same length as the TAP's IR */
cmd_queue_scan_field_clone(field, in_fields + j);
break;
}
if (!found)
for (int j = 0; j < in_num_fields; j++)
cmd_queue_scan_field_clone(field, in_fields + j);
} else
{
/* if a TAP isn't listed in input fields, set it to BYPASS */
tap->bypass = 1;
field->tap = tap;
field->num_bits = tap->ir_length;
field->out_value = buf_set_ones(cmd_queue_alloc(DIV_ROUND_UP(tap->ir_length, 8)), tap->ir_length);
field->in_value = NULL; /* do not collect input for tap's in bypass */
@@ -178,7 +163,7 @@ int interface_jtag_add_plain_ir_scan(int in_num_fields, const struct scan_field
* see jtag_add_dr_scan()
*
*/
int interface_jtag_add_dr_scan(int in_num_fields, const struct scan_field *in_fields, tap_state_t state)
int interface_jtag_add_dr_scan(struct jtag_tap* active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state)
{
/* count devices in bypass */
@@ -215,6 +200,7 @@ int interface_jtag_add_dr_scan(int in_num_fields, const struct scan_field *in_fi
if (!tap->bypass)
{
assert(active == tap);
#ifndef NDEBUG
/* remember initial position for assert() */
struct scan_field *start_field = field;
@@ -222,9 +208,6 @@ int interface_jtag_add_dr_scan(int in_num_fields, const struct scan_field *in_fi
for (int j = 0; j < in_num_fields; j++)
{
if (tap != in_fields[j].tap)
continue;
cmd_queue_scan_field_clone(field, in_fields + j);
field++;
@@ -236,7 +219,6 @@ int interface_jtag_add_dr_scan(int in_num_fields, const struct scan_field *in_fi
/* if a TAP is bypassed, generated a dummy bit*/
else
{
field->tap = tap;
field->num_bits = 1;
field->out_value = NULL;
field->in_value = NULL;
@@ -320,7 +302,6 @@ void interface_jtag_add_dr_out(struct jtag_tap *target_tap,
size_t scan_size = num_bits[j];
buf_set_u32(out_value, 0, scan_size, value[j]);
field->tap = tap;
field->num_bits = scan_size;
field->out_value = buf_cpy(out_value, cmd_queue_alloc(DIV_ROUND_UP(scan_size, 8)), scan_size);
field->in_value = NULL;
@@ -333,7 +314,6 @@ void interface_jtag_add_dr_out(struct jtag_tap *target_tap,
else
{
field->tap = tap;
field->num_bits = 1;
field->out_value = NULL;
field->in_value = NULL;