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 <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2021-03-18 11:07:13 +01:00 committed by Anas Nashif
commit 265e9dbb1b

View file

@ -144,6 +144,9 @@ static void uart_irq_init(const struct shell_uart *sh_uart)
#ifdef CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
const struct device *dev = sh_uart->ctrl_blk->dev;
ring_buf_reset(sh_uart->tx_ringbuf);
ring_buf_reset(sh_uart->rx_ringbuf);
sh_uart->ctrl_blk->tx_busy = 0;
uart_irq_callback_user_data_set(dev, uart_callback, (void *)sh_uart);
uart_irq_rx_enable(dev);
#endif