Browse Source

[components][drivers][usb][usb_device][cdc_vcom]: Add 'RT_VCOM_TX_TIMEOUT' to configure TX_TIMEOUT whick may block vcom tx thread for a long time. Add 'RT_VCOM_TASK_STK_SIZE', 'RT_VCOM_TX_USE_DMA', 'RT_VCOM_SERNO', 'RT_VCOM_SER_LEN', 'RT_VCOM_TX_TIMEOUT' to Kconfig

Peter Zhang 6 years ago
parent
commit
328a697c1d
2 changed files with 24 additions and 2 deletions
  1. 17 0
      components/drivers/Kconfig
  2. 7 2
      components/drivers/usb/usbdevice/class/cdc_vcom.c

+ 17 - 0
components/drivers/Kconfig

@@ -392,6 +392,23 @@ menu "Using USB"
                         bool "Enable to use device as winusb device"
                         default n
                 endif
+                if RT_USB_DEVICE_CDC
+                    config RT_VCOM_TASK_STK_SIZE
+                        int "virtual com thread stack size"
+                        default 512
+                    config RT_VCOM_TX_USE_DMA
+                        bool "Enable to use dma for vcom tx"
+                        default n
+                    config RT_VCOM_SERNO
+                        string "serial number of virtual com"
+                        default "32021919830108"
+                    config RT_VCOM_SER_LEN
+                        int "serial number length of virtual com"
+                        default 14
+                    config RT_VCOM_TX_TIMEOUT
+                        int "tx timeout(ticks) of virtual com"
+                        default 1000
+                endif
                 if RT_USB_DEVICE_WINUSB
                     config RT_WINUSB_GUID
                     string "Guid for winusb"

+ 7 - 2
components/drivers/usb/usbdevice/class/cdc_vcom.c

@@ -22,7 +22,12 @@
 
 #ifdef RT_USB_DEVICE_CDC
 
-#define TX_TIMEOUT              1000
+#ifdef RT_VCOM_TX_TIMEOUT
+#define VCOM_TX_TIMEOUT      RT_VCOM_TX_TIMEOUT
+#else /*!RT_VCOM_TX_TIMEOUT*/
+#define VCOM_TX_TIMEOUT      1000
+#endif /*RT_VCOM_TX_TIMEOUT*/
+
 #define CDC_RX_BUFSIZE          128
 #define CDC_MAX_PACKET_SIZE     64
 #define VCOM_DEVICE             "vcom"
@@ -880,7 +885,7 @@ static void vcom_tx_thread_entry(void* parameter)
 
             rt_usbd_io_request(func->device, data->ep_in, &data->ep_in->request);
 
-            if (rt_completion_wait(&data->wait, TX_TIMEOUT) != RT_EOK)
+            if (rt_completion_wait(&data->wait, VCOM_TX_TIMEOUT) != RT_EOK)
             {
                 RT_DEBUG_LOG(RT_DEBUG_USB, ("vcom tx timeout\n"));
             }