diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c b/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c index 9c29966ed0..182dd3a2d4 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c @@ -28,12 +28,22 @@ static struct ep_id _ep_pool[] = #else {0x1, USB_EP_ATTR_BULK, USB_DIR_IN, 64, ID_UNASSIGNED}, {0x1, USB_EP_ATTR_BULK, USB_DIR_OUT, 64, ID_UNASSIGNED}, -#endif - {0x2, USB_EP_ATTR_INT, USB_DIR_IN, 64, ID_UNASSIGNED}, - {0x2, USB_EP_ATTR_INT, USB_DIR_OUT, 64, ID_UNASSIGNED}, + {0x2, USB_EP_ATTR_BULK, USB_DIR_IN, 64, ID_UNASSIGNED}, + {0x2, USB_EP_ATTR_BULK, USB_DIR_OUT, 64, ID_UNASSIGNED}, {0x3, USB_EP_ATTR_BULK, USB_DIR_IN, 64, ID_UNASSIGNED}, -#if !defined(SOC_SERIES_STM32F1) {0x3, USB_EP_ATTR_BULK, USB_DIR_OUT, 64, ID_UNASSIGNED}, +#endif + {0x4, USB_EP_ATTR_INT, USB_DIR_IN, 64, ID_UNASSIGNED}, + {0x4, USB_EP_ATTR_INT, USB_DIR_OUT, 64, ID_UNASSIGNED}, + {0x5, USB_EP_ATTR_INT, USB_DIR_IN, 64, ID_UNASSIGNED}, + {0x5, USB_EP_ATTR_INT, USB_DIR_OUT, 64, ID_UNASSIGNED}, + {0x6, USB_EP_ATTR_INT, USB_DIR_IN, 64, ID_UNASSIGNED}, + {0x6, USB_EP_ATTR_INT, USB_DIR_OUT, 64, ID_UNASSIGNED}, + {0x7, USB_EP_ATTR_BULK, USB_DIR_IN, 64, ID_UNASSIGNED}, + {0x8, USB_EP_ATTR_BULK, USB_DIR_IN, 64, ID_UNASSIGNED}, + {0x9, USB_EP_ATTR_BULK, USB_DIR_IN, 64, ID_UNASSIGNED}, +#if !defined(SOC_SERIES_STM32F1) + {0x9, USB_EP_ATTR_BULK, USB_DIR_OUT, 64, ID_UNASSIGNED}, #endif {0xFF, USB_EP_ATTR_TYPE_MASK, USB_DIR_MASK, 0, ID_ASSIGNED }, }; diff --git a/components/drivers/usb/usbdevice/class/cdc_vcom.c b/components/drivers/usb/usbdevice/class/cdc_vcom.c index df5e03f54c..91b49d47de 100644 --- a/components/drivers/usb/usbdevice/class/cdc_vcom.c +++ b/components/drivers/usb/usbdevice/class/cdc_vcom.c @@ -100,7 +100,7 @@ static struct udevice_descriptor dev_desc = USB_CLASS_CDC, //bDeviceClass; 0x00, //bDeviceSubClass; 0x00, //bDeviceProtocol; - CDC_MAX_PACKET_SIZE, //bMaxPacketSize0; + CDC_MAX_PACKET_SIZE, //bMaxPacketSize0; _VENDOR_ID, //idVendor; _PRODUCT_ID, //idProduct; USB_BCD_DEVICE, //bcdDevice; @@ -498,6 +498,10 @@ static rt_err_t _function_enable(ufunction_t func) data->ep_out->buffer = rt_malloc(CDC_RX_BUFSIZE); RT_ASSERT(data->ep_out->buffer != RT_NULL); +#ifdef RT_USING_SERIAL_V2 + data->serial.serial_rx = &data->rx_ringbuffer; +#endif + data->ep_out->request.buffer = data->ep_out->buffer; data->ep_out->request.size = EP_MAXPACKET(data->ep_out); @@ -882,10 +886,15 @@ static void vcom_tx_thread_entry(void* parameter) if (!data->connected) { if(data->serial.parent.open_flag & +#ifdef RT_USING_SERIAL_V1 #ifndef VCOM_TX_USE_DMA RT_DEVICE_FLAG_INT_TX #else RT_DEVICE_FLAG_DMA_TX +#endif +#endif +#ifdef RT_USING_SERIAL_V2 + RT_DEVICE_FLAG_TX_BLOCKING #endif ) { @@ -911,10 +920,15 @@ static void vcom_tx_thread_entry(void* parameter) RT_DEBUG_LOG(RT_DEBUG_USB, ("vcom tx timeout\n")); } if(data->serial.parent.open_flag & +#ifdef RT_USING_SERIAL_V1 #ifndef VCOM_TX_USE_DMA RT_DEVICE_FLAG_INT_TX #else RT_DEVICE_FLAG_DMA_TX +#endif +#endif +#ifdef RT_USING_SERIAL_V2 + RT_DEVICE_FLAG_TX_BLOCKING #endif ) {