* 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 <http://www.gnu.org/licenses/>.
***************************************************************************/
/**
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 */
/* 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;
}
}
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;
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)
if (retval != ERROR_OK)
goto done;
- if (ctrlstat & SSTICKYERR) {
- retval = ERROR_JTAG_DEVICE_ERROR;
- goto done;
- }
+ retval = ERROR_JTAG_DEVICE_ERROR;
}
done:
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
*/
.queue_ap_write = jtag_ap_q_write,
.queue_ap_abort = jtag_ap_q_abort,
.run = jtag_dp_run,
+ .sync = jtag_dp_sync,
};