Skip to content

Commit e88357a

Browse files
committed
usb: device_next: class: cdc_acm: configurable buffer size
When a custom pool is used for CDC ACM, allow the buffer sizes to be configured in Kconfig. Signed-off-by: Jordan Yates <jordan@embeint.com>
1 parent 30e3ddf commit e88357a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

subsys/usb/device_next/class/Kconfig.cdc_acm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ config USBD_CDC_ACM_BUF_POOL
3737
ACM instances and the size of the bulk endpoints. When disabled, the
3838
implementation uses the UDC driver's pool.
3939

40+
config USBD_CDC_ACM_BUF_POOL_SIZE
41+
int "Size of the buffers in the dedicated buffer pool"
42+
depends on USBD_CDC_ACM_BUF_POOL
43+
default 512 if USBD_MAX_SPEED_HIGH
44+
default 64 if USBD_MAX_SPEED_FULL
45+
help
46+
Increasing the size of buffers past the endpoint size can reduce the
47+
number of round trips through the CDC ACM class when the TX FIFO is larger,
48+
than the endpoint size, increasing throughput.
49+
4050
module = USBD_CDC_ACM
4151
module-str = usbd cdc_acm
4252
default-count = 1

subsys/usb/device_next/class/usbd_cdc_acm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ static void cdc_acm_irq_rx_enable(const struct device *dev);
132132
#if CONFIG_USBD_CDC_ACM_BUF_POOL
133133
UDC_BUF_POOL_DEFINE(cdc_acm_ep_pool,
134134
DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) * 2,
135-
USBD_MAX_BULK_MPS, sizeof(struct udc_buf_info), NULL);
135+
CONFIG_USBD_CDC_ACM_BUF_POOL_SIZE, sizeof(struct udc_buf_info),
136+
NULL);
136137

137138
static struct net_buf *cdc_acm_buf_alloc(struct usbd_class_data *const c_data,
138139
const uint8_t ep, size_t size_hint)

0 commit comments

Comments
 (0)