Author: Michael Bruck <mbruck@digenius.de>
-jtag.c, interface_jtag_add_dr_out(): - use pointer 'field' instead of scan->fields[field_count] - restructure the main loop to clearly separate the two cases: TAP is not bypassed / TAP is bypassed (this is to keep the function similar to interface_jtag_add_dr_scan()) - fix bug where only the first output field has its tap field set - add asserts to verify that target_tap points to the one not bypassed TAP git-svn-id: svn://svn.berlios.de/openocd/trunk@1867 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
e007342669
commit
73e31653fc
|
@ -916,8 +916,6 @@ void MINIDRIVER(interface_jtag_add_dr_out)(jtag_tap_t *target_tap,
|
||||||
const u32 *value,
|
const u32 *value,
|
||||||
tap_state_t end_state)
|
tap_state_t end_state)
|
||||||
{
|
{
|
||||||
int field_count = 0;
|
|
||||||
|
|
||||||
/* count devices in bypass */
|
/* count devices in bypass */
|
||||||
|
|
||||||
size_t bypass_devices = 0;
|
size_t bypass_devices = 0;
|
||||||
|
@ -943,47 +941,52 @@ void MINIDRIVER(interface_jtag_add_dr_out)(jtag_tap_t *target_tap,
|
||||||
scan->fields = out_fields;
|
scan->fields = out_fields;
|
||||||
scan->end_state = end_state;
|
scan->end_state = end_state;
|
||||||
|
|
||||||
|
|
||||||
|
bool target_tap_match = false;
|
||||||
|
|
||||||
|
scan_field_t * field = out_fields; /* keep track where we insert data */
|
||||||
|
|
||||||
|
/* loop over all enabled TAPs */
|
||||||
|
|
||||||
for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap))
|
for (jtag_tap_t * tap = jtag_NextEnabledTap(NULL); tap != NULL; tap = jtag_NextEnabledTap(tap))
|
||||||
{
|
{
|
||||||
scan->fields[field_count].tap = tap;
|
/* if TAP is not bypassed insert matching input fields */
|
||||||
|
|
||||||
if (tap == target_tap)
|
if (!tap->bypass)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG_JTAG_IO_
|
assert(tap == target_tap); /* target_tap must match the one not bypassed TAP */
|
||||||
/* if a device is listed, the BYPASS register must not be selected */
|
|
||||||
if (tap->bypass)
|
target_tap_match = true;
|
||||||
{
|
|
||||||
LOG_ERROR("BUG: scan data for a device in BYPASS");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
for (int j = 0; j < in_num_fields; j++)
|
for (int j = 0; j < in_num_fields; j++)
|
||||||
{
|
{
|
||||||
u8 out_value[4];
|
u8 out_value[4];
|
||||||
size_t scan_size = num_bits[j];
|
size_t scan_size = num_bits[j];
|
||||||
buf_set_u32(out_value, 0, scan_size, value[j]);
|
buf_set_u32(out_value, 0, scan_size, value[j]);
|
||||||
scan->fields[field_count].num_bits = scan_size;
|
|
||||||
scan->fields[field_count].out_value = buf_cpy(out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size);
|
field->tap = tap;
|
||||||
scan->fields[field_count].in_value = NULL;
|
field->num_bits = scan_size;
|
||||||
field_count++;
|
field->out_value = buf_cpy(out_value, cmd_queue_alloc(CEIL(scan_size, 8)), scan_size);
|
||||||
|
field->in_value = NULL;
|
||||||
|
|
||||||
|
field++;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
|
||||||
|
/* if a TAP is bypassed, generated a dummy bit*/
|
||||||
|
else
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG_JTAG_IO_
|
|
||||||
/* if a device isn't listed, the BYPASS register should be selected */
|
field->tap = tap;
|
||||||
if (! tap->bypass)
|
field->num_bits = 1;
|
||||||
{
|
field->out_value = NULL;
|
||||||
LOG_ERROR("BUG: no scan data for a device not in BYPASS");
|
field->in_value = NULL;
|
||||||
exit(-1);
|
|
||||||
}
|
field++;
|
||||||
#endif
|
|
||||||
/* program the scan field to 1 bit length, and ignore it's value */
|
|
||||||
scan->fields[field_count].num_bits = 1;
|
|
||||||
scan->fields[field_count].out_value = NULL;
|
|
||||||
scan->fields[field_count].in_value = NULL;
|
|
||||||
field_count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(target_tap_match); /* target_tap should be enabled and not bypassed */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue