mirror of
https://github.com/apache/nuttx.git
synced 2026-10-11 12:57:01 +08:00
drivers/serial/cdcacm: Reduce one copy of data between serial and cdcacm framework
Data form serial framework will be written to usb reqbuf directly, and data form cdcacm will be read form reqbuf directly. Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
This commit is contained in:
+11
-11
@@ -233,21 +233,21 @@ static int uart_putxmitchar(FAR uart_dev_t *dev, int ch, bool oktoblock)
|
||||
int nexthead;
|
||||
int ret;
|
||||
|
||||
/* Increment to see what the next head pointer will be.
|
||||
* We need to use the "next" head pointer to determine when the circular
|
||||
* buffer would overrun
|
||||
*/
|
||||
|
||||
nexthead = dev->xmit.head + 1;
|
||||
if (nexthead >= dev->xmit.size)
|
||||
{
|
||||
nexthead = 0;
|
||||
}
|
||||
|
||||
/* Loop until we are able to add the character to the TX buffer. */
|
||||
|
||||
for (; ; )
|
||||
{
|
||||
/* Increment to see what the next head pointer will be.
|
||||
* We need to use the "next" head pointer to determine when the
|
||||
* circular buffer would overrun
|
||||
*/
|
||||
|
||||
nexthead = dev->xmit.head + 1;
|
||||
if (nexthead >= dev->xmit.size)
|
||||
{
|
||||
nexthead = 0;
|
||||
}
|
||||
|
||||
/* Check if the TX buffer is full */
|
||||
|
||||
if (nexthead != dev->xmit.tail)
|
||||
|
||||
@@ -432,8 +432,6 @@ menuconfig CDCACM
|
||||
bool "USB Modem (CDC/ACM) support"
|
||||
default n
|
||||
select SERIAL_REMOVABLE
|
||||
select SERIAL_TXDMA
|
||||
select SERIAL_RXDMA
|
||||
---help---
|
||||
Enables USB Modem (CDC/ACM) support
|
||||
|
||||
@@ -682,28 +680,6 @@ config CDCACM_BULKIN_REQLEN
|
||||
than CDCACM_TXBUFSIZE-1, since a request larger than the TX
|
||||
buffer can never be sent.
|
||||
|
||||
config CDCACM_RXBUFSIZE
|
||||
int "Receive buffer size"
|
||||
default 513 if USBDEV_DUALSPEED
|
||||
default 257 if !USBDEV_DUALSPEED
|
||||
---help---
|
||||
Size of the serial receive buffers. The actual amount of data that
|
||||
can be held in the buffer is this number minus one due to the way
|
||||
that the circular buffer is managed. So an RX buffer size of 257
|
||||
will hold four full-speed, 64 byte packets; a buffer size of 513
|
||||
will hold one high-speed, 512 byte packet.
|
||||
|
||||
config CDCACM_TXBUFSIZE
|
||||
int "Transmit buffer size"
|
||||
default 769 if USBDEV_DUALSPEED
|
||||
default 193 if !USBDEV_DUALSPEED
|
||||
---help---
|
||||
Size of the serial transmit buffers. The actual amount of data that
|
||||
can be held in the buffer is this number minus one due to the way
|
||||
that the circular buffer is managed. So a TX buffer size of 769
|
||||
will hold one request of size 768; a buffer size of 193 will hold
|
||||
two requests of size 96 bytes.
|
||||
|
||||
if !CDCACM_COMPOSITE
|
||||
|
||||
# In a composite device the Vendor- and Product-ID is given by the composite
|
||||
|
||||
+83
-111
File diff suppressed because it is too large
Load Diff
@@ -87,8 +87,6 @@
|
||||
* The product ID code/string. Default 0xa4a7 and "CDC/ACM Serial"
|
||||
* 0xa4a7 was selected for compatibility with the Linux CDC ACM
|
||||
* default PID.
|
||||
* CONFIG_CDCACM_RXBUFSIZE and CONFIG_CDCACM_TXBUFSIZE
|
||||
* Size of the serial receive/transmit buffers. Default 256.
|
||||
*/
|
||||
|
||||
/* Information needed in usbdev_devinfo_s */
|
||||
@@ -206,16 +204,6 @@
|
||||
# define CONFIG_CDCACM_NRDREQS 4
|
||||
#endif
|
||||
|
||||
/* TX/RX buffer sizes */
|
||||
|
||||
#ifndef CONFIG_CDCACM_RXBUFSIZE
|
||||
# define CONFIG_CDCACM_RXBUFSIZE 256
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_CDCACM_TXBUFSIZE
|
||||
# define CONFIG_CDCACM_TXBUFSIZE 256
|
||||
#endif
|
||||
|
||||
/* Vendor and product IDs and strings. The default is the Linux Netchip
|
||||
* CDC ACM VID and PID.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user