buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
field.in_value = NULL;
- jtag_add_ir_scan(tap, 1, &field, end_state);
+ jtag_add_ir_scan(tap, &field, end_state);
free(field.out_value);
}
/// The number of JTAG queue flushes (for profiling and debugging purposes).
static int jtag_flush_queue_count;
-static void jtag_add_scan_check(struct jtag_tap *active, void (*jtag_add_scan)(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state),
+static void jtag_add_scan_check(struct jtag_tap *active,
+ void (*jtag_add_scan)(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state),
int in_num_fields, struct scan_field *in_fields, tap_state_t state);
/**
interface_jtag_alloc_in_value32(field);
}
-void jtag_add_ir_scan_noverify(struct jtag_tap *active, int in_count, const struct scan_field *in_fields,
+void jtag_add_ir_scan_noverify(struct jtag_tap *active, const struct scan_field *in_fields,
tap_state_t state)
{
jtag_prelude(state);
- int retval = interface_jtag_add_ir_scan(active, in_count, in_fields, state);
+ int retval = interface_jtag_add_ir_scan(active, in_fields, state);
jtag_set_error(retval);
}
+static void jtag_add_ir_scan_noverify_callback(struct jtag_tap *active, int dummy, const struct scan_field *in_fields,
+ tap_state_t state)
+{
+ jtag_add_ir_scan_noverify(active, in_fields, state);
+}
-void jtag_add_ir_scan(struct jtag_tap *active, int in_num_fields, struct scan_field *in_fields, tap_state_t state)
+void jtag_add_ir_scan(struct jtag_tap *active, struct scan_field *in_fields, tap_state_t state)
{
assert(state != TAP_RESET);
{
/* 8 x 32 bit id's is enough for all invocations */
- for (int j = 0; j < in_num_fields; j++)
- {
- /* if we are to run a verification of the ir scan, we need to get the input back.
- * We may have to allocate space if the caller didn't ask for the input back.
- */
- in_fields[j].check_value = active->expected;
- in_fields[j].check_mask = active->expected_mask;
- }
- jtag_add_scan_check(active, jtag_add_ir_scan_noverify, in_num_fields, in_fields, state);
+ /* if we are to run a verification of the ir scan, we need to get the input back.
+ * We may have to allocate space if the caller didn't ask for the input back.
+ */
+ in_fields->check_value = active->expected;
+ in_fields->check_mask = active->expected_mask;
+ jtag_add_scan_check(active, jtag_add_ir_scan_noverify_callback, 1, in_fields, state);
} else
{
- jtag_add_ir_scan_noverify(active, in_num_fields, in_fields, state);
+ jtag_add_ir_scan_noverify(active, in_fields, state);
}
}
* see jtag_add_ir_scan()
*
*/
-int interface_jtag_add_ir_scan(struct jtag_tap* active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state)
+int interface_jtag_add_ir_scan(struct jtag_tap* active, const struct scan_field *in_fields, tap_state_t state)
{
size_t num_taps = jtag_tap_count_enabled();
/* if TAP is listed in input fields, copy the value */
tap->bypass = 0;
- for (int j = 0; j < in_num_fields; j++)
- cmd_queue_scan_field_clone(field, in_fields + j);
+ cmd_queue_scan_field_clone(field, in_fields);
} else
{
/* if a TAP isn't listed in input fields, set it to BYPASS */
* subsequent DR SCANs.
*
*/
-void jtag_add_ir_scan(struct jtag_tap* tap, int num_fields,
+void jtag_add_ir_scan(struct jtag_tap* tap,
struct scan_field* fields, tap_state_t endstate);
/**
* The same as jtag_add_ir_scan except no verification is performed out
* the output values.
*/
-void jtag_add_ir_scan_noverify(struct jtag_tap* tap, int num_fields,
+void jtag_add_ir_scan_noverify(struct jtag_tap* tap,
const struct scan_field *fields, tap_state_t state);
/**
* Duplicate the scan fields passed into the function into an IR SCAN
#include <jtag/minidriver_imp.h>
int interface_jtag_add_ir_scan(struct jtag_tap* active,
- int num_fields, const struct scan_field* fields,
+ const struct scan_field* fields,
tap_state_t endstate);
int interface_jtag_add_plain_ir_scan(
int num_fields, const struct scan_field* fields,
return ERROR_OK;
}
-int interface_jtag_add_ir_scan(struct jtag_tap *active, int num_fields, const struct scan_field *fields, tap_state_t state)
+int interface_jtag_add_ir_scan(struct jtag_tap *active, const struct scan_field *fields, tap_state_t state)
{
/* synchronously do the operation here */
}
int num_fields = CMD_ARGC / 2;
+ if (num_fields > 1)
+ {
+ /* we really should be looking at plain_ir_scan if we want
+ * anything more fancy.
+ */
+ LOG_ERROR("Specify a single value for tap");
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ }
+
size_t fields_len = sizeof(struct scan_field) * num_fields;
fields = malloc(fields_len);
memset(fields, 0, fields_len);
}
/* did we have an endstate? */
- jtag_add_ir_scan(tap, num_fields, fields, endstate);
+ jtag_add_ir_scan(tap, fields, endstate);
retval = jtag_execute_queue();
}
}
-int interface_jtag_add_ir_scan(struct jtag_tap *active, int num_fields, const struct scan_field *fields, tap_state_t state)
+int interface_jtag_add_ir_scan(struct jtag_tap *active, const struct scan_field *fields, tap_state_t state)
{
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);
/* search the list */
if (tap == active)
{
- scanFields(num_fields, fields, TAP_IRSHIFT, pause);
+ scanFields(1, fields, TAP_IRSHIFT, pause);
/* update device information */
buf_cpy(fields[0].out_value, tap->cur_instr, scan_size);
buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
field.in_value = NULL;
- jtag_add_ir_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_ir_scan(tap, &field, jtag_set_end_state(TAP_IDLE));
free(field.out_value);
}
/* REVISIT no error handling here! */
-static void arm11_add_ir_scan_vc(struct jtag_tap *tap, int num_fields, struct scan_field *fields,
+static void arm11_add_ir_scan_vc(struct jtag_tap *tap, struct scan_field *fields,
tap_state_t state)
{
if (cmd_queue_cur_state == TAP_IRPAUSE)
jtag_add_pathmove(ARRAY_SIZE(arm11_move_pi_to_si_via_ci), arm11_move_pi_to_si_via_ci);
- jtag_add_ir_scan(tap, num_fields, fields, state);
+ jtag_add_ir_scan(tap, fields, state);
}
static const tap_state_t arm11_move_pd_to_sd_via_cd[] =
arm11_setup_field(arm11, 5, &instr, NULL, &field);
- arm11_add_ir_scan_vc(arm11->arm.target->tap, 1, &field, state == ARM11_TAP_DEFAULT ? TAP_IRPAUSE : state);
+ arm11_add_ir_scan_vc(arm11->arm.target->tap, &field, state == ARM11_TAP_DEFAULT ? TAP_IRPAUSE : state);
}
/** Verify data shifted out from Scan Chain Register (SCREG). */
if (no_verify_capture == NULL)
{
- jtag_add_ir_scan(tap, 1, &field, jtag_get_end_state());
+ jtag_add_ir_scan(tap, &field, jtag_get_end_state());
} else
{
/* FIX!!!! this is a kludge!!! arm926ejs.c should reimplement this arm_jtag_set_instr to
* have special verification code.
*/
- jtag_add_ir_scan_noverify(tap, 1, &field, jtag_get_end_state());
+ jtag_add_ir_scan_noverify(tap, &field, jtag_get_end_state());
}
return ERROR_OK;
field.in_value = NULL;
- jtag_add_ir_scan(tap, 1, &field, jtag_get_end_state());
+ jtag_add_ir_scan(tap, &field, jtag_get_end_state());
free(field.out_value);
}
buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
field.in_value = NULL;
- jtag_add_ir_scan(tap, 1, &field, jtag_get_end_state());
+ jtag_add_ir_scan(tap, &field, jtag_get_end_state());
}
return ERROR_OK;
field.out_value = scratch;
buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
- jtag_add_ir_scan(tap, 1, &field, jtag_get_end_state());
+ jtag_add_ir_scan(tap, &field, jtag_get_end_state());
}
return ERROR_OK;
if (tap == NULL)
jtag_add_plain_ir_scan(1, &field, my_end_state);
else
- jtag_add_ir_scan(tap, 1, &field, my_end_state);
+ jtag_add_ir_scan(tap, &field, my_end_state);
if (xruntest)
{