Skip to content

Commit

Permalink
Revert "shell: backends: uart: avoid unnecessary TX IRQs"
Browse files Browse the repository at this point in the history
This reverts commit d2e5eeb.

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

Signed-off-by: Keith Short <[email protected]>
  • Loading branch information
keith-zephyr authored and nashif committed May 10, 2024
1 parent 69fa94f commit bfe8020
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions subsys/shell/backends/shell_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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;

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);
len = ring_buf_get_claim(&sh_uart->tx_ringbuf, (uint8_t **)&data,
sh_uart->tx_ringbuf.size);
if (len) {
int err;

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;
}
Expand Down

0 comments on commit bfe8020

Please sign in to comment.