mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-15 03:40:19 +00:00
update cdc edpt read
This commit is contained in:
parent
8b9893cada
commit
33f0a18523
@ -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));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -1162,7 +1162,9 @@ bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
// DCD error, mark endpoint as ready to allow next transfer
|
||||
_usbd_dev.ep_status[epnum][dir].busy = false;
|
||||
_usbd_dev.ep_status[epnum][dir].claimed = 0;
|
||||
TU_LOG2("failed\r\n");
|
||||
TU_BREAKPOINT();
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user