Skip to content

Commit d341bdd

Browse files
zeonchewAlessandroLuo
authored andcommitted
mcu: apollo4p: usb: suspend mode handling
Fixed Apollo4P USB suspend mode handling to support UDC_EVT_SUSPEND and UDC_EVT_RESUME event for ambiq UDC driver. Signed-off-by: Chew Zeh Yang <[email protected]>
1 parent 80a551f commit d341bdd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mcu/apollo4p/hal/am_hal_usb.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2931,6 +2931,7 @@ am_hal_usb_interrupt_service(void *pHandle,
29312931
USBPHY->REG10 |= 0x2;
29322932

29332933
// Back to active state
2934+
INTRUSBE_Suspend_Enable(pUSB);
29342935
pState->eDevState = AM_HAL_USB_DEV_STATE_RESUMING;
29352936
if (pState->dev_evt_callback)
29362937
{
@@ -2983,8 +2984,9 @@ am_hal_usb_interrupt_service(void *pHandle,
29832984
#endif
29842985

29852986
//
2986-
// Always enable the SuspendM
2987+
// Enable interrupt for USB suspend. Discard suspend interrupt event.
29872988
//
2989+
ui32IntrUsbStatus &= ~USB_INTRUSB_Suspend_Msk;
29882990
INTRUSBE_Suspend_Enable(pUSB);
29892991

29902992
if (pState->dev_evt_callback)
@@ -3054,6 +3056,7 @@ am_hal_usb_interrupt_service(void *pHandle,
30543056
//
30553057
USBPHY->REG10 &= 0xFD;
30563058

3059+
INTRUSBE_Suspend_Disable(pUSB);
30573060
pState->eDevState = AM_HAL_USB_DEV_STATE_SUSPENDING;
30583061
if (pState->dev_evt_callback)
30593062
{

0 commit comments

Comments
 (0)