summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhihong Chen <[email protected]>2024-03-04 16:35:43 +0800
committersakumisu <[email protected]>2024-03-04 22:00:21 +0800
commit9e9772fde793bd151d177233cdacf7f3a21e10be (patch)
treef267e4f6b51c532ff72f806be384d4fe31d2ccb5
parentb545830f7026a12b776bed4d7be1a91d8506813e (diff)
HPMicro: port: fix usbd_ep_close() not reset ep_enable flag
- fix usbd_ep_close() not reset ep_enable flag Signed-off-by: Zhihong Chen <[email protected]>
-rw-r--r--port/hpm/usb_dc_hpm.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/port/hpm/usb_dc_hpm.c b/port/hpm/usb_dc_hpm.c
index 43b91579..3533a887 100644
--- a/port/hpm/usb_dc_hpm.c
+++ b/port/hpm/usb_dc_hpm.c
@@ -165,6 +165,13 @@ int usbd_ep_open(uint8_t busid, const struct usb_endpoint_descriptor *ep)
int usbd_ep_close(uint8_t busid, const uint8_t ep)
{
usb_device_handle_t *handle = g_hpm_udc[busid].handle;
+ uint8_t ep_idx = USB_EP_GET_IDX(ep);
+
+ if (USB_EP_DIR_IS_OUT(ep)) {
+ g_hpm_udc[busid].out_ep[ep_idx].ep_enable = false;
+ } else {
+ g_hpm_udc[busid].in_ep[ep_idx].ep_enable = false;
+ }
usb_device_edpt_close(handle, ep);
return 0;
@@ -252,6 +259,10 @@ void USBD_IRQHandler(uint8_t busid)
return;
}
+ if (int_status & intr_error) {
+ USB_LOG_ERR("usbd intr error!\r\n");
+ }
+
if (int_status & intr_reset) {
memset(g_hpm_udc[busid].in_ep, 0, sizeof(struct hpm_ep_state) * USB_NUM_BIDIR_ENDPOINTS);
memset(g_hpm_udc[busid].out_ep, 0, sizeof(struct hpm_ep_state) * USB_NUM_BIDIR_ENDPOINTS);
@@ -262,8 +273,7 @@ void USBD_IRQHandler(uint8_t busid)
if (int_status & intr_suspend) {
if (usb_device_get_suspend_status(handle)) {
usbd_event_suspend_handler(busid);
- /* Note: Host may delay more than 3 ms before and/or after bus reset
- * before doing enumeration. */
+ /* Note: Host may delay more than 3 ms before and/or after bus reset before doing enumeration. */
if (usb_device_get_address(handle)) {
}
}