| 
    Zephyr Project API
    3.3.0
    
   A Scalable Open Source RTOS 
   | 
 
UART Interface. More...
Modules | |
| Async UART API | |
| Interrupt-driven UART API | |
| Polling UART API | |
Data Structures | |
| struct | uart_config | 
| UART controller configuration structure.  More... | |
Functions | |
| int | uart_err_check (const struct device *dev) | 
| Check whether an error was detected.  More... | |
| int | uart_configure (const struct device *dev, const struct uart_config *cfg) | 
| Set UART configuration.  More... | |
| int | uart_config_get (const struct device *dev, struct uart_config *cfg) | 
| Get UART configuration.  More... | |
| int | uart_line_ctrl_set (const struct device *dev, uint32_t ctrl, uint32_t val) | 
| Manipulate line control for UART.  More... | |
| int | uart_line_ctrl_get (const struct device *dev, uint32_t ctrl, uint32_t *val) | 
| Retrieve line control for UART.  More... | |
| int | uart_drv_cmd (const struct device *dev, uint32_t cmd, uint32_t p) | 
| Send extra command to driver.  More... | |
UART Interface.
#include <include/zephyr/drivers/uart.h>
Number of data bits.
| Enumerator | |
|---|---|
| UART_CFG_DATA_BITS_5 | |
| UART_CFG_DATA_BITS_6 | |
| UART_CFG_DATA_BITS_7 | |
| UART_CFG_DATA_BITS_8 | |
| UART_CFG_DATA_BITS_9 | |
#include <include/zephyr/drivers/uart.h>
Hardware flow control options.
With flow control set to none, any operations related to flow control signals can be managed by user with uart_line_ctrl functions. In other cases, flow control is managed by hardware/driver.
| Enumerator | |
|---|---|
| UART_CFG_FLOW_CTRL_NONE | |
| UART_CFG_FLOW_CTRL_RTS_CTS | |
| UART_CFG_FLOW_CTRL_DTR_DSR | |
| UART_CFG_FLOW_CTRL_RS485 | |
| enum uart_config_parity | 
#include <include/zephyr/drivers/uart.h>
Parity modes.
| Enumerator | |
|---|---|
| UART_CFG_PARITY_NONE | |
| UART_CFG_PARITY_ODD | |
| UART_CFG_PARITY_EVEN | |
| UART_CFG_PARITY_MARK | |
| UART_CFG_PARITY_SPACE | |
#include <include/zephyr/drivers/uart.h>
Number of stop bits.
| Enumerator | |
|---|---|
| UART_CFG_STOP_BITS_0_5 | |
| UART_CFG_STOP_BITS_1 | |
| UART_CFG_STOP_BITS_1_5 | |
| UART_CFG_STOP_BITS_2 | |
| enum uart_line_ctrl | 
#include <include/zephyr/drivers/uart.h>
Line control signals.
| Enumerator | |
|---|---|
| UART_LINE_CTRL_BAUD_RATE | |
| UART_LINE_CTRL_RTS | |
| UART_LINE_CTRL_DTR | |
| UART_LINE_CTRL_DCD | |
| UART_LINE_CTRL_DSR | |
| enum uart_rx_stop_reason | 
#include <include/zephyr/drivers/uart.h>
Reception stop reasons.
Values that correspond to events or errors responsible for stopping receiving.
| int uart_config_get | ( | const struct device * | dev, | 
| struct uart_config * | cfg | ||
| ) | 
#include <include/zephyr/drivers/uart.h>
Get UART configuration.
Stores current UART configuration to *cfg, can be used to retrieve initial configuration after device was initialized using data from DTS.
| dev | UART device instance. | 
| cfg | UART configuration structure. | 
| 0 | If successful. | 
| -errno | Negative errno code in case of failure. | 
| -ENOSYS | If driver does not support getting current configuration. | 
| int uart_configure | ( | const struct device * | dev, | 
| const struct uart_config * | cfg | ||
| ) | 
#include <include/zephyr/drivers/uart.h>
Set UART configuration.
Sets UART configuration using data from *cfg.
| dev | UART device instance. | 
| cfg | UART configuration structure. | 
| 0 | If successful. | 
| -errno | Negative errno code in case of failure. | 
| -ENOSYS | If configuration is not supported by device or driver does not support setting configuration in runtime. | 
#include <include/zephyr/drivers/uart.h>
Send extra command to driver.
Implementation and accepted commands are driver specific. Refer to the drivers for more information.
| dev | UART device instance. | 
| cmd | Command to driver. | 
| p | Parameter to the command. | 
| 0 | If successful. | 
| -ENOSYS | If this function is not implemented. | 
| -ENOTSUP | If API is not enabled. | 
| -errno | Other negative errno value in case of failure. | 
| int uart_err_check | ( | const struct device * | dev | ) | 
#include <include/zephyr/drivers/uart.h>
Check whether an error was detected.
| dev | UART device instance. | 
| 0 | If no error was detected. | 
| err | Error flags as defined in uart_rx_stop_reason | 
| -ENOSYS | If not implemented. | 
#include <include/zephyr/drivers/uart.h>
Retrieve line control for UART.
| dev | UART device instance. | 
| ctrl | The line control to retrieve (see enum uart_line_ctrl). | 
| val | Pointer to variable where to store the line control value. | 
| 0 | If successful. | 
| -ENOSYS | If this function is not implemented. | 
| -ENOTSUP | If API is not enabled. | 
| -errno | Other negative errno value in case of failure. | 
#include <include/zephyr/drivers/uart.h>
Manipulate line control for UART.
| dev | UART device instance. | 
| ctrl | The line control to manipulate (see enum uart_line_ctrl). | 
| val | Value to set to the line control. | 
| 0 | If successful. | 
| -ENOSYS | If this function is not implemented. | 
| -ENOTSUP | If API is not enabled. | 
| -errno | Other negative errno value in case of failure. |