forked from auracaster/openocd
jtag: jtag_add_ir_scan() now takes a single field
In the code a single field was all that was ever used. Makes jtag_add_ir_scan() simpler and leaves more complicated stuff to jtag_add_plain_ir_scan(). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
This commit is contained in:
@@ -42,7 +42,8 @@
|
||||
/// 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);
|
||||
|
||||
/**
|
||||
@@ -352,17 +353,22 @@ void jtag_alloc_in_value32(struct scan_field *field)
|
||||
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);
|
||||
|
||||
@@ -370,18 +376,15 @@ void jtag_add_ir_scan(struct jtag_tap *active, int in_num_fields, struct scan_fi
|
||||
{
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,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(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();
|
||||
|
||||
@@ -106,8 +106,7 @@ int interface_jtag_add_ir_scan(struct jtag_tap* active, int in_num_fields, const
|
||||
/* 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 */
|
||||
|
||||
@@ -350,13 +350,13 @@ int jtag_init_inner(struct command_context *cmd_ctx);
|
||||
* 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
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#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,
|
||||
|
||||
@@ -46,7 +46,7 @@ int interface_jtag_execute_queue(void)
|
||||
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 */
|
||||
|
||||
|
||||
@@ -1490,6 +1490,15 @@ COMMAND_HANDLER(handle_irscan_command)
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -1521,7 +1530,7 @@ COMMAND_HANDLER(handle_irscan_command)
|
||||
}
|
||||
|
||||
/* 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();
|
||||
|
||||
|
||||
@@ -574,13 +574,11 @@ static __inline void scanFields(int num_fields, const struct scan_field *fields,
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -590,7 +588,7 @@ int interface_jtag_add_ir_scan(struct jtag_tap *active, int num_fields, const st
|
||||
/* 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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user