serial/usb: update struct ring_buf users
Update the interrupt driver UART drivers that use `struct ring_buf` internally to report the number of bytes that can be pushed in `uart_fifo_fill` without fragmentation. Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
parent
5bd53b6e2e
commit
81352d011f
4 changed files with 8 additions and 10 deletions
|
|
@ -130,10 +130,10 @@ static void irq_tx_disable(const struct device *dev)
|
|||
static int irq_tx_ready(const struct device *dev)
|
||||
{
|
||||
struct serial_vnd_data *data = dev->data;
|
||||
bool ready = (ring_buf_space_get(data->written) != 0);
|
||||
int available = ring_buf_space_get(data->written);
|
||||
|
||||
LOG_DBG("tx ready: %d", ready);
|
||||
return ready;
|
||||
LOG_DBG("tx ready: %d", available);
|
||||
return available;
|
||||
}
|
||||
|
||||
static void irq_callback_set(const struct device *dev, uart_irq_callback_user_data_t cb,
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ static int uart_emul_fifo_read(const struct device *dev, uint8_t *rx_data, int s
|
|||
|
||||
static int uart_emul_irq_tx_ready(const struct device *dev)
|
||||
{
|
||||
bool ready = false;
|
||||
int available = 0;
|
||||
struct uart_emul_data *data = dev->data;
|
||||
|
||||
K_SPINLOCK(&data->tx_lock) {
|
||||
|
|
@ -239,10 +239,10 @@ static int uart_emul_irq_tx_ready(const struct device *dev)
|
|||
K_SPINLOCK_BREAK;
|
||||
}
|
||||
|
||||
ready = ring_buf_space_get(data->tx_rb) > 0;
|
||||
available = ring_buf_space_get(data->tx_rb);
|
||||
}
|
||||
|
||||
return ready;
|
||||
return available;
|
||||
}
|
||||
|
||||
static int uart_emul_irq_rx_ready(const struct device *dev)
|
||||
|
|
|
|||
|
|
@ -622,7 +622,7 @@ static int cdc_acm_irq_tx_ready(const struct device *dev)
|
|||
struct cdc_acm_dev_data_t * const dev_data = dev->data;
|
||||
|
||||
if (dev_data->tx_irq_ena && dev_data->tx_ready) {
|
||||
return 1;
|
||||
return ring_buf_space_get(dev_data->tx_ringbuf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -707,9 +707,7 @@ static int cdc_acm_irq_tx_ready(const struct device *dev)
|
|||
struct cdc_acm_uart_data *const data = dev->data;
|
||||
|
||||
if (check_wq_ctx(dev)) {
|
||||
if (ring_buf_space_get(data->tx_fifo.rb)) {
|
||||
return 1;
|
||||
}
|
||||
return ring_buf_space_get(data->tx_fifo.rb);
|
||||
} else {
|
||||
LOG_WRN("Invoked by inappropriate context");
|
||||
__ASSERT_NO_MSG(false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue