cmsis: use exception in wait_word().

This commit is contained in:
Uwe Bonnes 2021-10-24 01:14:46 +02:00
parent a1d4649795
commit 88e44d1c12
2 changed files with 6 additions and 4 deletions

View File

@ -32,6 +32,7 @@
/*- Includes ----------------------------------------------------------------*/
#include <general.h>
#include "exception.h"
#include "dap.h"
#include "jtag_scan.h"
@ -329,12 +330,13 @@ static uint32_t wait_word(uint8_t *buf, int size, int len, uint8_t *dp_fault)
break;
} while (buf[1] == DAP_TRANSFER_WAIT);
if (buf[1] > DAP_TRANSFER_WAIT) {
DEBUG_WARN("dap wait_word reg %x fault %x\n",
cmd_copy[3], buf[1]);
if(buf[1] == SWDP_ACK_FAULT) {
*dp_fault = 1;
return 0;
}
if(buf[1] != SWDP_ACK_OK)
raise_exception(EXCEPTION_ERROR, "SWDP invalid ACK");
uint32_t res =
((uint32_t)buf[5] << 24) | ((uint32_t)buf[4] << 16) |
((uint32_t)buf[3] << 8) | (uint32_t)buf[2];

View File

@ -170,7 +170,7 @@ typedef struct ADIv5_DP_s {
void (*seq_out_parity)(uint32_t MS, int ticks);
uint32_t (*seq_in)(int ticks);
bool (*seq_in_parity)(uint32_t *ret, int ticks);
/* dp_low_write returns true if no OK resonse. */
/* dp_low_write returns true if no OK resonse, but ignores errors */
bool (*dp_low_write)(struct ADIv5_DP_s *dp, uint16_t addr,
const uint32_t data);
uint32_t (*dp_read)(struct ADIv5_DP_s *dp, uint16_t addr);