swd: handle various failure conditions
commit9f6d4d1302e778a4f57033f3d86c757718f2ca9f
authorPaul Fertser <fercerpav@gmail.com>
Sun, 2 Nov 2014 12:16:13 +0000 (2 15:16 +0300)
committerSpencer Oliver <spen@spen-soft.co.uk>
Fri, 9 Jan 2015 08:36:52 +0000 (9 08:36 +0000)
treeadcf9dbea6778677d1a5db94054a788596bae9cb
parentc120fb6d893a89d9805d0b4d6083e47810143f2d
swd: handle various failure conditions

When communication with target fails for whatever reason, it makes
sense to do JTAG-to-SWD (in case the target got power-cycled or the
DAP method was reset anyhow), SWD line reset sequence (part of
JTAG-to-SWD already) and the mandatory IDCODE read. Schedule that to
be performed on the next poll.

Fix the return values for ftdi and jlink drivers to be consistent with
OpenOCD error codes and remove ad-hoc calls to perform DAP method
switching (as it's now done from the upper layer automatically).

Change-Id: Ie18797d4ce7ac43d8249f8f81f1064a2424e02be
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2371
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Mateusz Manowiecki <segmentation@fault.pl>
src/jtag/drivers/ftdi.c
src/jtag/drivers/jlink.c
src/target/adi_v5_swd.c
src/target/arm_adi_v5.h