Commit 7735584
committed
shared/tinyusb: Optimize USB-CDC stdin with bulk operations.
Replace byte-by-byte processing in tud_cdc_rx_cb() with bulk operations
to improve USB-CDC stdin throughput. Uses 64-byte temporary buffer
matching USB packet size for efficient transfer from TinyUSB to stdin_ringbuf.
Changes:
- Use tud_cdc_n_read() instead of tud_cdc_read_char() for bulk USB reads
- Use memchr() for efficient interrupt character scanning
- Use ringbuf_put_bytes() instead of ringbuf_put() for bulk writes
- Maintain exact interrupt character behavior (clear ringbuf, schedule interrupt)
Implementation tested on Raspberry Pi Pico (RP2040) with USB-CDC transport.
Device-side USB packet processing now operates in bulk rather than byte-by-byte,
removing device implementation bottleneck. End-to-end stdin throughput remains
limited by raw paste mode's 128-byte flow control window.
See docs/stdin_serial_analysis.md for detailed analysis and benchmark results.
Signed-off-by: Andrew Leech <[email protected]>1 parent 0796724 commit 7735584
File tree
3 files changed
+1257
-18
lines changed- docs
3 files changed
+1257
-18
lines changed
0 commit comments