From e31cdc00a0a28bc246c75cdf7dd27366b31b09ba Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 31 Aug 2023 18:01:15 +0200 Subject: [PATCH] dap: react properly to unsupported UART commands Add ID_DAP_UART_* command definitions and react properly to unsupported UART commands. Signed-off-by: Maximilian Deubel Signed-off-by: Johann Fischer --- subsys/dap/cmsis_dap.c | 25 +++++++++++++++++++++++++ subsys/dap/cmsis_dap.h | 6 ++++++ 2 files changed, 31 insertions(+) diff --git a/subsys/dap/cmsis_dap.c b/subsys/dap/cmsis_dap.c index bab57301209..76127c801d4 100644 --- a/subsys/dap/cmsis_dap.c +++ b/subsys/dap/cmsis_dap.c @@ -922,6 +922,31 @@ static uint16_t dap_process_cmd(struct dap_context *const ctx, retval = 1; *response = DAP_ERROR; break; + case ID_DAP_UART_TRANSPORT: + LOG_ERR("UART Transport unsupported"); + retval = 1; + *response = DAP_ERROR; + break; + case ID_DAP_UART_CONFIGURE: + LOG_ERR("UART Configure unsupported"); + retval = 1; + *response = DAP_ERROR; + break; + case ID_DAP_UART_CONTROL: + LOG_ERR("UART Control unsupported"); + retval = 1; + *response = DAP_ERROR; + break; + case ID_DAP_UART_STATUS: + LOG_ERR("UART Status unsupported"); + retval = 1; + *response = DAP_ERROR; + break; + case ID_DAP_UART_TRANSFER: + LOG_ERR("UART Transfer unsupported"); + retval = 1; + *response = DAP_ERROR; + break; default: *(response - 1) = ID_DAP_INVALID; diff --git a/subsys/dap/cmsis_dap.h b/subsys/dap/cmsis_dap.h index 2e1fe10e836..787dc822b79 100644 --- a/subsys/dap/cmsis_dap.h +++ b/subsys/dap/cmsis_dap.h @@ -54,6 +54,12 @@ #define ID_DAP_SWO_STATUS 0x1BU #define ID_DAP_SWO_DATA 0x1CU +#define ID_DAP_UART_TRANSPORT 0x1FU +#define ID_DAP_UART_CONFIGURE 0x20U +#define ID_DAP_UART_CONTROL 0x22U +#define ID_DAP_UART_STATUS 0x23U +#define ID_DAP_UART_TRANSFER 0x21U + #define ID_DAP_QUEUE_COMMANDS 0x7EU #define ID_DAP_EXECUTE_COMMANDS 0x7FU