arm_adi_v5: rewrite dap_to_jtag and dap_to_swd
The functions dap_to_jtag() and dap_to_swd() have been introduced by3ef9beb52c("ADIv5 DAP ops switching to JTAG or SWD modes") in arm_adi_v5.c by using the JTAG queue only. Later, in6f8b8593d6("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>
This commit is contained in:
committed by
Matthias Welwarsky
parent
bda2d73718
commit
7a80a74e81
@@ -1355,6 +1355,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command)
|
||||
COMMAND_HANDLER(stellaris_handle_recover_command)
|
||||
{
|
||||
struct flash_bank *bank;
|
||||
struct arm *arm;
|
||||
int retval;
|
||||
|
||||
if (CMD_ARGC != 0)
|
||||
@@ -1383,12 +1384,13 @@ COMMAND_HANDLER(stellaris_handle_recover_command)
|
||||
}
|
||||
adapter_assert_reset();
|
||||
|
||||
arm = target_to_arm(bank->target);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
retval = dap_to_swd(bank->target);
|
||||
retval = dap_to_swd(arm->dap);
|
||||
if (retval != ERROR_OK)
|
||||
goto done;
|
||||
|
||||
retval = dap_to_jtag(bank->target);
|
||||
retval = dap_to_jtag(arm->dap);
|
||||
if (retval != ERROR_OK)
|
||||
goto done;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user