summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-09-09 16:25:31 +0700
committerhathach <[email protected]>2020-09-09 16:25:31 +0700
commit33f0a18523accfcdebf186f33271dd92f8681b56 (patch)
treedf9990e0211e59da9109f171a7da2abb26e02f7e /src/class
parent8b9893cadab88fa4abd17d5b9856e0d08ef03796 (diff)
update cdc edpt read
Diffstat (limited to 'src/class')
-rw-r--r--src/class/cdc/cdc_device.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c
index cd8904042..317355ed7 100644
--- a/src/class/cdc/cdc_device.c
+++ b/src/class/cdc/cdc_device.c
@@ -77,15 +77,13 @@ static void _prep_out_transaction (uint8_t itf)
{
cdcd_interface_t* p_cdc = &_cdcd_itf[itf];
+ // Prepare for incoming data but only allow what we can store in the ring buffer.
+ uint16_t const available = tu_fifo_remaining(&p_cdc->rx_ff);
+ TU_VERIFY( available >= sizeof(p_cdc->epout_buf), );
+
// claim endpoint
TU_VERIFY( usbd_edpt_claim(TUD_OPT_RHPORT, p_cdc->ep_out), );
-
- // Prepare for incoming data but only allow what we can store in the ring buffer.
- uint16_t max_read = tu_fifo_remaining(&p_cdc->rx_ff);
- if ( max_read >= sizeof(p_cdc->epout_buf) )
- {
- usbd_edpt_xfer(TUD_OPT_RHPORT, p_cdc->ep_out, p_cdc->epout_buf, sizeof(p_cdc->epout_buf));
- }
+ usbd_edpt_xfer(TUD_OPT_RHPORT, p_cdc->ep_out, p_cdc->epout_buf, sizeof(p_cdc->epout_buf));
}
//--------------------------------------------------------------------+