usb: device_next: CDC ACM: Process TX on configuration enable

If CDC ACM uart side has TX enabled when the configuration gets enabled,
depending on fifo state following has to happen:
  * if the fifo is empty - trigger TX ready interrupt
  * if the fifo is not empty - queue TX data on IN endpoint

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
This commit is contained in:
Tomasz Moń 2024-05-24 08:50:31 +02:00 committed by Fabio Baltieri
parent 1784446c8d
commit c30ac4dfd8

View File

@ -268,7 +268,13 @@ static void usbd_cdc_acm_enable(struct usbd_class_data *const c_data)
}
if (atomic_test_bit(&data->state, CDC_ACM_IRQ_TX_ENABLED)) {
/* TODO */
if (ring_buf_is_empty(data->tx_fifo.rb)) {
/* Raise TX ready interrupt */
cdc_acm_work_submit(&data->irq_cb_work);
} else {
/* Queue pending TX data on IN endpoint */
cdc_acm_work_submit(&data->tx_fifo_work);
}
}
}