Skip to content

Commit bfe8020

Browse files
keith-zephyrnashif
authored andcommitted
Revert "shell: backends: uart: avoid unnecessary TX IRQs"
This reverts commit d2e5eeb. PR #71172 is causing the bug reported on issue #72598. Signed-off-by: Keith Short <[email protected]>
1 parent 69fa94f commit bfe8020

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

subsys/shell/backends/shell_uart.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ static void dtr_timer_handler(struct k_timer *timer)
166166

167167
static void uart_tx_handle(const struct device *dev, struct shell_uart_int_driven *sh_uart)
168168
{
169-
uint32_t avail;
170-
uint32_t written;
169+
uint32_t len;
171170
const uint8_t *data;
172171

173172
if (!uart_dtr_check(dev)) {
@@ -177,22 +176,16 @@ static void uart_tx_handle(const struct device *dev, struct shell_uart_int_drive
177176
return;
178177
}
179178

180-
do {
181-
avail = ring_buf_get_claim(&sh_uart->tx_ringbuf, (uint8_t **)&data,
182-
sh_uart->tx_ringbuf.size);
183-
if (avail) {
184-
int err;
185-
186-
written = uart_fifo_fill(dev, data, avail);
187-
err = ring_buf_get_finish(&sh_uart->tx_ringbuf, written);
188-
__ASSERT_NO_MSG(err == 0);
189-
ARG_UNUSED(err);
190-
} else {
191-
written = 0;
192-
}
193-
} while (avail && written);
179+
len = ring_buf_get_claim(&sh_uart->tx_ringbuf, (uint8_t **)&data,
180+
sh_uart->tx_ringbuf.size);
181+
if (len) {
182+
int err;
194183

195-
if (avail == 0) {
184+
len = uart_fifo_fill(dev, data, len);
185+
err = ring_buf_get_finish(&sh_uart->tx_ringbuf, len);
186+
__ASSERT_NO_MSG(err == 0);
187+
ARG_UNUSED(err);
188+
} else {
196189
uart_irq_tx_disable(dev);
197190
sh_uart->tx_busy = 0;
198191
}

0 commit comments

Comments
 (0)