summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2022-09-11 22:41:43 +0800
committersakumisu <[email protected]>2022-09-11 22:41:43 +0800
commit525d4b8ebff8a87441c437e9612cc2219b44a6ed (patch)
tree0b3cd4a04cf756706cb68485de3a2a80606b845c
parent7990ee97478da7bf1408de64edd36365ee582500 (diff)
fix ep enable when calls usbd_ep_open
-rw-r--r--port/ch32/usb_dc_usbhs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/port/ch32/usb_dc_usbhs.c b/port/ch32/usb_dc_usbhs.c
index 4c3ee8f4..80f127a8 100644
--- a/port/ch32/usb_dc_usbhs.c
+++ b/port/ch32/usb_dc_usbhs.c
@@ -1,10 +1,6 @@
#include "usbd_core.h"
#include "usb_ch32_usbhs_reg.h"
-#ifndef CONFIG_USBDEV_ALIGN_CHECK_DISABLE
-#error "ch32 ip must disable align check"
-#endif
-
#ifndef USBD_IRQHandler
#define USBD_IRQHandler USBHS_IRQHandler //use actual usb irq name instead
#endif
@@ -107,11 +103,13 @@ int usbd_ep_open(const struct usbd_endpoint_cfg *ep_cfg)
if (USB_EP_DIR_IS_OUT(ep_cfg->ep_addr)) {
g_ch32_usbhs_udc.out_ep[ep_idx].ep_mps = ep_cfg->ep_mps;
g_ch32_usbhs_udc.out_ep[ep_idx].ep_type = ep_cfg->ep_type;
+ g_ch32_usbhs_udc.out_ep[ep_idx].ep_enable = true;
USBHS_DEVICE->ENDP_CONFIG |= (1 << (ep_idx + 16));
USB_SET_RX_CTRL(ep_idx, USBHS_EP_R_RES_NAK | USBHS_EP_R_TOG_0 | USBHS_EP_R_AUTOTOG);
} else {
g_ch32_usbhs_udc.in_ep[ep_idx].ep_mps = ep_cfg->ep_mps;
g_ch32_usbhs_udc.in_ep[ep_idx].ep_type = ep_cfg->ep_type;
+ g_ch32_usbhs_udc.in_ep[ep_idx].ep_enable = true;
USBHS_DEVICE->ENDP_CONFIG |= (1 << (ep_idx));
USB_SET_TX_CTRL(ep_idx, USBHS_EP_T_RES_NAK | USBHS_EP_T_TOG_0 | USBHS_EP_T_AUTOTOG);
}