Skip to content

Commit

Permalink
Fix wakeup interrupt
Browse files Browse the repository at this point in the history
- Added the support for the wakeup interrupt
- Properly handles the interrupt depending on the used USB port of the device
  • Loading branch information
RockyZeroFour committed May 1, 2024
1 parent b715353 commit 634f1b5
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/portable/synopsys/dwc2/dwc2_gd32f.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,32 @@ extern uint32_t SystemCoreClock;

TU_ATTR_ALWAYS_INLINE
static inline void dwc2_dcd_int_enable(uint8_t rhport) {
(void)rhport;
NVIC_EnableIRQ(RHPORT_IRQn);
// NVIC_EnableIRQ(USBHS_WKUP_IRQn);
switch (rhport) {
case 0:
NVIC_EnableIRQ(USBFS_IRQn);
NVIC_EnableIRQ(USBFS_WKUP_IRQn);
break;

case 1:
NVIC_EnableIRQ(USBHS_IRQn);
NVIC_EnableIRQ(USBHS_WKUP_IRQn);
break;
}
}

TU_ATTR_ALWAYS_INLINE
static inline void dwc2_dcd_int_disable(uint8_t rhport) {
(void)rhport;
NVIC_DisableIRQ(RHPORT_IRQn);
// NVIC_DisableIRQ(USBHS_WKUP_IRQn);
switch (rhport) {
case 0:
NVIC_DisableIRQ(USBFS_IRQn);
NVIC_DisableIRQ(USBFS_WKUP_IRQn);
break;

case 1:
NVIC_DisableIRQ(USBHS_IRQn);
NVIC_DisableIRQ(USBHS_WKUP_IRQn);
break;
}
}

TU_ATTR_ALWAYS_INLINE
Expand Down

0 comments on commit 634f1b5

Please sign in to comment.