You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/09/16 02:33:07 UTC
(nuttx) 01/03: cdcacm: Add cdcacm bulkout request buffer config
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 1a69d3c6ee8d868086b04679a304ccdd50f55e35
Author: dongjiuzhu1 <do...@xiaomi.com>
AuthorDate: Wed Aug 2 12:19:59 2023 +0800
cdcacm: Add cdcacm bulkout request buffer config
Signed-off-by: dongjiuzhu1 <do...@xiaomi.com>
---
drivers/usbdev/Kconfig | 8 ++++++++
drivers/usbdev/cdcacm.c | 7 ++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/usbdev/Kconfig b/drivers/usbdev/Kconfig
index 49dd30472a..39ebe33ed8 100644
--- a/drivers/usbdev/Kconfig
+++ b/drivers/usbdev/Kconfig
@@ -649,6 +649,14 @@ config CDCACM_NWRREQS
---help---
The number of write/read requests that can be in flight
+config CDCACM_BULKOUT_REQLEN
+ int "Size of one read request buffer"
+ default 512 if USBDEV_DUALSPEED
+ default 256 if !USBDEV_DUALSPEED
+ ---help---
+ Read buffer size maybe larger than the maxpacket size. Increasing
+ the buffer size can effectively improve the transmission speed.
+
config CDCACM_BULKIN_REQLEN
int "Size of one write request buffer"
default 768 if USBDEV_DUALSPEED
diff --git a/drivers/usbdev/cdcacm.c b/drivers/usbdev/cdcacm.c
index ca7e6ea032..d0b8365d2a 100644
--- a/drivers/usbdev/cdcacm.c
+++ b/drivers/usbdev/cdcacm.c
@@ -626,7 +626,7 @@ static int cdcacm_requeue_rdrequest(FAR struct cdcacm_dev_s *priv,
/* Requeue the read request */
ep = priv->epbulkout;
- req->len = ep->maxpacket;
+ req->len = MAX(CONFIG_CDCACM_BULKOUT_REQLEN, ep->maxpacket);
ret = EP_SUBMIT(ep, req);
if (ret != OK)
{
@@ -1334,6 +1334,11 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver,
reqlen = CONFIG_CDCACM_EPBULKOUT_FSSIZE;
}
+ if (CONFIG_CDCACM_BULKOUT_REQLEN > reqlen)
+ {
+ reqlen = CONFIG_CDCACM_BULKOUT_REQLEN;
+ }
+
for (i = 0; i < CONFIG_CDCACM_NRDREQS; i++)
{
rdcontainer = &priv->rdreqs[i];