OpenOCD
|
This file implements JTAG transport support for cores implementing the ARM Debug Interface version 5 (ADIv5) and version 6 (ADIv6). More...
Go to the source code of this file.
Data Structures | |
struct | dap_cmd |
struct | dap_cmd_pool |
Macros | |
#define | JTAG_ACK_FAULT 0x2 /* ADIv6 */ |
#define | JTAG_ACK_OK 0x4 /* ADIV6 */ |
#define | JTAG_ACK_OK_FAULT 0x2 /* ADIv5 */ |
#define | JTAG_ACK_WAIT 0x1 /* ADIv5 and ADIv6 */ |
#define | JTAG_DP_ABORT 0xF8 |
#define | JTAG_DP_APACC 0xFB |
#define | JTAG_DP_DPACC 0xFA |
#define | JTAG_DP_IDCODE 0xFE |
#define | MAX_DAP_COMMAND_NUM 65536 |
Functions | |
static int | adi_jtag_dp_scan (struct adiv5_dap *dap, uint8_t instr, uint16_t reg_addr, uint8_t rnw, uint8_t *outvalue, uint8_t *invalue, uint32_t memaccess_tck, uint8_t *ack) |
Scan DPACC or APACC using target ordered uint8_t buffers. More... | |
static int | adi_jtag_dp_scan_cmd (struct adiv5_dap *dap, struct dap_cmd *cmd, uint8_t *ack) |
static int | adi_jtag_dp_scan_cmd_sync (struct adiv5_dap *dap, struct dap_cmd *cmd, uint8_t *ack) |
static int | adi_jtag_dp_scan_u32 (struct adiv5_dap *dap, uint8_t instr, uint16_t reg_addr, uint8_t rnw, uint32_t outvalue, uint32_t *invalue, uint32_t memaccess_tck, uint8_t *ack) |
Scan DPACC or APACC out and in from host ordered uint32_t buffers. More... | |
static int | adi_jtag_finish_read (struct adiv5_dap *dap) |
static int | adi_jtag_scan_inout_check_u32 (struct adiv5_dap *dap, uint8_t instr, uint16_t reg_addr, uint8_t rnw, uint32_t outvalue, uint32_t *invalue, uint32_t memaccess_tck) |
static struct dap_cmd * | dap_cmd_new (struct adiv5_dap *dap, uint8_t instr, uint16_t reg_addr, uint8_t rnw, uint8_t *outvalue, uint8_t *invalue, uint32_t memaccess_tck) |
static void | dap_cmd_release (struct adiv5_dap *dap, struct dap_cmd *cmd) |
static void | flush_journal (struct adiv5_dap *dap, struct list_head *lh) |
static int | jtag_ap_q_abort (struct adiv5_dap *dap, uint8_t *ack) |
static int | jtag_ap_q_bankselect (struct adiv5_ap *ap, unsigned reg) |
Select the AP register bank matching bits 7:4 of reg. More... | |
static int | jtag_ap_q_read (struct adiv5_ap *ap, unsigned reg, uint32_t *data) |
static int | jtag_ap_q_write (struct adiv5_ap *ap, unsigned reg, uint32_t data) |
static int | jtag_check_reconnect (struct adiv5_dap *dap) |
static int | jtag_connect (struct adiv5_dap *dap) |
static int | jtag_dp_q_read (struct adiv5_dap *dap, unsigned reg, uint32_t *data) |
static int | jtag_dp_q_write (struct adiv5_dap *dap, unsigned reg, uint32_t data) |
static int | jtag_dp_run (struct adiv5_dap *dap) |
static int | jtag_dp_sync (struct adiv5_dap *dap) |
static int | jtag_limit_queue_size (struct adiv5_dap *dap) |
static void | jtag_quit (struct adiv5_dap *dap) |
static int | jtag_send_sequence (struct adiv5_dap *dap, enum swd_special_seq seq) |
static int | jtagdp_overrun_check (struct adiv5_dap *dap) |
static int | jtagdp_transaction_endcheck (struct adiv5_dap *dap) |
static void | log_dap_cmd (struct adiv5_dap *dap, const char *header, struct dap_cmd *el) |
Variables | |
const struct dap_ops | jtag_dp_ops |
This file implements JTAG transport support for cores implementing the ARM Debug Interface version 5 (ADIv5) and version 6 (ADIv6).
Definition in file adi_v5_jtag.c.
#define JTAG_ACK_FAULT 0x2 /* ADIv6 */ |
Definition at line 45 of file adi_v5_jtag.c.
#define JTAG_ACK_OK 0x4 /* ADIV6 */ |
Definition at line 46 of file adi_v5_jtag.c.
#define JTAG_ACK_OK_FAULT 0x2 /* ADIv5 */ |
Definition at line 44 of file adi_v5_jtag.c.
#define JTAG_ACK_WAIT 0x1 /* ADIv5 and ADIv6 */ |
Definition at line 43 of file adi_v5_jtag.c.
#define JTAG_DP_ABORT 0xF8 |
Definition at line 37 of file adi_v5_jtag.c.
#define JTAG_DP_APACC 0xFB |
Definition at line 39 of file adi_v5_jtag.c.
#define JTAG_DP_DPACC 0xFA |
Definition at line 38 of file adi_v5_jtag.c.
#define JTAG_DP_IDCODE 0xFE |
Definition at line 40 of file adi_v5_jtag.c.
#define MAX_DAP_COMMAND_NUM 65536 |
Definition at line 127 of file adi_v5_jtag.c.
|
static |
Scan DPACC or APACC using target ordered uint8_t buffers.
No endianness conversions are performed. See section 4.4.3 of the ADIv5/ADIv6 spec, which discusses operations which access these registers.
Note that only one scan is performed. If rnw is set, a separate scan will be needed to collect the data which was read; the "invalue" collects the posted result of a preceding operation, not the current one.
dap | the DAP |
instr | JTAG_DP_APACC (AP access) or JTAG_DP_DPACC (DP access) |
reg_addr | two significant bits; A[3:2]; for APACC access, the SELECT register has more addressing bits. |
rnw | false iff outvalue will be written to the DP or AP |
outvalue | points to a 32-bit (little-endian) integer |
invalue | NULL, or points to a 32-bit (little-endian) integer |
ack | points to where the three bit JTAG_ACK_* code will be stored |
memaccess_tck | number of idle cycles to add after AP access |
Definition at line 319 of file adi_v5_jtag.c.
References dap_cmd::ack, adi_jtag_dp_scan_cmd(), cmd, adiv5_dap::cmd_journal, dap_cmd_new(), ERROR_JTAG_DEVICE_ERROR, ERROR_OK, dap_cmd::instr, dap_cmd::invalue, list_add_tail(), dap_cmd::memaccess_tck, dap_cmd::reg_addr, dap_cmd::rnw, and adiv5_dap::select.
Referenced by adi_jtag_dp_scan_u32().
|
static |
Definition at line 248 of file adi_v5_jtag.c.
References arm_jtag_set_instr(), buf_set_u32(), cmd, ERROR_OK, jtag_add_dr_scan(), jtag_add_runtest(), JTAG_DP_APACC, NULL, adiv5_dap::tap, and TAP_IDLE.
Referenced by adi_jtag_dp_scan(), and adi_jtag_dp_scan_cmd_sync().
|
static |
Definition at line 288 of file adi_v5_jtag.c.
References adi_jtag_dp_scan_cmd(), cmd, ERROR_OK, and jtag_execute_queue().
Referenced by jtagdp_overrun_check().
|
static |
Scan DPACC or APACC out and in from host ordered uint32_t buffers.
This is exactly like adi_jtag_dp_scan(), except that endianness conversions are performed (so the types of invalue and outvalue must be different).
Definition at line 346 of file adi_v5_jtag.c.
References dap_cmd::ack, adi_jtag_dp_scan(), arm_le_to_h_u32(), buf_set_u32(), DP_RDBUFF, DP_SELECT, DP_SELECT_INVALID, DPAP_WRITE, ERROR_OK, dap_cmd::instr, dap_cmd::invalue, jtag_add_callback(), JTAG_DP_DPACC, LOG_DEBUG, dap_cmd::memaccess_tck, NULL, dap_cmd::reg_addr, dap_cmd::rnw, and adiv5_dap::select.
Referenced by adi_jtag_finish_read(), adi_jtag_scan_inout_check_u32(), jtag_ap_q_abort(), jtag_ap_q_read(), jtag_ap_q_write(), jtag_dp_q_read(), and jtag_dp_q_write().
|
static |
Definition at line 382 of file adi_v5_jtag.c.
References adi_jtag_dp_scan_u32(), DP_RDBUFF, DPAP_READ, ERROR_OK, JTAG_DP_DPACC, adiv5_dap::last_read, and NULL.
Referenced by jtag_dp_run().
|
static |
Definition at line 395 of file adi_v5_jtag.c.
References adi_jtag_dp_scan_u32(), DP_RDBUFF, DPAP_READ, ERROR_OK, dap_cmd::instr, dap_cmd::invalue, JTAG_DP_DPACC, jtag_execute_queue(), dap_cmd::memaccess_tck, NULL, dap_cmd::reg_addr, and dap_cmd::rnw.
Referenced by jtagdp_overrun_check(), and jtagdp_transaction_endcheck().
|
static |
Definition at line 177 of file adi_v5_jtag.c.
References cmd, dap_cmd_pool::cmd, adiv5_dap::cmd_pool, adiv5_dap::cmd_pool_size, INIT_LIST_HEAD(), dap_cmd::instr, dap_cmd::invalue, dap_cmd_pool::lh, lh(), list_del(), list_empty(), list_first_entry, dap_cmd::memaccess_tck, NULL, dap_cmd::reg_addr, and dap_cmd::rnw.
Referenced by adi_jtag_dp_scan(), and jtagdp_overrun_check().
Definition at line 210 of file adi_v5_jtag.c.
References cmd, adiv5_dap::cmd_pool, adiv5_dap::cmd_pool_size, container_of, dap_cmd_pool::lh, list_add(), and MAX_DAP_COMMAND_NUM.
Referenced by flush_journal(), and jtagdp_overrun_check().
Definition at line 221 of file adi_v5_jtag.c.
References dap_cmd_release(), dap_cmd::lh, lh(), list_del(), and list_for_each_entry_safe.
Referenced by jtagdp_overrun_check(), and jtagdp_transaction_endcheck().
|
static |
Definition at line 825 of file adi_v5_jtag.c.
References adi_jtag_dp_scan_u32(), DPAP_WRITE, ERROR_OK, JTAG_DP_ABORT, jtag_execute_queue(), and NULL.
Referenced by jtagdp_overrun_check().
|
static |
Select the AP register bank matching bits 7:4 of reg.
Definition at line 746 of file adi_v5_jtag.c.
References adiv5_dap::ap, adiv5_ap::ap_num, adiv5_dap::asize, adiv5_ap::dap, DP_SELECT, DP_SELECT1, DP_SELECT_INVALID, ERROR_OK, is_adiv6(), jtag_dp_q_write(), LOG_DEBUG, and adiv5_dap::select.
Referenced by jtag_ap_q_read(), and jtag_ap_q_write().
|
static |
Definition at line 782 of file adi_v5_jtag.c.
References adi_jtag_dp_scan_u32(), adiv5_dap::ap, adiv5_ap::dap, DPAP_READ, ERROR_OK, jtag_ap_q_bankselect(), jtag_check_reconnect(), JTAG_DP_APACC, jtag_limit_queue_size(), adiv5_dap::last_read, adiv5_ap::memaccess_tck, and NULL.
|
static |
Definition at line 804 of file adi_v5_jtag.c.
References adi_jtag_dp_scan_u32(), adiv5_dap::ap, adiv5_ap::dap, DPAP_WRITE, ERROR_OK, jtag_ap_q_bankselect(), jtag_check_reconnect(), JTAG_DP_APACC, jtag_limit_queue_size(), adiv5_dap::last_read, adiv5_ap::memaccess_tck, and NULL.
|
static |
Definition at line 689 of file adi_v5_jtag.c.
References adiv5_dap::do_reconnect, ERROR_OK, and jtag_connect().
Referenced by jtag_ap_q_read(), and jtag_ap_q_write().
|
static |
Definition at line 683 of file adi_v5_jtag.c.
References dap_dp_init(), and adiv5_dap::do_reconnect.
Referenced by jtag_check_reconnect().
|
static |
Definition at line 719 of file adi_v5_jtag.c.
References adi_jtag_dp_scan_u32(), DPAP_READ, ERROR_OK, JTAG_DP_DPACC, jtag_limit_queue_size(), adiv5_dap::last_read, and NULL.
|
static |
Definition at line 732 of file adi_v5_jtag.c.
References adi_jtag_dp_scan_u32(), DPAP_WRITE, ERROR_OK, JTAG_DP_DPACC, jtag_limit_queue_size(), adiv5_dap::last_read, and NULL.
Referenced by jtag_ap_q_bankselect().
|
static |
Definition at line 836 of file adi_v5_jtag.c.
References adi_jtag_finish_read(), ERROR_OK, jtagdp_overrun_check(), and jtagdp_transaction_endcheck().
|
static |
Definition at line 851 of file adi_v5_jtag.c.
|
static |
Definition at line 169 of file adi_v5_jtag.c.
References adiv5_dap::cmd_pool_size, dap_run(), ERROR_OK, and MAX_DAP_COMMAND_NUM.
Referenced by jtag_ap_q_read(), jtag_ap_q_write(), jtag_dp_q_read(), and jtag_dp_q_write().
|
static |
Definition at line 231 of file adi_v5_jtag.c.
References adiv5_dap::cmd_pool, dap_cmd_pool::lh, lh(), list_del(), and list_for_each_entry_safe.
|
static |
Definition at line 697 of file adi_v5_jtag.c.
References ERROR_FAIL, ERROR_OK, jtag_add_tms_seq(), jtag_execute_queue(), JTAG_TO_SWD, LOG_ERROR, swd_seq_jtag_to_swd, swd_seq_jtag_to_swd_len, swd_seq_swd_to_jtag, swd_seq_swd_to_jtag_len, SWD_TO_JTAG, TAP_INVALID, and TAP_RESET.
|
static |
Definition at line 420 of file adi_v5_jtag.c.
References dap_cmd::ack, adi_jtag_dp_scan_cmd_sync(), adi_jtag_scan_inout_check_u32(), adiv5_dap::cmd_journal, dap_cmd_new(), dap_cmd_release(), DP_CTRL_STAT, adiv5_dap::dp_ctrl_stat, DP_RDBUFF, dap_cmd::dp_select, DP_SELECT, DP_SELECT_INVALID, DPAP_READ, DPAP_WRITE, ERROR_JTAG_DEVICE_ERROR, ERROR_OK, flush_journal(), dap_cmd::invalue, dap_cmd::invalue_buf, is_adiv6(), JTAG_ACK_OK, JTAG_ACK_OK_FAULT, JTAG_ACK_WAIT, jtag_ap_q_abort(), JTAG_DP_DPACC, jtag_execute_queue(), le_to_h_u32(), dap_cmd::lh, lh(), list_add(), list_empty(), list_entry, list_first_entry, list_for_each_entry, list_for_each_entry_from, list_for_each_entry_safe, list_for_each_entry_safe_from, LIST_HEAD, list_move_tail(), log_dap_cmd(), LOG_DEBUG, LOG_ERROR, LOG_INFO, NULL, list_head::prev, dap_cmd::rnw, adiv5_dap::select, SSTICKYORUN, and timeval_ms().
Referenced by jtag_dp_run().
|
static |
Definition at line 632 of file adi_v5_jtag.c.
References adi_jtag_scan_inout_check_u32(), CDBGPWRUPACK, CDBGPWRUPREQ, adiv5_dap::cmd_journal, CSYSPWRUPACK, CSYSPWRUPREQ, adiv5_dap::do_reconnect, DP_CTRL_STAT, adiv5_dap::dp_ctrl_stat, DPAP_READ, DPAP_WRITE, ERROR_JTAG_DEVICE_ERROR, ERROR_OK, flush_journal(), adiv5_dap::ignore_syspwrupack, JTAG_DP_DPACC, LOG_DEBUG, LOG_ERROR, NULL, SSTICKYERR, and SSTICKYORUN.
Referenced by jtag_dp_run().
Definition at line 134 of file adi_v5_jtag.c.
References dap_cmd::ack, buf_get_u32(), DPAP_READ, dap_cmd::instr, dap_cmd::invalue, is_adiv6(), JTAG_ACK_OK, JTAG_ACK_OK_FAULT, JTAG_ACK_WAIT, JTAG_DP_APACC, LOG_DEBUG, dap_cmd::outvalue_buf, dap_cmd::reg_addr, and dap_cmd::rnw.
Referenced by jtagdp_overrun_check().
const struct dap_ops jtag_dp_ops |
Definition at line 851 of file adi_v5_jtag.c.
Referenced by dap_init_all().