aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jtag/aice/aice_interface.c24
-rw-r--r--src/jtag/aice/aice_interface.h1
-rw-r--r--src/jtag/aice/aice_transport.c60
3 files changed, 85 insertions, 0 deletions
diff --git a/src/jtag/aice/aice_interface.c b/src/jtag/aice/aice_interface.c
index 20f1f07..c758bb4 100644
--- a/src/jtag/aice/aice_interface.c
+++ b/src/jtag/aice/aice_interface.c
@@ -239,6 +239,30 @@ static int aice_khz(int khz, int *jtag_speed)
return ERROR_OK;
}
+int aice_scan_jtag_chain(void)
+{
+ LOG_DEBUG("=== %s ===", __func__);
+ uint8_t num_of_idcode = 0;
+ struct target *target;
+
+ int res = aice_port->api->idcode(aice_target_id_codes, &num_of_idcode);
+ if (res != ERROR_OK) {
+ LOG_ERROR("<-- TARGET ERROR! Failed to identify AndesCore "
+ "JTAG Manufacture ID in the JTAG scan chain. "
+ "Failed to access EDM registers. -->");
+ return res;
+ }
+
+ for (uint32_t i = 0; i < num_of_idcode; i++)
+ LOG_DEBUG("id_codes[%d] = 0x%x", i, aice_target_id_codes[i]);
+
+ /* Update tap idcode */
+ for (target = all_targets; target; target = target->next)
+ target->tap->idcode = aice_target_id_codes[target->tap->abs_chain_position];
+
+ return ERROR_OK;
+}
+
/***************************************************************************/
/* Command handlers */
COMMAND_HANDLER(aice_handle_aice_info_command)
diff --git a/src/jtag/aice/aice_interface.h b/src/jtag/aice/aice_interface.h
index 0e3f108..220b0b0 100644
--- a/src/jtag/aice/aice_interface.h
+++ b/src/jtag/aice/aice_interface.h
@@ -31,5 +31,6 @@ struct aice_interface_param_s {
};
int aice_init_targets(void);
+int aice_scan_jtag_chain(void);
#endif /* OPENOCD_JTAG_AICE_AICE_INTERFACE_H */
diff --git a/src/jtag/aice/aice_transport.c b/src/jtag/aice/aice_transport.c
index 9f07946..57c93f2 100644
--- a/src/jtag/aice/aice_transport.c
+++ b/src/jtag/aice/aice_transport.c
@@ -158,6 +158,59 @@ COMMAND_HANDLER(handle_aice_init_command)
return jtag_init(CMD_CTX);
}
+COMMAND_HANDLER(handle_scan_chain_command)
+{
+ struct jtag_tap *tap;
+ char expected_id[12];
+
+ aice_scan_jtag_chain();
+ tap = jtag_all_taps();
+ command_print(CMD_CTX,
+ " TapName Enabled IdCode Expected IrLen IrCap IrMask");
+ command_print(CMD_CTX,
+ "-- ------------------- -------- ---------- ---------- ----- ----- ------");
+
+ while (tap) {
+ uint32_t expected, expected_mask, ii;
+
+ snprintf(expected_id, sizeof expected_id, "0x%08x",
+ (unsigned)((tap->expected_ids_cnt > 0)
+ ? tap->expected_ids[0]
+ : 0));
+ if (tap->ignore_version)
+ expected_id[2] = '*';
+
+ expected = buf_get_u32(tap->expected, 0, tap->ir_length);
+ expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
+
+ command_print(CMD_CTX,
+ "%2d %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
+ tap->abs_chain_position,
+ tap->dotted_name,
+ tap->enabled ? 'Y' : 'n',
+ (unsigned int)(tap->idcode),
+ expected_id,
+ (unsigned int)(tap->ir_length),
+ (unsigned int)(expected),
+ (unsigned int)(expected_mask));
+
+ for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
+ snprintf(expected_id, sizeof expected_id, "0x%08x",
+ (unsigned) tap->expected_ids[ii]);
+ if (tap->ignore_version)
+ expected_id[2] = '*';
+
+ command_print(CMD_CTX,
+ " %s",
+ expected_id);
+ }
+
+ tap = tap->next_tap;
+ }
+
+ return ERROR_OK;
+}
+
static int jim_aice_arp_init(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{
LOG_DEBUG("No implement: jim_aice_arp_init");
@@ -307,6 +360,13 @@ aice_transport_jtag_subcommand_handlers[] = {
.jim_handler = jim_aice_names,
.help = "Returns list of all JTAG tap names.",
},
+ {
+ .name = "scan_chain",
+ .handler = handle_scan_chain_command,
+ .mode = COMMAND_ANY,
+ .help = "print current scan chain configuration",
+ .usage = ""
+ },
COMMAND_REGISTRATION_DONE
};