tcl/target: add SPDX tag
[fw/openocd] / tcl / target / swj-dp.tcl
1 # SPDX-License-Identifier: GPL-2.0-or-later
2
3 # ARM Debug Interface V5 (ADI_V5) utility
4 # ... Mostly for SWJ-DP (not SW-DP or JTAG-DP, since
5 # SW-DP and JTAG-DP targets don't need to switch based
6 # on which transport is active.
7 #
8 # declare a JTAG or SWD Debug Access Point (DAP)
9 # based on the transport in use with this session.
10 # You can't access JTAG ops when SWD is active, etc.
11
12 # params are currently what "jtag newtap" uses
13 # because OpenOCD internals are still strongly biased
14 # to JTAG ....  but for SWD, "irlen" etc are ignored,
15 # and the internals work differently
16
17 # for now, ignore non-JTAG and non-SWD transports
18 # (e.g. initial flash programming via SPI or UART)
19
20 # split out "chip" and "tag" so we can someday handle
21 # them more uniformly irlen too...)
22
23 if [catch {transport select}] {
24   echo "Error: unable to select a session transport. Can't continue."
25   shutdown
26 }
27
28 proc swj_newdap {chip tag args} {
29  if [using_jtag] {
30      eval jtag newtap $chip $tag $args
31  } elseif [using_swd] {
32      eval swd newdap $chip $tag $args
33  } else {
34      echo "Error: transport '[ transport select ]' not supported by swj_newdap"
35      shutdown
36  }
37 }