shell: backends: uart: add option to force tx blocking

This adds a kconfig option to force
tx blocking on serial. This way only rx
will use the interrupt.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
Fin Maaß 2024-07-10 11:43:54 +02:00 committed by Fabio Baltieri
commit b7ab025bfd
2 changed files with 7 additions and 1 deletions

View file

@ -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

View file

@ -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);