Skip to content

serial: uart_irq_tx_ready() needs better documentation or correction of the test #11535

@anangl

Description

@anangl

During a PR review, some confusion about the expected behavior of the uart_irq_tx_ready function popped out, see this comment and replies to it.

Apparently, some existing Zephyr code expects this function to return true only when the TX interrupt is enabled (see for instance drivers/bluetooth/hci/h4.c or subsys/shell/shell_uart.c) and this function returning true is even treated as an indication that some TX action should be done, while from reading the API description one can conclude that this only indicates that TX action is possible because "UART TX buffer can accept at least one character for transmission".
Indeed, most of UART drivers implement this function in the way described above, but some exceptions seems to be also present (see uart_stm32.c). And the basic UART API test seems to also not follow this approach.

To avoid further confusion, it should be clarified what is the actually required behavior of the function.

Metadata

Metadata

Labels

EnhancementChanges/Updates/Additions to existing featuresarea: APIChanges to public APIsarea: UARTUniversal Asynchronous Receiver-Transmitterpriority: lowLow impact/importance bug

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions