X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Fadi_v5_jtag.c;h=c7dc4f7c988c4059bf9c81845b1ac559f397c8df;hb=78a44055c50f4ea10ebb14714c4b6563cd64f71b;hp=ff1680b0da883110444f1248b56ea25f4c1a9a03;hpb=a185eaad9d2fd25e3e53398a235e08f07f360e74;p=openocd.git diff --git a/src/target/adi_v5_jtag.c b/src/target/adi_v5_jtag.c index ff1680b0da..c7dc4f7c98 100644 --- a/src/target/adi_v5_jtag.c +++ b/src/target/adi_v5_jtag.c @@ -21,9 +21,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * along with this program. If not, see . ***************************************************************************/ /** @@ -359,7 +357,7 @@ static int jtagdp_overrun_check(struct adiv5_dap *dap) int retval; struct dap_cmd *el, *tmp, *prev = NULL; int found_wait = 0; - uint64_t time_now; + int64_t time_now; LIST_HEAD(replay_list); /* make sure all queued transactions are complete */ @@ -450,7 +448,12 @@ static int jtagdp_overrun_check(struct adiv5_dap *dap) /* timeout happened */ if (tmp->ack != JTAG_ACK_OK_FAULT) { LOG_ERROR("Timeout during WAIT recovery"); + dap->select = DP_SELECT_INVALID; jtag_ap_q_abort(dap, NULL); + /* clear the sticky overrun condition */ + adi_jtag_scan_inout_check_u32(dap, JTAG_DP_DPACC, + DP_CTRL_STAT, DPAP_WRITE, + dap->dp_ctrl_stat | SSTICKYORUN, NULL, 0); retval = ERROR_JTAG_DEVICE_ERROR; } } @@ -527,8 +530,14 @@ static int jtagdp_overrun_check(struct adiv5_dap *dap) if (retval == ERROR_OK) { if (el->ack != JTAG_ACK_OK_FAULT) { LOG_ERROR("Timeout during WAIT recovery"); + dap->select = DP_SELECT_INVALID; jtag_ap_q_abort(dap, NULL); + /* clear the sticky overrun condition */ + adi_jtag_scan_inout_check_u32(dap, JTAG_DP_DPACC, + DP_CTRL_STAT, DPAP_WRITE, + dap->dp_ctrl_stat | SSTICKYORUN, NULL, 0); retval = ERROR_JTAG_DEVICE_ERROR; + break; } } else break; @@ -565,8 +574,6 @@ static int jtagdp_transaction_endcheck(struct adiv5_dap *dap) if ((ctrlstat & (CDBGPWRUPREQ | CDBGPWRUPACK | CSYSPWRUPREQ | CSYSPWRUPACK)) != (CDBGPWRUPREQ | CDBGPWRUPACK | CSYSPWRUPREQ | CSYSPWRUPACK)) { LOG_ERROR("Debug regions are unpowered, an unexpected reset might have happened"); - retval = ERROR_JTAG_DEVICE_ERROR; - goto done; } if (ctrlstat & SSTICKYERR) @@ -581,10 +588,7 @@ static int jtagdp_transaction_endcheck(struct adiv5_dap *dap) if (retval != ERROR_OK) goto done; - if (ctrlstat & SSTICKYERR) { - retval = ERROR_JTAG_DEVICE_ERROR; - goto done; - } + retval = ERROR_JTAG_DEVICE_ERROR; } done: @@ -679,6 +683,11 @@ static int jtag_dp_run(struct adiv5_dap *dap) return (retval2 != ERROR_OK) ? retval2 : retval; } +static int jtag_dp_sync(struct adiv5_dap *dap) +{ + return jtagdp_overrun_check(dap); +} + /* FIXME don't export ... just initialize as * part of DAP setup */ @@ -689,6 +698,7 @@ const struct dap_ops jtag_dp_ops = { .queue_ap_write = jtag_ap_q_write, .queue_ap_abort = jtag_ap_q_abort, .run = jtag_dp_run, + .sync = jtag_dp_sync, };