From b7ab025bfdaf7ae0340a2c127812946ff32d92d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Wed, 10 Jul 2024 11:43:54 +0200 Subject: [PATCH] shell: backends: uart: add option to force tx blocking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a kconfig option to force tx blocking on serial. This way only rx will use the interrupt. Signed-off-by: Fin Maaß --- subsys/shell/backends/Kconfig.backends | 5 +++++ subsys/shell/backends/shell_uart.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/subsys/shell/backends/Kconfig.backends b/subsys/shell/backends/Kconfig.backends index 372ba109765..4524d03b9a4 100644 --- a/subsys/shell/backends/Kconfig.backends +++ b/subsys/shell/backends/Kconfig.backends @@ -75,6 +75,11 @@ config SHELL_BACKEND_SERIAL_API_ASYNC endchoice +config SHELL_BACKEND_SERIAL_FORCE_TX_BLOCKING_MODE + bool "Force blocking mode for TX" + help + Force blocking mode for TX. + config SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE int "Set TX ring buffer size" default 8 diff --git a/subsys/shell/backends/shell_uart.c b/subsys/shell/backends/shell_uart.c index a452323b0f8..7cf4bbf11d0 100644 --- a/subsys/shell/backends/shell_uart.c +++ b/subsys/shell/backends/shell_uart.c @@ -346,7 +346,8 @@ static int enable(const struct shell_transport *transport, bool blocking_tx) { struct shell_uart_common *sh_uart = (struct shell_uart_common *)transport->ctx; - sh_uart->blocking_tx = blocking_tx; + sh_uart->blocking_tx = + blocking_tx || IS_ENABLED(CONFIG_SHELL_BACKEND_SERIAL_FORCE_TX_BLOCKING_MODE); if (IS_ENABLED(CONFIG_SHELL_BACKEND_SERIAL_API_INTERRUPT_DRIVEN) && blocking_tx) { uart_irq_tx_disable(sh_uart->dev);