diff options
| author | sakumisu <[email protected]> | 2024-07-30 18:12:46 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2024-07-30 18:12:46 +0800 |
| commit | 35a76f58bba0b7ed8497a3769035e0db3618c4c5 (patch) | |
| tree | 306f4ac7b2990bcad113356077e93f7e6627635c | |
| parent | 564d568732e2ce65b28b64c26864ed3a48db7895 (diff) | |
update(port/hpm/usb_dc_hpm): enable resume handler
| -rw-r--r-- | port/hpm/usb_dc_hpm.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/port/hpm/usb_dc_hpm.c b/port/hpm/usb_dc_hpm.c index 1e2f32df..a384a9ed 100644 --- a/port/hpm/usb_dc_hpm.c +++ b/port/hpm/usb_dc_hpm.c @@ -39,6 +39,7 @@ struct hpm_ep_state { /* Driver state */ struct hpm_udc { usb_device_handle_t *handle; + bool is_suspend; struct hpm_ep_state in_ep[USB_NUM_BIDIR_ENDPOINTS]; /*!< IN endpoint parameters*/ struct hpm_ep_state out_ep[USB_NUM_BIDIR_ENDPOINTS]; /*!< OUT endpoint parameters */ } g_hpm_udc[CONFIG_USBDEV_MAX_BUS]; @@ -282,13 +283,19 @@ void USBD_IRQHandler(uint8_t busid) usb_device_bus_reset(handle, 64); } - if (int_status & intr_suspend) { + if (!g_hpm_udc[busid].is_suspend && (int_status & intr_suspend)) { if (usb_device_get_suspend_status(handle)) { + g_hpm_udc[busid].is_suspend = true; usbd_event_suspend_handler(busid); /* Note: Host may delay more than 3 ms before and/or after bus reset before doing enumeration. */ if (usb_device_get_address(handle)) { } + } else { } + } else if (g_hpm_udc[busid].is_suspend && (!(int_status & intr_suspend))) { + g_hpm_udc[busid].is_suspend = false; + usbd_event_resume_handler(busid); + } else { } if (int_status & intr_port_change) { |
