cmsis: use exception in wait_word().
This commit is contained in:
parent
a1d4649795
commit
88e44d1c12
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
/*- Includes ----------------------------------------------------------------*/
|
/*- Includes ----------------------------------------------------------------*/
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
|
#include "exception.h"
|
||||||
#include "dap.h"
|
#include "dap.h"
|
||||||
#include "jtag_scan.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;
|
break;
|
||||||
} while (buf[1] == DAP_TRANSFER_WAIT);
|
} while (buf[1] == DAP_TRANSFER_WAIT);
|
||||||
|
|
||||||
if (buf[1] > DAP_TRANSFER_WAIT) {
|
if(buf[1] == SWDP_ACK_FAULT) {
|
||||||
DEBUG_WARN("dap wait_word reg %x fault %x\n",
|
|
||||||
cmd_copy[3], buf[1]);
|
|
||||||
*dp_fault = 1;
|
*dp_fault = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(buf[1] != SWDP_ACK_OK)
|
||||||
|
raise_exception(EXCEPTION_ERROR, "SWDP invalid ACK");
|
||||||
uint32_t res =
|
uint32_t res =
|
||||||
((uint32_t)buf[5] << 24) | ((uint32_t)buf[4] << 16) |
|
((uint32_t)buf[5] << 24) | ((uint32_t)buf[4] << 16) |
|
||||||
((uint32_t)buf[3] << 8) | (uint32_t)buf[2];
|
((uint32_t)buf[3] << 8) | (uint32_t)buf[2];
|
||||||
|
|
|
@ -170,7 +170,7 @@ typedef struct ADIv5_DP_s {
|
||||||
void (*seq_out_parity)(uint32_t MS, int ticks);
|
void (*seq_out_parity)(uint32_t MS, int ticks);
|
||||||
uint32_t (*seq_in)(int ticks);
|
uint32_t (*seq_in)(int ticks);
|
||||||
bool (*seq_in_parity)(uint32_t *ret, 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,
|
bool (*dp_low_write)(struct ADIv5_DP_s *dp, uint16_t addr,
|
||||||
const uint32_t data);
|
const uint32_t data);
|
||||||
uint32_t (*dp_read)(struct ADIv5_DP_s *dp, uint16_t addr);
|
uint32_t (*dp_read)(struct ADIv5_DP_s *dp, uint16_t addr);
|
||||||
|
|
Loading…
Reference in New Issue