7 #ifndef OPENOCD_JTAG_SWD_H
8 #define OPENOCD_JTAG_SWD_H
16 #define SWD_CMD_START (1 << 0)
17 #define SWD_CMD_APNDP (1 << 1)
18 #define SWD_CMD_RNW (1 << 2)
19 #define SWD_CMD_A32 (3 << 3)
20 #define SWD_CMD_PARITY (1 << 5)
21 #define SWD_CMD_STOP (0 << 6)
22 #define SWD_CMD_PARK (1 << 7)
28 #define ERROR_SWD_FAIL (-400)
29 #define ERROR_SWD_FAULT (-401)
35 static inline uint8_t
swd_cmd(
bool is_read,
bool is_ap, uint8_t regnum)
39 | ((regnum & 0xc) << 1);
100 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
117 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
121 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
138 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
155 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
175 0x92, 0xf3, 0x09, 0x62, 0x95, 0x2d, 0x85, 0x86,
176 0xe9, 0xaf, 0xdd, 0xe3, 0xa2, 0x0e, 0xbc, 0x19,
186 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
234 0x92, 0xf3, 0x09, 0x62, 0x95, 0x2d, 0x85, 0x86,
235 0xe9, 0xaf, 0xdd, 0xe3, 0xa2, 0x0e, 0xbc, 0x19,
274 void (*
read_reg)(uint8_t
cmd, uint32_t *value, uint32_t ap_delay_hint);
284 void (*
write_reg)(uint8_t
cmd, uint32_t value, uint32_t ap_delay_hint);
306 int *(*trace)(
bool swo);
This defines formats and data structures used to talk to ADIv5 entities.
int(* switch_seq)(enum swd_special_seq seq)
Queue a special SWDIO sequence.
void(* read_reg)(uint8_t cmd, uint32_t *value, uint32_t ap_delay_hint)
Queued read of an AP or DP register.
int(* init)(void)
Initialize the debug link so it can perform SWD operations.
int(* run)(void)
Execute any queued transactions and collect the result.
void(* write_reg)(uint8_t cmd, uint32_t value, uint32_t ap_delay_hint)
Queued write of an AP or DP register.
static const unsigned swd_seq_swd_to_jtag_len
static const unsigned swd_seq_jtag_to_swd_len
static const uint8_t swd_seq_dormant_to_jtag[]
Dormant-to-JTAG sequence.
static const uint8_t swd_seq_dormant_to_swd[]
Dormant-to-SWD sequence.
static const uint8_t swd_seq_jtag_to_dormant[]
JTAG-to-dormant sequence.
static const unsigned swd_seq_dormant_to_swd_len
static bool swd_cmd_returns_ack(uint8_t cmd)
Test if we can rely on ACK returned by SWD command.
static int swd_ack_to_error_code(uint8_t ack)
Convert SWD ACK value returned from DP to OpenOCD error code.
static uint8_t swd_cmd(bool is_read, bool is_ap, uint8_t regnum)
Construct a "cmd" byte, in lSB bit order, which swd_driver.read_reg() and swd_driver....
int swd_init_reset(struct command_context *cmd_ctx)
static const unsigned swd_seq_jtag_to_dormant_len
static const unsigned swd_seq_dormant_to_jtag_len
static const uint8_t swd_seq_line_reset[]
SWD Line reset.
static const unsigned swd_seq_line_reset_len
static const unsigned swd_seq_swd_to_dormant_len
static const uint8_t swd_seq_jtag_to_swd[]
JTAG-to-SWD sequence.
static const uint8_t swd_seq_swd_to_jtag[]
SWD-to-JTAG sequence.
static const uint8_t swd_seq_swd_to_dormant[]
SWD-to-dormant sequence.
static int parity_u32(uint32_t x)
Calculate the (even) parity of a 32-bit datum.