From ceebe2385b505381d2c8cc09645c86b7382dea53 Mon Sep 17 00:00:00 2001 From: HiFiPhile Date: Sat, 6 Apr 2024 19:27:00 +0200 Subject: [PATCH] WIP --- src/portable/synopsys/dwc2/dcd_dwc2.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/portable/synopsys/dwc2/dcd_dwc2.c b/src/portable/synopsys/dwc2/dcd_dwc2.c index 8c904fe895..5281088672 100644 --- a/src/portable/synopsys/dwc2/dcd_dwc2.c +++ b/src/portable/synopsys/dwc2/dcd_dwc2.c @@ -207,7 +207,7 @@ static void dma_ep0_start(uint8_t rhport) dwc2->epout[0].doeptsiz = (3 << DOEPTSIZ_STUPCNT_Pos); dwc2->epout[0].doeptsiz |= (3 * 8); dwc2->epout[0].doeptsiz |= (1 << DOEPTSIZ_PKTCNT_Pos); - dwc2->epout[0].doepdma = (uint32_t)_setup_packet; + dwc2->epout[0].doepdma = (uintptr_t)_setup_packet; dwc2->epout[0].doepctl |= DOEPCTL_EPENA | DOEPCTL_USBAEP; } @@ -417,7 +417,7 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c ((total_bytes << DIEPTSIZ_XFRSIZ_Pos) & DIEPTSIZ_XFRSIZ_Msk); if(dma_supported(rhport)) { - epin[epnum].diepdma = (uint32_t)xfer->buffer; + epin[epnum].diepdma = (uintptr_t)xfer->buffer; // For ISO endpoint set correct odd/even bit for next frame. if ((epin[epnum].diepctl & DIEPCTL_EPTYP) == DIEPCTL_EPTYP_0 && (XFER_CTL_BASE(epnum, dir))->interval == 1) { @@ -458,7 +458,7 @@ static void edpt_schedule_packets(uint8_t rhport, uint8_t const epnum, uint8_t c } if(dma_supported(rhport)) { - epout[epnum].doepdma = (uint32_t)xfer->buffer; + epout[epnum].doepdma = (uintptr_t)xfer->buffer; } epout[epnum].doepctl |= DOEPCTL_EPENA | DOEPCTL_CNAK; @@ -1063,12 +1063,13 @@ static void handle_epout_irq(uint8_t rhport) { // STPKTRX is only available for version from 3_00a if ((doepint & DOEPINT_STPKTRX) && (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a)) { clear_flag |= DOEPINT_STPKTRX; - if(dma_supported(rhport)) { - dma_ep0_start(rhport); - } } - epout->doepint = clear_flag; + + if(dma_supported(rhport) && (dwc2->gsnpsid >= DWC2_CORE_REV_3_00a)) { + dma_ep0_start(rhport); + } + dcd_event_setup_received(rhport, (uint8_t*) _setup_packet, true); }