Revert "shell: backends: uart: avoid unnecessary TX IRQs"

This reverts commit d2e5eeb51d.

PR zephyrproject-rtos/zephyr#71172 is causing the bug reported on
issue zephyrproject-rtos/zephyr#72598.

Signed-off-by: Keith Short <keithshort@google.com>
This commit is contained in:
Keith Short 2024-05-10 13:32:15 -06:00 committed by Anas Nashif
parent 69fa94f761
commit bfe8020c4c
1 changed files with 10 additions and 17 deletions

View File

@ -166,8 +166,7 @@ static void dtr_timer_handler(struct k_timer *timer)
static void uart_tx_handle(const struct device *dev, struct shell_uart_int_driven *sh_uart)
{
uint32_t avail;
uint32_t written;
uint32_t len;
const uint8_t *data;
if (!uart_dtr_check(dev)) {
@ -177,22 +176,16 @@ static void uart_tx_handle(const struct device *dev, struct shell_uart_int_drive
return;
}
do {
avail = ring_buf_get_claim(&sh_uart->tx_ringbuf, (uint8_t **)&data,
sh_uart->tx_ringbuf.size);
if (avail) {
int err;
len = ring_buf_get_claim(&sh_uart->tx_ringbuf, (uint8_t **)&data,
sh_uart->tx_ringbuf.size);
if (len) {
int err;
written = uart_fifo_fill(dev, data, avail);
err = ring_buf_get_finish(&sh_uart->tx_ringbuf, written);
__ASSERT_NO_MSG(err == 0);
ARG_UNUSED(err);
} else {
written = 0;
}
} while (avail && written);
if (avail == 0) {
len = uart_fifo_fill(dev, data, len);
err = ring_buf_get_finish(&sh_uart->tx_ringbuf, len);
__ASSERT_NO_MSG(err == 0);
ARG_UNUSED(err);
} else {
uart_irq_tx_disable(dev);
sh_uart->tx_busy = 0;
}