aboutsummaryrefslogtreecommitdiff
path: root/src/target/adi_v5_swd.c
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2018-08-29 11:57:42 +0200
committerMatthias Welwarsky <matthias@welwarsky.de>2019-01-30 14:29:10 +0000
commit7a80a74e8117332d6fd780f5c4697fe4bd3c41f7 (patch)
tree0bc8c4ced261c1370951469d640d3efaf888d35e /src/target/adi_v5_swd.c
parentbda2d7371874569cd5232580a3602dd56083a304 (diff)
downloadriscv-openocd-7a80a74e8117332d6fd780f5c4697fe4bd3c41f7.zip
riscv-openocd-7a80a74e8117332d6fd780f5c4697fe4bd3c41f7.tar.gz
riscv-openocd-7a80a74e8117332d6fd780f5c4697fe4bd3c41f7.tar.bz2
arm_adi_v5: rewrite dap_to_jtag and dap_to_swd
The functions dap_to_jtag() and dap_to_swd() have been introduced by 3ef9beb52cd0 ("ADIv5 DAP ops switching to JTAG or SWD modes") in arm_adi_v5.c by using the JTAG queue only. Later, in 6f8b8593d63b ("ADIv5 transport support moves to separate files") the functions has been moved in adi_v5_swd.c and adi_v5_jtag.c but keeping the dependency from JTAG queue. The functions does not work if the current transport is not JTAG. Move back the functions in arm_adi_v5.c, replace the input parameter "target" with "dap", use the transport to detect if the JTAG queue is present, in case of SWD transport use the proper method, for other transports report error. Reuse the ADI v5 sequences already present in jtag/swd.h. Also, OpenOCD does not support switching to another transport after the initial selection, so do not change DAP's ops vector. Change-Id: Ib681fbaa60cb342f732bc831eb92de25afa4e4db Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4852 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Diffstat (limited to 'src/target/adi_v5_swd.c')
-rw-r--r--src/target/adi_v5_swd.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/target/adi_v5_swd.c b/src/target/adi_v5_swd.c
index b520223..eb181cb 100644
--- a/src/target/adi_v5_swd.c
+++ b/src/target/adi_v5_swd.c
@@ -297,71 +297,6 @@ const struct dap_ops swd_dap_ops = {
.quit = swd_quit,
};
-/*
- * This represents the bits which must be sent out on TMS/SWDIO to
- * switch a DAP implemented using an SWJ-DP module into SWD mode.
- * These bits are stored (and transmitted) LSB-first.
- *
- * See the DAP-Lite specification, section 2.2.5 for information
- * about making the debug link select SWD or JTAG. (Similar info
- * is in a few other ARM documents.)
- */
-static const uint8_t jtag2swd_bitseq[] = {
- /* More than 50 TCK/SWCLK cycles with TMS/SWDIO high,
- * putting both JTAG and SWD logic into reset state.
- */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- /* Switching sequence enables SWD and disables JTAG
- * NOTE: bits in the DP's IDCODE may expose the need for
- * an old/obsolete/deprecated sequence (0xb6 0xed).
- */
- 0x9e, 0xe7,
- /* More than 50 TCK/SWCLK cycles with TMS/SWDIO high,
- * putting both JTAG and SWD logic into reset state.
- */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-};
-
-/**
- * Put the debug link into SWD mode, if the target supports it.
- * The link's initial mode may be either JTAG (for example,
- * with SWJ-DP after reset) or SWD.
- *
- * @param target Enters SWD mode (if possible).
- *
- * Note that targets using the JTAG-DP do not support SWD, and that
- * some targets which could otherwise support it may have have been
- * configured to disable SWD signaling
- *
- * @return ERROR_OK or else a fault code.
- */
-int dap_to_swd(struct target *target)
-{
- struct arm *arm = target_to_arm(target);
- int retval;
-
- if (!arm->dap) {
- LOG_ERROR("SWD mode is not available");
- return ERROR_FAIL;
- }
-
- LOG_DEBUG("Enter SWD mode");
-
- /* REVISIT it's ugly to need to make calls to a "jtag"
- * subsystem if the link may not be in JTAG mode...
- */
-
- retval = jtag_add_tms_seq(8 * sizeof(jtag2swd_bitseq),
- jtag2swd_bitseq, TAP_INVALID);
- if (retval == ERROR_OK)
- retval = jtag_execute_queue();
-
- /* set up the DAP's ops vector for SWD mode. */
- arm->dap->ops = &swd_dap_ops;
-
- return retval;
-}
-
static const struct command_registration swd_commands[] = {
{
/*