This is an automated email from Gerrit. "Tomas Vanek <van...@fbl.cz>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8747
-- gerrit commit e607bb82e09943067af46e70f23560e4d50f23ad Author: Tomas Vanek <van...@fbl.cz> Date: Sun Feb 9 11:35:11 2025 +0100 drivers/ch347: fix SWD log messages Remove annoying and not too informative error message `ack != SWD_ACK_OK`. Fix copy&paste error in message `SWD Read data parity mismatch` logged in case of a write returning bad ack. Raise log level of read/write descriptive message to DEBUG when reg read/writes returns bad ack. Change-Id: Ic3433ae8bd02472756adf269658bfba0ba34dc26 Signed-off-by: Tomas Vanek <van...@fbl.cz> diff --git a/src/jtag/drivers/ch347.c b/src/jtag/drivers/ch347.c index 7d61413f73..80808144ff 100644 --- a/src/jtag/drivers/ch347.c +++ b/src/jtag/drivers/ch347.c @@ -2157,13 +2157,25 @@ static int ch347_swd_run_queue_inner(void) /* Devices do not reply to DP_TARGETSEL write cmd, ignore received ack */ check_ack = swd_cmd_returns_ack(pswd_io->cmd); - if (ack != SWD_ACK_OK && check_ack) { - ch347_swd_context.queued_retval = swd_ack_to_error_code(ack); - LOG_ERROR("ack != SWD_ACK_OK"); - goto skip; - } if (pswd_io->cmd & SWD_CMD_RNW) { uint32_t data = buf_get_u32(&recv_buf[recv_len], 0, 32); + + LOG_CUSTOM_LEVEL((check_ack && ack != SWD_ACK_OK) + ? LOG_LVL_DEBUG : LOG_LVL_DEBUG_IO, + "%s%s %s read reg %X = %08" PRIx32, + check_ack ? "" : "ack ignored ", + ack == SWD_ACK_OK ? "OK" : + ack == SWD_ACK_WAIT ? "WAIT" : + ack == SWD_ACK_FAULT ? "FAULT" : "JUNK", + pswd_io->cmd & SWD_CMD_APNDP ? "AP" : "DP", + (pswd_io->cmd & SWD_CMD_A32) >> 1, + data); + + if (ack != SWD_ACK_OK && check_ack) { + ch347_swd_context.queued_retval = swd_ack_to_error_code(ack); + goto skip; + } + uint32_t parity = buf_get_u32(&recv_buf[recv_len], 32, 1); if (parity != (uint32_t)parity_u32(data)) { LOG_ERROR("SWD Read data parity mismatch"); @@ -2171,15 +2183,6 @@ static int ch347_swd_run_queue_inner(void) goto skip; } - LOG_DEBUG_IO("%s%s %s %s reg %X = %08X - " PRIx32, - check_ack ? "" : "ack ignored ", - ack == SWD_ACK_OK ? "OK" : ack == SWD_ACK_WAIT ? "WAIT" : - ack == SWD_ACK_FAULT ? "FAULT" : "JUNK", - pswd_io->cmd & SWD_CMD_APNDP ? "AP" : "DP", - pswd_io->cmd & SWD_CMD_RNW ? "read" : "write", - (pswd_io->cmd & SWD_CMD_A32) >> 1, - data); - if (pswd_io->dst) *pswd_io->dst = data; } else { @@ -2194,19 +2197,22 @@ static int ch347_swd_run_queue_inner(void) /* Devices do not reply to DP_TARGETSEL write cmd, ignore received ack */ check_ack = swd_cmd_returns_ack(pswd_io->cmd); + + LOG_CUSTOM_LEVEL((check_ack && ack != SWD_ACK_OK) + ? LOG_LVL_DEBUG : LOG_LVL_DEBUG_IO, + "%s%s %s write reg %X = %08" PRIx32, + check_ack ? "" : "ack ignored ", + ack == SWD_ACK_OK ? "OK" : + ack == SWD_ACK_WAIT ? "WAIT" : + ack == SWD_ACK_FAULT ? "FAULT" : "JUNK", + pswd_io->cmd & SWD_CMD_APNDP ? "AP" : "DP", + (pswd_io->cmd & SWD_CMD_A32) >> 1, + pswd_io->value); + if (ack != SWD_ACK_OK && check_ack) { ch347_swd_context.queued_retval = swd_ack_to_error_code(ack); - LOG_ERROR("SWD Read data parity mismatch"); goto skip; } - LOG_DEBUG_IO("%s%s %s %s reg %X = %08X - " PRIx32, - check_ack ? "" : "ack ignored ", - ack == SWD_ACK_OK ? "OK" : ack == SWD_ACK_WAIT ? "WAIT" : - ack == SWD_ACK_FAULT ? "FAULT" : "JUNK", - pswd_io->cmd & SWD_CMD_APNDP ? "AP" : "DP", - pswd_io->cmd & SWD_CMD_RNW ? "read" : "write", - (pswd_io->cmd & SWD_CMD_A32) >> 1, - pswd_io->value); } else { ch347_swd_context.queued_retval = ERROR_FAIL; LOG_ERROR("CH347 usb write/read failed recv_len = %d", recv_len); --