aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/aice/aice_interface.c
diff options
context:
space:
mode:
authorHellosun Wu <wujiheng.tw@gmail.com>2017-05-12 14:37:21 +0800
committerTomas Vanek <vanekt@fbl.cz>2018-03-12 14:12:59 +0000
commit69325f6970f445f43b8cac05824a68a8f906735a (patch)
tree44dab7f397b664d69c692e4e2d6398dd9f2d8f76 /src/jtag/aice/aice_interface.c
parent396ea7c8dd448482789122799b5dbc60b77223ad (diff)
nds32: Add jtag scan_chain command
Create new command to refresh idcode list during runtime and update Tap idcode. Change-Id: Ie889a39a6f57cea207b2b9c9e42c51c97cfe4d8e Signed-off-by: Hellosun Wu <wujiheng.tw@gmail.com> Reviewed-on: http://openocd.zylin.com/4133 Tested-by: jenkins Reviewed-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-by: penny chen <penny6610231@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/jtag/aice/aice_interface.c')
-rw-r--r--src/jtag/aice/aice_interface.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/jtag/aice/aice_interface.c b/src/jtag/aice/aice_interface.c
index 20f1f07f..c758bb43 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)