yangsong8-a1 opened a new pull request, #21113:
URL: https://github.com/apache/nuttx/pull/21113
## Summary
This PR generalizes the bulk copy to the OPOST case. It replaces
uart_putxmitbuf
with uart_putxmitbuffer(), which copies a whole buffer into the TX ring in
bulk
with memcpy over the contiguous free region, preserving the existing
xmit.lock
and ring-buffer invariants. uart_putxmitchar() becomes a thin forwarder to
it.
uart_write()/uart_writev() and uart_irqwrite() are rewritten to use memchr()
to
locate the next character that needs output post-processing (CR under OCRNL,
NL
under ONLCR/ONLRET), bulk-copy the run of ordinary bytes before it, then
handle
that single character. When no output translation is enabled (raw mode) the
whole payload is copied in one bulk operation.
## Impact
- Feature: no new user-facing feature; this is a write()/console-output
throughput optimization for all UART-based serial ports.
- Users: large writes to serial devices (e.g. CDC/ACM block transfers, and
now also tty/console ports with OPOST/ONLCR enabled) are copied into the TX
ring in bulk instead of byte-by-byte.
## Testing
sim:nsh / qemu-armv7a:nsh
Ran uname -a, help, ls -lR /, free, cat /proc/version, uptime, poweroff.
Boots, all commands run, clean exit (no hang). Output intact, all lines
CRLF-terminated (ONLCR via the new memchr path correct).
sim:usbdev
nsh > conn 1 # bring up CDC/ACM
nsh > dd if=/dev/zero of=/dev/ttyACM0 bs=4095 count=256
host> sudo dd if=/dev/ttyACMx of=/dev/null bs=4095 count=256
iflag=fullblock
Integrity PASS
performance (real product HW, CDC/ACM):
dd if=/dev/zero of=/dev/ttyACM0 bs=4095 count=256
4266 KB/s -> 20334 KB/s. Also verified functionally correct on the product.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]