aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-03-04 14:38:19 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-03-08 08:12:25 +0100
commit57d7743639d5092770d79f7c4b12ae694c482750 (patch)
tree7b022a9b5df72bb30d05b6594574819c9c6e6f6d /src
parente018c7c1d29e8dabb9b4a90bb9eb3574eb1668bb (diff)
downloadriscv-openocd-57d7743639d5092770d79f7c4b12ae694c482750.zip
riscv-openocd-57d7743639d5092770d79f7c4b12ae694c482750.tar.gz
riscv-openocd-57d7743639d5092770d79f7c4b12ae694c482750.tar.bz2
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>
Diffstat (limited to 'src')
-rw-r--r--src/flash/nor/str9xpec.c2
-rw-r--r--src/jtag/core.c31
-rw-r--r--src/jtag/drivers/driver.c5
-rw-r--r--src/jtag/jtag.h4
-rw-r--r--src/jtag/minidriver.h2
-rw-r--r--src/jtag/minidummy/minidummy.c2
-rw-r--r--src/jtag/tcl.c11
-rw-r--r--src/jtag/zy1000/zy1000.c6
-rw-r--r--src/pld/virtex2.c2
-rw-r--r--src/target/arm11_dbgtap.c6
-rw-r--r--src/target/arm_jtag.c4
-rw-r--r--src/target/etb.c2
-rw-r--r--src/target/mips_ejtag.c2
-rw-r--r--src/target/xscale.c2
-rw-r--r--src/xsvf/xsvf.c2
15 files changed, 46 insertions, 37 deletions
diff --git a/src/flash/nor/str9xpec.c b/src/flash/nor/str9xpec.c
index 3796a4b..b6d24f5 100644
--- a/src/flash/nor/str9xpec.c
+++ b/src/flash/nor/str9xpec.c
@@ -48,7 +48,7 @@ int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end
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);
}
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 2e09cb6..bce332f 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -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);
}
}
diff --git a/src/jtag/drivers/driver.c b/src/jtag/drivers/driver.c
index 673d191..57bc28d 100644
--- a/src/jtag/drivers/driver.c
+++ b/src/jtag/drivers/driver.c
@@ -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 */
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 6e21024..fe57db1 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -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
diff --git a/src/jtag/minidriver.h b/src/jtag/minidriver.h
index a417216..4631593 100644
--- a/src/jtag/minidriver.h
+++ b/src/jtag/minidriver.h
@@ -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,
diff --git a/src/jtag/minidummy/minidummy.c b/src/jtag/minidummy/minidummy.c
index 98b449f..1eef087 100644
--- a/src/jtag/minidummy/minidummy.c
+++ b/src/jtag/minidummy/minidummy.c
@@ -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 */
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index da01f81..1073abc 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -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();
diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c
index 0b11258..391d8f2 100644
--- a/src/jtag/zy1000/zy1000.c
+++ b/src/jtag/zy1000/zy1000.c
@@ -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);
diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c
index 15685e6..976535b 100644
--- a/src/pld/virtex2.c
+++ b/src/pld/virtex2.c
@@ -40,7 +40,7 @@ static int virtex2_set_instr(struct jtag_tap *tap, uint32_t new_instr)
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);
}
diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c
index f049059..2b7b4e4 100644
--- a/src/target/arm11_dbgtap.c
+++ b/src/target/arm11_dbgtap.c
@@ -49,13 +49,13 @@ static const tap_state_t arm11_move_pi_to_si_via_ci[] =
/* 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[] =
@@ -149,7 +149,7 @@ void arm11_add_IR(struct arm11_common * arm11, uint8_t instr, tap_state_t state)
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). */
diff --git a/src/target/arm_jtag.c b/src/target/arm_jtag.c
index 3e27b76..5ed104c 100644
--- a/src/target/arm_jtag.c
+++ b/src/target/arm_jtag.c
@@ -45,13 +45,13 @@ int arm_jtag_set_instr_inner(struct arm_jtag *jtag_info, uint32_t new_instr, vo
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;
diff --git a/src/target/etb.c b/src/target/etb.c
index 1f73ff5..2c4e3eb 100644
--- a/src/target/etb.c
+++ b/src/target/etb.c
@@ -60,7 +60,7 @@ static int etb_set_instr(struct etb *etb, uint32_t 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());
free(field.out_value);
}
diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c
index 79160fc..e0550a8 100644
--- a/src/target/mips_ejtag.c
+++ b/src/target/mips_ejtag.c
@@ -46,7 +46,7 @@ int mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, int new_instr, void *del
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;
diff --git a/src/target/xscale.c b/src/target/xscale.c
index 4973898..602034e 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -173,7 +173,7 @@ static int xscale_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr)
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;
diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c
index faa5542..14bed8e 100644
--- a/src/xsvf/xsvf.c
+++ b/src/xsvf/xsvf.c
@@ -704,7 +704,7 @@ COMMAND_HANDLER(handle_xsvf_command)
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)
{