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)
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");
.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
};