From 9cafcddc7ff8a71dc62ec818f22aeaf7a7c5c4d9 Mon Sep 17 00:00:00 2001 From: HiFiPhile Date: Sun, 21 Apr 2024 16:41:05 +0200 Subject: [PATCH] Adjust fifo reserved size. --- src/portable/synopsys/dwc2/dcd_dwc2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/portable/synopsys/dwc2/dcd_dwc2.c b/src/portable/synopsys/dwc2/dcd_dwc2.c index 5d6e8aeb46..2e926cee5e 100644 --- a/src/portable/synopsys/dwc2/dcd_dwc2.c +++ b/src/portable/synopsys/dwc2/dcd_dwc2.c @@ -375,9 +375,9 @@ static void bus_reset(uint8_t rhport) { // Setup the control endpoint 0 _allocated_fifo_words_tx = 16; - // DMA needs extra space for processing + // DMA needs extra space for processing, needs size confirmation if(dma_supported(rhport)) { - _allocated_fifo_words_tx += 2 * ep_count; + _allocated_fifo_words_tx += 72; } // Control IN uses FIFO 0 with 64 bytes ( 16 32-bit word ) @@ -777,6 +777,11 @@ void dcd_edpt_close_all(uint8_t rhport) { // reset allocated fifo IN _allocated_fifo_words_tx = 16; + // DMA needs extra space for processing, needs size confirmation + if(dma_supported(rhport)) { + _allocated_fifo_words_tx += 72; + } + fifo_flush_tx(dwc2, 0x10); // all tx fifo fifo_flush_rx(dwc2); }