Skip to content

Commit 29c7faf

Browse files
committed
docs: Document bulk USB-CDC optimization and behavioral change.
Update stdin_serial_analysis.md with: - References to both optimization commits - Documentation of behavioral change in interrupt handling - Note that new implementation correctly stops processing after interrupt, matching documented intent (original had '// and stop' comment but continued processing into cleared ringbuf) Signed-off-by: Andrew Leech <[email protected]>
1 parent 9b2eed6 commit 29c7faf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

docs/stdin_serial_analysis.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,16 +726,20 @@ Results gathered: 2025-11-28
726726

727727
On 2025-11-29, implemented bulk operations in `tud_cdc_rx_cb()` (shared/tinyusb/mp_usbd_cdc.c:73-129).
728728

729-
**Commit:** f8c8369c1b8dbc02c4970f16484a37f091504cae
729+
**Commits:**
730+
- 7735584e7e - Initial bulk operations implementation
731+
- 9b2eed6174 - Fix for mp_interrupt_char == -1 handling
730732

731733
**Changes:**
732734
- Added `#include <string.h>` for `memchr()`
733735
- Replaced byte-by-byte loop with bulk operations using:
734736
- `tud_cdc_n_read()` - reads up to 64 bytes per call (matching USB packet size)
735-
- `memchr()` - scans for interrupt character
737+
- `memchr()` - scans for interrupt character (with check for disabled state)
736738
- `ringbuf_put_bytes()` - bulk write to stdin_ringbuf
737739
- Uses 64-byte temporary buffer for efficient USB packet processing
738-
- Maintains exact interrupt character behavior (clears ringbuf, discards remaining data)
740+
- Maintains interrupt character behavior (clears ringbuf, schedules interrupt)
741+
742+
**Behavioral change:** The original code had a comment "// and stop" after scheduling the interrupt, but didn't actually stop - it continued processing remaining bytes into the (now cleared) ringbuf. The new implementation correctly stops processing when interrupt character is detected, discarding remaining buffered bytes. This matches the documented intent and expected behavior when user presses Ctrl-C.
739743

740744
**Test Device:**
741745
- Raspberry Pi Pico (RP2040)

0 commit comments

Comments
 (0)