diff --git a/port/fsdev/usb_dc_fsdev.c b/port/fsdev/usb_dc_fsdev.c index 93af80cb..23756acd 100644 --- a/port/fsdev/usb_dc_fsdev.c +++ b/port/fsdev/usb_dc_fsdev.c @@ -126,19 +126,19 @@ int usbd_ep_open(const struct usbd_endpoint_cfg *ep_cfg) /* initialize Endpoint */ switch (ep_cfg->ep_type) { - case EP_TYPE_CTRL: + case USB_ENDPOINT_TYPE_CONTROL: wEpRegVal = USB_EP_CONTROL; break; - case EP_TYPE_BULK: + case USB_ENDPOINT_TYPE_BULK: wEpRegVal = USB_EP_BULK; break; - case EP_TYPE_INTR: + case USB_ENDPOINT_TYPE_INTERRUPT: wEpRegVal = USB_EP_INTERRUPT; break; - case EP_TYPE_ISOC: + case USB_ENDPOINT_TYPE_ISOCHRONOUS: wEpRegVal = USB_EP_ISOCHRONOUS; break; @@ -183,7 +183,7 @@ int usbd_ep_open(const struct usbd_endpoint_cfg *ep_cfg) } PCD_CLEAR_TX_DTOG(USB, ep_idx); - if (ep_cfg->ep_type != EP_TYPE_ISOC) { + if (ep_cfg->ep_type != USB_ENDPOINT_TYPE_ISOCHRONOUS) { /* Configure NAK status for the Endpoint */ PCD_SET_EP_TX_STATUS(USB, ep_idx, USB_EP_TX_NAK); } else { @@ -231,7 +231,7 @@ int usbd_ep_clear_stall(const uint8_t ep) if (USB_EP_DIR_IS_OUT(ep)) { PCD_CLEAR_TX_DTOG(USB, ep_idx); - if (usb_dc_cfg.in_ep[ep_idx].ep_type != EP_TYPE_ISOC) { + if (usb_dc_cfg.in_ep[ep_idx].ep_type != USB_ENDPOINT_TYPE_ISOCHRONOUS) { /* Configure NAK status for the Endpoint */ PCD_SET_EP_TX_STATUS(USB, ep_idx, USB_EP_TX_NAK); } @@ -259,6 +259,9 @@ int usbd_ep_write(const uint8_t ep, const uint8_t *data, uint32_t data_len, uint return -1; } + while (PCD_GET_EP_TX_STATUS(USB, ep_idx) == USB_EP_TX_VALID) { + } + if (!data_len) { PCD_SET_EP_TX_CNT(USB, ep_idx, (uint16_t)0); PCD_SET_EP_TX_STATUS(USB, ep_idx, USB_EP_TX_VALID); diff --git a/port/fsdev/usb_fsdev_reg.h b/port/fsdev/usb_fsdev_reg.h index 8c11c2a7..d1035537 100644 --- a/port/fsdev/usb_fsdev_reg.h +++ b/port/fsdev/usb_fsdev_reg.h @@ -1107,33 +1107,6 @@ typedef struct #define USB_COUNT7_RX_1_BLSIZE_1 0x80000000U /*!< BLock SIZE (high) */ -/** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS - * @{ - */ -#define EP_MPS_64 0U -#define EP_MPS_32 1U -#define EP_MPS_16 2U -#define EP_MPS_8 3U -/** - * @} - */ - -/** @defgroup USB_LL_EP_Type USB Low Layer EP Type - * @{ - */ -#define EP_TYPE_CTRL 0U -#define EP_TYPE_ISOC 1U -#define EP_TYPE_BULK 2U -#define EP_TYPE_INTR 3U -#define EP_TYPE_MSK 3U -/** - * @} - */ - -/** @defgroup USB_LL Device Speed - * @{ - */ -#define USBD_FS_SPEED 2U /** * @} */