Skip to content

Provide more generic UART APIs for read and write #1682

@zephyrbot

Description

@zephyrbot

Reported by Daniel Leung:

According to the mailing list, there is a request for APIs to read/write from UART FIFO. This will provide a simpler way to deal with UART interrupts. Currently, all drivers using UART have to write their own interrupt routine.

The following is extracted from the mailing list:

Actually, the UART API is very low level when we compare it with other
APIs such as SPI and I2C. For instance, the UART API exposes functions
to manipulate the FIFOs and check for interrupt flags. Is there any plan
to add higher level APIs such as "transmit the characters from this buffer
and call this callback once the transmission finishes" or "read 10
characters into this buffer and call this callback once it is done"?

This is something I have thought about, but there is no concrete plan.

Is there anything particular you are looking for? Use cases would be
a good start. This helps me to understand what needs to be done.

No, I don't have anything in particular. Probably the bluetooth drivers
and the console_uart driver are a good source of use cases. For instance,
they all have their own implementation of a mechanism read data
asynchronously. An API such as uart_read(dev, callback, buf, len) might
be useful.

(Imported from Jira ZEP-89)

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions