|
static int | uart_fifo_fill (const struct device *dev, const uint8_t *tx_data, int size) |
| Fill FIFO with data. More...
|
|
static int | uart_fifo_fill_u16 (const struct device *dev, const uint16_t *tx_data, int size) |
| Fill FIFO with wide data. More...
|
|
static int | uart_fifo_read (const struct device *dev, uint8_t *rx_data, const int size) |
| Read data from FIFO. More...
|
|
static int | uart_fifo_read_u16 (const struct device *dev, uint16_t *rx_data, const int size) |
| Read wide data from FIFO. More...
|
|
void | uart_irq_tx_enable (const struct device *dev) |
| Enable TX interrupt in IER. More...
|
|
void | uart_irq_tx_disable (const struct device *dev) |
| Disable TX interrupt in IER. More...
|
|
static int | uart_irq_tx_ready (const struct device *dev) |
| Check if UART TX buffer can accept a new char. More...
|
|
void | uart_irq_rx_enable (const struct device *dev) |
| Enable RX interrupt. More...
|
|
void | uart_irq_rx_disable (const struct device *dev) |
| Disable RX interrupt. More...
|
|
static int | uart_irq_tx_complete (const struct device *dev) |
| Check if UART TX block finished transmission. More...
|
|
static int | uart_irq_rx_ready (const struct device *dev) |
| Check if UART RX buffer has a received char. More...
|
|
void | uart_irq_err_enable (const struct device *dev) |
| Enable error interrupt. More...
|
|
void | uart_irq_err_disable (const struct device *dev) |
| Disable error interrupt. More...
|
|
int | uart_irq_is_pending (const struct device *dev) |
| Check if any IRQs is pending. More...
|
|
int | uart_irq_update (const struct device *dev) |
| Start processing interrupts in ISR. More...
|
|
static void | uart_irq_callback_user_data_set (const struct device *dev, uart_irq_callback_user_data_t cb, void *user_data) |
| Set the IRQ callback function pointer. More...
|
|
static void | uart_irq_callback_set (const struct device *dev, uart_irq_callback_user_data_t cb) |
| Set the IRQ callback function pointer (legacy). More...
|
|
static int uart_fifo_fill_u16 |
( |
const struct device * |
dev, |
|
|
const uint16_t * |
tx_data, |
|
|
int |
size |
|
) |
| |
|
inlinestatic |
#include <include/zephyr/drivers/uart.h>
Fill FIFO with wide data.
This function is expected to be called from UART interrupt handler (ISR), if uart_irq_tx_ready() returns true. Result of calling this function not from an ISR is undefined (hardware-dependent). Likewise, not calling this function from an ISR if uart_irq_tx_ready() returns true may lead to undefined behavior, e.g. infinite interrupt loops. It's mandatory to test return value of this function, as different hardware has different FIFO depth (oftentimes just 1).
- Parameters
-
dev | UART device instance. |
tx_data | Wide data to transmit. |
size | Number of datum to send. |
- Returns
- Number of datum sent.
- Return values
-
-ENOSYS | If this function is not implemented |
-ENOTSUP | If API is not enabled. |
static int uart_fifo_read_u16 |
( |
const struct device * |
dev, |
|
|
uint16_t * |
rx_data, |
|
|
const int |
size |
|
) |
| |
|
inlinestatic |
#include <include/zephyr/drivers/uart.h>
Read wide data from FIFO.
This function is expected to be called from UART interrupt handler (ISR), if uart_irq_rx_ready() returns true. Result of calling this function not from an ISR is undefined (hardware-dependent). It's unspecified whether "RX ready" condition as returned by uart_irq_rx_ready() is level- or edge- triggered. That means that once uart_irq_rx_ready() is detected, uart_fifo_read() must be called until it reads all available data in the FIFO (i.e. until it returns less data than was requested).
Note that the calling context only applies to physical UARTs and no to the virtual ones found in USB CDC ACM code.
- Parameters
-
dev | UART device instance. |
rx_data | Wide data container. |
size | Container size. |
- Returns
- Number of datum read.
- Return values
-
-ENOSYS | If this function is not implemented. |
-ENOTSUP | If API is not enabled. |
static int uart_irq_rx_ready |
( |
const struct device * |
dev | ) |
|
|
inlinestatic |
#include <include/zephyr/drivers/uart.h>
Check if UART RX buffer has a received char.
Check if UART RX buffer has at least one pending character (i.e. uart_fifo_read() will succeed and return non-zero). This function must be called in a UART interrupt handler, or its result is undefined. Before calling this function in the interrupt handler, uart_irq_update() must be called once per the handler invocation. It's unspecified whether condition as returned by this function is level- or edge- triggered (i.e. if this function returns true when RX FIFO is non-empty, or when a new char was received since last call to it). See description of uart_fifo_read() for implication of this.
- Parameters
-
- Return values
-
1 | If a received char is ready. |
0 | If a received char is not ready. |
-ENOSYS | If this function is not implemented. |
-ENOTSUP | If API is not enabled. |
static int uart_irq_tx_complete |
( |
const struct device * |
dev | ) |
|
|
inlinestatic |
#include <include/zephyr/drivers/uart.h>
Check if UART TX block finished transmission.
Check if any outgoing data buffered in UART TX block was fully transmitted and TX block is idle. When this condition is true, UART device (or whole system) can be power off. Note that this function is not useful to check if UART TX can accept more data, use uart_irq_tx_ready() for that. This function must be called in a UART interrupt handler, or its result is undefined. Before calling this function in the interrupt handler, uart_irq_update() must be called once per the handler invocation.
- Parameters
-
- Return values
-
1 | If nothing remains to be transmitted. |
0 | If transmission is not completed. |
-ENOSYS | If this function is not implemented. |
-ENOTSUP | If API is not enabled. |