From a30ef31018c6e4ea4cba69755f2fcdd0dbc17baa Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Wed, 19 Jun 2013 21:06:59 +1200 Subject: [PATCH] Handle SW-DP fault on WDATAERR. --- src/adiv5_swdp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/adiv5_swdp.c b/src/adiv5_swdp.c index c021190..7896d8b 100644 --- a/src/adiv5_swdp.c +++ b/src/adiv5_swdp.c @@ -73,6 +73,7 @@ int adiv5_swdp_scan(void) dp->error = adiv5_swdp_error; dp->low_access = adiv5_swdp_low_access; + adiv5_swdp_error(dp); adiv5_dp_init(dp); if(!target_list) morse("NO TARGETS.", 1); @@ -97,7 +98,7 @@ static uint32_t adiv5_swdp_error(ADIv5_DP_t *dp) err = adiv5_swdp_read(dp, ADIV5_DP_CTRLSTAT) & (ADIV5_DP_CTRLSTAT_STICKYORUN | ADIV5_DP_CTRLSTAT_STICKYCMP | - ADIV5_DP_CTRLSTAT_STICKYERR); + ADIV5_DP_CTRLSTAT_STICKYERR | ADIV5_DP_CTRLSTAT_WDATAERR); if(err & ADIV5_DP_CTRLSTAT_STICKYORUN) clr |= ADIV5_DP_ABORT_ORUNERRCLR; @@ -105,6 +106,8 @@ static uint32_t adiv5_swdp_error(ADIv5_DP_t *dp) clr |= ADIV5_DP_ABORT_STKCMPCLR; if(err & ADIV5_DP_CTRLSTAT_STICKYERR) clr |= ADIV5_DP_ABORT_STKERRCLR; + if(err & ADIV5_DP_CTRLSTAT_WDATAERR) + clr |= ADIV5_DP_ABORT_WDERRCLR; adiv5_swdp_write(dp, ADIV5_DP_ABORT, clr); dp->fault = 0;