summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharschu <[email protected]>2024-07-18 10:50:49 +0800
committersakumisu <[email protected]>2024-07-18 13:26:33 +0800
commitf1058c5e1a16f48f801bab72022ecee965ee6826 (patch)
treed6b306612f498bb827bd231899a0b0f236410cbc
parent643578e5bebd82b11bcad14e700ca9c2d7abc424 (diff)
fix(port/dwc2/usb_dc_dwc2): fix lost ep0 setup intstatus by clear, for dwc2 version 4.3
-rw-r--r--port/dwc2/usb_dc_dwc2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/port/dwc2/usb_dc_dwc2.c b/port/dwc2/usb_dc_dwc2.c
index a3815534..9f7d493d 100644
--- a/port/dwc2/usb_dc_dwc2.c
+++ b/port/dwc2/usb_dc_dwc2.c
@@ -433,7 +433,8 @@ static inline uint32_t dwc2_get_outep_intstatus(uint8_t epnum)
uint32_t tmpreg;
tmpreg = USB_OTG_OUTEP((uint32_t)epnum)->DOEPINT;
- tmpreg &= USB_OTG_DEV->DOEPMSK;
+ USB_OTG_OUTEP((uint32_t)epnum)->DOEPINT = tmpreg;
+ tmpreg = tmpreg & USB_OTG_DEV->DOEPMSK;
return tmpreg;
}
@@ -451,7 +452,10 @@ static inline uint32_t dwc2_get_inep_intstatus(uint8_t epnum)
msk = USB_OTG_DEV->DIEPMSK;
emp = USB_OTG_DEV->DIEPEMPMSK;
msk |= ((emp >> (epnum & 0x07)) & 0x1U) << 7;
- tmpreg = USB_OTG_INEP((uint32_t)epnum)->DIEPINT & msk;
+
+ tmpreg = USB_OTG_INEP((uint32_t)epnum)->DIEPINT;
+ USB_OTG_INEP((uint32_t)epnum)->DIEPINT = tmpreg;
+ tmpreg = tmpreg & msk;
return tmpreg;
}
@@ -1028,8 +1032,6 @@ void USBD_IRQHandler(uint8_t busid)
while (ep_intr != 0U) {
if ((ep_intr & 0x1U) != 0U) {
epint = dwc2_get_outep_intstatus(ep_idx);
- uint32_t DoepintReg = USB_OTG_OUTEP(ep_idx)->DOEPINT;
- USB_OTG_OUTEP(ep_idx)->DOEPINT = DoepintReg;
if ((epint & USB_OTG_DOEPINT_XFRC) == USB_OTG_DOEPINT_XFRC) {
if (ep_idx == 0) {
@@ -1062,8 +1064,6 @@ void USBD_IRQHandler(uint8_t busid)
while (ep_intr != 0U) {
if ((ep_intr & 0x1U) != 0U) {
epint = dwc2_get_inep_intstatus(ep_idx);
- uint32_t DiepintReg = USB_OTG_INEP(ep_idx)->DIEPINT;
- USB_OTG_INEP(ep_idx)->DIEPINT = DiepintReg;
if ((epint & USB_OTG_DIEPINT_XFRC) == USB_OTG_DIEPINT_XFRC) {
if (ep_idx == 0) {