[UART] Add buffer level check for synchronous API #24496
Labels
area: UART
Universal Asynchronous Receiver-Transmitter
Enhancement
Changes/Updates/Additions to existing features
Is your feature request related to a problem? Please describe.
Most common uart APIs have the ability to either peek or check the buffer level without actually reading the first element.
The current Zephyr UART driver does not offer this ability.
The only ways to tell if there is data in the buffer is the ISR callback event
or
uart_irq_rx_ready which is only allowed inside the ISR.
Describe the solution you'd like
A method of checking the amount of frames available outside the ISR. Either new syscall or make uart_irq_rx_ready safe outside the ISR.
Describe alternatives you've considered
I can write my own buffer backed by the ISR, but it seems impractical for my use case and seems like this is a common feature that should be available.
Additional context
I can submit the PR, I just wanted to get feedback before doing the work to see why this was not part of the original API.
The text was updated successfully, but these errors were encountered: