casaroli opened a new pull request, #20591:
URL: https://github.com/apache/nuttx/pull/20591

   ## Summary
   
   `pl011_txint()` enabled the TX interrupt and then called `uart_xmitchars()` 
with interrupts enabled. `uart_write()` calls it from a task, so the TX 
interrupt could run `uart_xmitchars()` in the middle of that call. Both moved 
`xmit.tail`, the tail passed the head, and the driver sent the whole TX buffer 
again. On the console, a program that echoes each key itself printed the last 
256 bytes of output again with each key.
   
   This PR calls `uart_xmitchars()` in a critical section, as `uart_16550.c` 
does. The spinlock still covers only the register access. The first commit 
fixes the two old nxstyle errors in the file (blank lines after declarations), 
with no code change.
   
   ## Impact
   
   PL011 boards (qemu-armv8a and others): TX output is no longer sent twice. No 
change to the API or to the configuration.
   
   ## Testing
   
   The run-time tests ran on a local branch that has this change and other 
pending changes on top of master; the builds are of this branch alone.
   
   qemu-armv8a, kernel build, QEMU 11 with HVF on Apple M4, an interactive 
shell that echoes each key itself, keys typed one at a time.
   
   Before, after each key the console received about 258 bytes: the 256-byte TX 
buffer again, from the boot banner on, then the new key.
   
   After, each key is echoed once, and a backspace sends `\b \b`. Nothing is 
sent twice.
   
   Builds with `-Wno-cpp -Werror`: `qemu-armv8a:nsh`, `qemu-armv8a:knsh`, 
`qemu-armv8a:netnsh`. `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
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]

Reply via email to