drivers/cmsis_dap, kitprog: use helper to derive err code from ack
Unify the error codes returned by adapter drivers in the case of the received SWD ACK field differs from OK. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I29e478390b4b30408054a090ac6a7fac3415ae71 Reviewed-on: https://review.openocd.org/c/openocd/+/8137 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
This commit is contained in:
parent
12ff36bd19
commit
348b79aafe
|
@ -944,7 +944,7 @@ static void cmsis_dap_swd_read_process(struct cmsis_dap *dap, enum cmsis_dap_blo
|
||||||
if (ack != SWD_ACK_OK) {
|
if (ack != SWD_ACK_OK) {
|
||||||
LOG_DEBUG("SWD ack not OK @ %d %s", transfer_count,
|
LOG_DEBUG("SWD ack not OK @ %d %s", transfer_count,
|
||||||
ack == SWD_ACK_WAIT ? "WAIT" : ack == SWD_ACK_FAULT ? "FAULT" : "JUNK");
|
ack == SWD_ACK_WAIT ? "WAIT" : ack == SWD_ACK_FAULT ? "FAULT" : "JUNK");
|
||||||
queued_retval = ack == SWD_ACK_WAIT ? ERROR_WAIT : ERROR_FAIL;
|
queued_retval = swd_ack_to_error_code(ack);
|
||||||
/* TODO: use results of transfers completed before the error occurred? */
|
/* TODO: use results of transfers completed before the error occurred? */
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
|
|
@ -782,7 +782,7 @@ static int kitprog_swd_run_queue(void)
|
||||||
if (ack != SWD_ACK_OK || (buffer[read_index] & 0x08)) {
|
if (ack != SWD_ACK_OK || (buffer[read_index] & 0x08)) {
|
||||||
LOG_DEBUG("SWD ack not OK: %d %s", i,
|
LOG_DEBUG("SWD ack not OK: %d %s", i,
|
||||||
ack == SWD_ACK_WAIT ? "WAIT" : ack == SWD_ACK_FAULT ? "FAULT" : "JUNK");
|
ack == SWD_ACK_WAIT ? "WAIT" : ack == SWD_ACK_FAULT ? "FAULT" : "JUNK");
|
||||||
queued_retval = ack == SWD_ACK_WAIT ? ERROR_WAIT : ERROR_FAIL;
|
queued_retval = swd_ack_to_error_code(ack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
read_index++;
|
read_index++;
|
||||||
|
|
Loading…
Reference in New Issue