stlink: simplify handling of SWIM 32/5532/6
authorAntonio Borneo <borneo.antonio@gmail.com>
Tue, 28 Jan 2020 14:53:06 +0000 (15:53 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 24 May 2020 20:33:22 +0000 (21:33 +0100)
commitce9e21b769358b6408aada59810c33544bd8df4d
tree86d04f69f242513de8e230e0f72fdbca224ea02f
parent72f67790cf21b6328c9e599fb549b81f805694fc
stlink: simplify handling of SWIM

Now that SWIM is not accessed through HLA anymore, decouple the
SWIM code and remove the conditional execution.

Fix the inconsistency of the return type for stlink_usb_state() in
case of SWIM (returns ERROR_OK while type is enum target_state)
introduced by commit 3de6b5f6e52f ("jtag/drivers/stlink_usb :
implemented and repaired SWIM support").
The code added by commit above in stlink_usb_state() is an hack to
reuse existing HLA API to perform a reconnect.
Move the SWIM specific code from stlink_usb_state() to a dedicated
stlink_swim_op_reconnect() that provides consistent data type.

Change-Id: I3fe175fef00b0735bea6139b057f217a080c9d38
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 3de6b5f6e52f ("jtag/drivers/stlink_usb : implemented and repaired SWIM support")
Reviewed-on: http://openocd.zylin.com/5532
Tested-by: jenkins
src/jtag/drivers/stlink_usb.c