arm_adi_v5: rewrite dap_to_jtag and dap_to_swd
commit7a80a74e8117332d6fd780f5c4697fe4bd3c41f7
authorAntonio Borneo <borneo.antonio@gmail.com>
Wed, 29 Aug 2018 09:57:42 +0000 (29 11:57 +0200)
committerMatthias Welwarsky <matthias@welwarsky.de>
Wed, 30 Jan 2019 14:29:10 +0000 (30 14:29 +0000)
tree0bc8c4ced261c1370951469d640d3efaf888d35e
parentbda2d7371874569cd5232580a3602dd56083a304
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>
src/flash/nor/stellaris.c
src/target/adi_v5_jtag.c
src/target/adi_v5_swd.c
src/target/arm_adi_v5.c
src/target/arm_adi_v5.h