Compare commits

...

3 Commits

Author SHA1 Message Date
Greg Savin c1b79a85bb Whenever bscan mode is entered, reset the variable that tracks
whether we are certain that USER4 has already been selected into IR.
2019-11-05 13:44:25 -08:00
Greg Savin 1e3c2bdda4 Fix for formatting issues 2019-11-04 16:31:25 -08:00
Greg Savin 32413fee3e For BSCAN tunneling, USER4 only needs to be scanned into IR once,
and then left there for the remainder of the session.
2019-11-04 16:14:10 -08:00
1 changed files with 18 additions and 2 deletions

View File

@ -172,6 +172,7 @@ struct scan_field select_idcode = {
bscan_tunnel_type_t bscan_tunnel_type;
int bscan_tunnel_ir_width; /* if zero, then tunneling is not present/active */
bool bscan_user4_selected;
uint8_t bscan_zero[4] = {0};
uint8_t bscan_one[4] = {1};
@ -275,7 +276,10 @@ static int riscv_resume_go_all_harts(struct target *target);
void select_dmi_via_bscan(struct target *target)
{
if (!bscan_user4_selected) {
jtag_add_ir_scan(target->tap, &select_user4, TAP_IDLE);
bscan_user4_selected = true;
}
if (bscan_tunnel_type == BSCAN_TUNNEL_DATA_REGISTER)
jtag_add_dr_scan(target->tap, bscan_tunnel_data_register_select_dmi_num_fields,
bscan_tunnel_data_register_select_dmi, TAP_IDLE);
@ -350,7 +354,12 @@ uint32_t dtmcontrol_scan_via_bscan(struct target *target, uint32_t out)
tunneled_dr[0].out_value = bscan_one;
tunneled_dr[0].in_value = NULL;
}
if (!bscan_user4_selected) {
jtag_add_ir_scan(target->tap, &select_user4, TAP_IDLE);
bscan_user4_selected = true;
}
jtag_add_dr_scan(target->tap, DIM(tunneled_ir), tunneled_ir, TAP_IDLE);
jtag_add_dr_scan(target->tap, DIM(tunneled_dr), tunneled_dr, TAP_IDLE);
select_dmi_via_bscan(target);
@ -2248,6 +2257,13 @@ COMMAND_HANDLER(riscv_use_bscan_tunnel)
bscan_tunnel_type = tunnel_type;
bscan_tunnel_ir_width = irwidth;
/* Set things up to generate another one-time loading of USER4 into IR the first time
a RISCV scan happens from this point, in case somebody transitioned out of bscan
tunneling mode and did some other activity on the outer JTAG chain after having
been in bscan tunneling mode at an earlier time within the same lifetime of this
process (which may have loaded a different IR value). */
bscan_user4_selected = false;
return ERROR_OK;
}