OpenOCD
|
Utilities to support ARM "Serial Wire Debug" (SWD), a low pin-count debug link protocol used in cases where JTAG is not wanted. More...
Go to the source code of this file.
Functions | |
static int | check_sync (struct adiv5_dap *dap) |
static int | swd_check_reconnect (struct adiv5_dap *dap) |
static void | swd_clear_sticky_errors (struct adiv5_dap *dap) |
static int | swd_connect (struct adiv5_dap *dap) |
static int | swd_connect_multidrop (struct adiv5_dap *dap) |
static int | swd_connect_single (struct adiv5_dap *dap) |
static void | swd_constructor (void) |
static void | swd_finish_read (struct adiv5_dap *dap) |
static int | swd_init (struct command_context *ctx) |
static int | swd_multidrop_select (struct adiv5_dap *dap) |
static int | swd_multidrop_select_inner (struct adiv5_dap *dap, uint32_t *dpidr_ptr, uint32_t *dlpidr_ptr, bool clear_sticky) |
static int | swd_queue_ap_abort (struct adiv5_dap *dap, uint8_t *ack) |
static int | swd_queue_ap_bankselect (struct adiv5_ap *ap, unsigned reg) |
Select the AP register bank matching bits 7:4 of reg. More... | |
static int | swd_queue_ap_read (struct adiv5_ap *ap, unsigned reg, uint32_t *data) |
static int | swd_queue_ap_write (struct adiv5_ap *ap, unsigned reg, uint32_t data) |
static int | swd_queue_dp_bankselect (struct adiv5_dap *dap, unsigned int reg) |
Select the DP register bank matching bits 7:4 of reg. More... | |
static int | swd_queue_dp_read (struct adiv5_dap *dap, unsigned reg, uint32_t *data) |
static int | swd_queue_dp_read_inner (struct adiv5_dap *dap, unsigned int reg, uint32_t *data) |
static int | swd_queue_dp_write (struct adiv5_dap *dap, unsigned reg, uint32_t data) |
static int | swd_queue_dp_write_inner (struct adiv5_dap *dap, unsigned int reg, uint32_t data) |
static void | swd_quit (struct adiv5_dap *dap) |
Put the SWJ-DP back to JTAG mode. More... | |
static int | swd_run (struct adiv5_dap *dap) |
Executes all queued DAP operations. More... | |
static int | swd_run_inner (struct adiv5_dap *dap) |
static int | swd_select (struct command_context *ctx) |
static int | swd_send_sequence (struct adiv5_dap *dap, enum swd_special_seq seq) |
bool | transport_is_swd (void) |
Returns true if the current debug session is using SWD as its transport. More... | |
Variables | |
static bool | do_sync |
static const struct command_registration | swd_commands [] |
const struct dap_ops | swd_dap_ops |
static const struct command_registration | swd_handlers [] |
static struct adiv5_dap * | swd_multidrop_selected_dap |
static struct transport | swd_transport |
Utilities to support ARM "Serial Wire Debug" (SWD), a low pin-count debug link protocol used in cases where JTAG is not wanted.
This is coupled to recent versions of ARM's "CoreSight" debug framework. This specific code is a transport level interface, with "target/arm_adi_v5.[hc]" code understanding operation semantics, shared with the JTAG transport.
Single-DAP support only.
for details, see "ARM IHI 0031A" ARM Debug Interface v5 Architecture Specification especially section 5.3 for SWD protocol and "ARM IHI 0074C" ARM Debug Interface Architecture Specification ADIv6.0
On many chips (most current Cortex-M3 parts) SWD is a run-time alternative to JTAG. Boards may support one or both. There are also SWD-only chips, (using SW-DP not SWJ-DP).
Even boards that also support JTAG can benefit from SWD support, because usually there's no way to access the SWO trace view mechanism in JTAG mode. That is, trace access may require SWD support.
Definition in file adi_v5_swd.c.
|
inlinestatic |
Definition at line 97 of file adi_v5_swd.c.
References do_sync, ERROR_OK, and swd_run_inner().
Referenced by swd_queue_ap_abort(), swd_queue_ap_read(), swd_queue_ap_write(), swd_queue_dp_read_inner(), and swd_queue_dp_write_inner().
|
static |
Definition at line 440 of file adi_v5_swd.c.
References adiv5_dap::do_reconnect, ERROR_OK, and swd_connect().
Referenced by swd_queue_ap_read(), swd_queue_ap_write(), swd_queue_dp_read(), and swd_queue_dp_write().
|
static |
Definition at line 73 of file adi_v5_swd.c.
References adiv5_dap_swd_driver(), DP_ABORT, ORUNERRCLR, STKCMPCLR, STKERRCLR, swd_cmd(), WDERRCLR, and swd_driver::write_reg.
Referenced by swd_connect_single(), and swd_multidrop_select_inner().
|
static |
Definition at line 389 of file adi_v5_swd.c.
References adapter_assert_reset(), dap_dp_init(), dap_is_multidrop(), DAPABORT, adiv5_dap::do_reconnect, DP_ABORT, ERROR_OK, ERROR_WAIT, jtag_get_reset_config(), jtag_reset_config, LOG_WARNING, ORUNERRCLR, RESET_CNCT_UNDER_SRST, RESET_SRST_NO_GATING, status, STKCMPCLR, STKERRCLR, swd_connect_multidrop(), swd_connect_single(), swd_queue_dp_write_inner(), swd_run_inner(), and WDERRCLR.
Referenced by swd_check_reconnect().
|
static |
Definition at line 282 of file adi_v5_swd.c.
References adiv5_dap_name(), alive_sleep(), dap_invalidate_cache(), adiv5_dap::do_reconnect, DORMANT_TO_SWD, ERROR_OK, JTAG_TO_DORMANT, LOG_ERROR, LOG_INFO, NULL, swd_multidrop_select_inner(), swd_multidrop_selected_dap, swd_send_sequence(), and timeval_ms().
Referenced by swd_connect().
|
static |
Definition at line 318 of file adi_v5_swd.c.
References alive_sleep(), dap_invalidate_cache(), adiv5_dap::do_reconnect, DORMANT_TO_SWD, DP_DPIDR, DP_SELECT_INVALID, ERROR_OK, ERROR_WAIT, JTAG_TO_DORMANT, JTAG_TO_SWD, LOG_ERROR, LOG_INFO, adiv5_dap::select, swd_clear_sticky_errors(), swd_queue_dp_read_inner(), swd_run_inner(), swd_send_sequence(), adiv5_dap::switch_through_dormant, and timeval_ms().
Referenced by swd_connect().
|
static |
Definition at line 719 of file adi_v5_swd.c.
|
static |
Definition at line 64 of file adi_v5_swd.c.
References adiv5_dap_swd_driver(), DP_RDBUFF, adiv5_dap::last_read, NULL, swd_driver::read_reg, and swd_cmd().
Referenced by swd_queue_ap_write(), swd_queue_dp_write_inner(), and swd_run().
|
static |
Definition at line 706 of file adi_v5_swd.c.
References ERROR_OK.
|
static |
Definition at line 251 of file adi_v5_swd.c.
References adiv5_dap_name(), dap_is_multidrop(), adiv5_dap::do_reconnect, ERROR_OK, LOG_DEBUG, LOG_ERROR, NULL, swd_multidrop_select_inner(), and swd_multidrop_selected_dap.
Referenced by swd_queue_ap_abort(), swd_queue_ap_read(), swd_queue_ap_write(), swd_queue_dp_read(), swd_queue_dp_write(), and swd_run().
|
static |
Definition at line 171 of file adi_v5_swd.c.
References dap_is_multidrop(), DP_ABORT, DP_DLPIDR, DP_DLPIDR_PROTVSN, DP_DPIDR, DP_DPIDR_VERSION_MASK, DP_DPIDR_VERSION_SHIFT, DP_SELECT_INVALID, DP_TARGETSEL, DP_TARGETSEL_INSTANCEID_MASK, ERROR_FAIL, ERROR_OK, LINE_RESET, LOG_DEBUG_IO, LOG_INFO, adiv5_dap::multidrop_targetsel, ORUNERRCLR, adiv5_dap::select, swd_clear_sticky_errors(), swd_multidrop_selected_dap, swd_queue_dp_read_inner(), swd_queue_dp_write_inner(), swd_run_inner(), and swd_send_sequence().
Referenced by swd_connect_multidrop(), and swd_multidrop_select().
|
static |
Definition at line 448 of file adi_v5_swd.c.
References adiv5_dap_swd_driver(), check_sync(), DAPABORT, DP_ABORT, ERROR_OK, ORUNERRCLR, STKCMPCLR, STKERRCLR, swd_cmd(), swd_multidrop_select(), WDERRCLR, and swd_driver::write_reg.
|
static |
Select the AP register bank matching bits 7:4 of reg.
Definition at line 498 of file adi_v5_swd.c.
References adiv5_dap::ap, adiv5_ap::ap_num, adiv5_dap::asize, adiv5_ap::dap, DP_SELECT, DP_SELECT1, DP_SELECT_DPBANK, DP_SELECT_INVALID, ERROR_OK, is_adiv6(), LOG_DEBUG, adiv5_dap::select, swd_queue_dp_write(), and swd_queue_dp_write_inner().
Referenced by swd_queue_ap_read(), and swd_queue_ap_write().
|
static |
Definition at line 542 of file adi_v5_swd.c.
References adiv5_dap_swd_driver(), adiv5_dap::ap, check_sync(), adiv5_ap::dap, ERROR_OK, adiv5_dap::last_read, adiv5_ap::memaccess_tck, swd_driver::read_reg, swd_check_reconnect(), swd_cmd(), swd_multidrop_select(), and swd_queue_ap_bankselect().
|
static |
Definition at line 567 of file adi_v5_swd.c.
References adiv5_dap_swd_driver(), adiv5_dap::ap, check_sync(), adiv5_ap::dap, ERROR_OK, adiv5_ap::memaccess_tck, swd_check_reconnect(), swd_cmd(), swd_finish_read(), swd_multidrop_select(), swd_queue_ap_bankselect(), and swd_driver::write_reg.
|
static |
Select the DP register bank matching bits 7:4 of reg.
Definition at line 103 of file adi_v5_swd.c.
References DP_SELECT, DP_SELECT_INVALID, ERROR_OK, adiv5_dap::select, and swd_queue_dp_write_inner().
Referenced by swd_queue_dp_read_inner(), and swd_queue_dp_write_inner().
|
static |
Definition at line 466 of file adi_v5_swd.c.
References ERROR_OK, swd_check_reconnect(), swd_multidrop_select(), and swd_queue_dp_read_inner().
|
static |
Definition at line 125 of file adi_v5_swd.c.
References adiv5_dap_swd_driver(), check_sync(), ERROR_OK, swd_driver::read_reg, swd_cmd(), and swd_queue_dp_bankselect().
Referenced by swd_connect_single(), swd_multidrop_select_inner(), and swd_queue_dp_read().
|
static |
Definition at line 480 of file adi_v5_swd.c.
References adiv5_dap_swd_driver(), ERROR_OK, swd_check_reconnect(), swd_multidrop_select(), and swd_queue_dp_write_inner().
Referenced by swd_queue_ap_bankselect().
|
static |
Definition at line 140 of file adi_v5_swd.c.
References adiv5_dap_swd_driver(), check_sync(), DP_SELECT, DP_SELECT_APBANK, DP_SELECT_APSEL, DP_SELECT_DPBANK, DP_SELECT_INVALID, ERROR_OK, adiv5_dap::select, swd_cmd(), swd_finish_read(), swd_queue_dp_bankselect(), and swd_driver::write_reg.
Referenced by swd_connect(), swd_multidrop_select_inner(), swd_queue_ap_bankselect(), swd_queue_dp_bankselect(), and swd_queue_dp_write().
|
static |
Put the SWJ-DP back to JTAG mode.
Definition at line 606 of file adi_v5_swd.c.
|
static |
Executes all queued DAP operations.
Definition at line 594 of file adi_v5_swd.c.
References ERROR_OK, swd_finish_read(), swd_multidrop_select(), and swd_run_inner().
|
static |
Definition at line 82 of file adi_v5_swd.c.
References adiv5_dap_swd_driver(), adiv5_dap::do_reconnect, ERROR_OK, and swd_driver::run.
Referenced by check_sync(), swd_connect(), swd_connect_single(), swd_multidrop_select_inner(), and swd_run().
|
static |
Definition at line 678 of file adi_v5_swd.c.
References adapter_driver, ERROR_FAIL, ERROR_OK, swd_driver::init, LOG_DEBUG, NULL, swd_driver::read_reg, register_commands(), swd_handlers, adapter_driver::swd_ops, and swd_driver::write_reg.
|
static |
Definition at line 56 of file adi_v5_swd.c.
References adiv5_dap_swd_driver(), and swd_driver::switch_seq.
Referenced by swd_connect_multidrop(), swd_connect_single(), and swd_multidrop_select_inner().
bool transport_is_swd | ( | void | ) |
Returns true if the current debug session is using SWD as its transport.
Definition at line 728 of file adi_v5_swd.c.
References get_current_transport(), and swd_transport.
Referenced by adapter_assert_reset(), adapter_deassert_reset(), adapter_resets(), am335xgpio_init(), bcm2835gpio_init(), bcm2835gpio_quit(), cleanup_all_fds(), dap_check_config(), dap_init_all(), imx_gpio_init(), imx_gpio_quit(), jim_jtag_arp_init_reset(), linuxgpiod_init(), and sysfsgpio_init().
|
static |
Definition at line 47 of file adi_v5_swd.c.
Referenced by check_sync().
|
static |
Definition at line 606 of file adi_v5_swd.c.
const struct dap_ops swd_dap_ops |
Definition at line 606 of file adi_v5_swd.c.
Referenced by dap_init_all().
|
static |
Definition at line 606 of file adi_v5_swd.c.
Referenced by swd_select().
|
static |
Definition at line 49 of file adi_v5_swd.c.
Referenced by swd_connect_multidrop(), swd_multidrop_select(), and swd_multidrop_select_inner().
|
static |
Definition at line 706 of file adi_v5_swd.c.
Referenced by transport_is_swd().