Skip to content

Commit 265e9db

Browse files
nordic-krchnashif
authored andcommitted
shell: uart: Fix init function
Init function can be called multiple times (after each shell reinitialization). It was missing reseting ring buffers and tx_busy flag. When called once proper state of those variable where handled by ram sections initialization. Signed-off-by: Krzysztof Chruscinski <[email protected]>
1 parent 0225ea7 commit 265e9db

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

subsys/shell/shell_uart.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ static void uart_irq_init(const struct shell_uart *sh_uart)
144144
#ifdef CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
145145
const struct device *dev = sh_uart->ctrl_blk->dev;
146146

147+
ring_buf_reset(sh_uart->tx_ringbuf);
148+
ring_buf_reset(sh_uart->rx_ringbuf);
149+
sh_uart->ctrl_blk->tx_busy = 0;
147150
uart_irq_callback_user_data_set(dev, uart_callback, (void *)sh_uart);
148151
uart_irq_rx_enable(dev);
149152
#endif

0 commit comments

Comments
 (0)