Use double-sized fifo only for IN endpoints
This commit is contained in:
@@ -648,10 +648,7 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
|
||||
xfer->max_size = tu_edpt_packet_size(desc_edpt);
|
||||
xfer->interval = desc_edpt->bInterval;
|
||||
|
||||
// The fifo-empty interrupt fires when the interrupt is half empty. In order
|
||||
// to be able to write a packet at that point, the fifo must be twice the
|
||||
// max_size.
|
||||
uint16_t const fifo_size = tu_div_ceil(xfer->max_size * 2, 4);
|
||||
uint16_t fifo_size = tu_div_ceil(xfer->max_size, 4);
|
||||
|
||||
if(dir == TUSB_DIR_OUT)
|
||||
{
|
||||
@@ -697,6 +694,11 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
|
||||
// In FIFO is allocated by following rules:
|
||||
// - IN EP 1 gets FIFO 1, IN EP "n" gets FIFO "n".
|
||||
|
||||
// The fifo-empty interrupt fires when the interrupt is half empty. In order
|
||||
// to be able to write a packet at that point, the fifo must be twice the
|
||||
// max_size.
|
||||
fifo_size = fifo_size * 2;
|
||||
|
||||
// Check if free space is available
|
||||
TU_ASSERT(_allocated_fifo_words_tx + fifo_size + dwc2->grxfsiz <= _dwc2_controller[rhport].ep_fifo_size/4);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user