7#ifndef ZEPHYR_DRIVERS_SERIAL_UART_ASYNC_TO_IRQ_H_
8#define ZEPHYR_DRIVERS_SERIAL_UART_ASYNC_TO_IRQ_H_
32struct uart_async_to_irq_data;
38struct uart_async_to_irq_config;
61#define UART_ASYNC_TO_IRQ_API_INIT() \
62 .fifo_fill = z_uart_async_to_irq_fifo_fill, \
63 .fifo_read = z_uart_async_to_irq_fifo_read, \
64 .irq_tx_enable = z_uart_async_to_irq_irq_tx_enable, \
65 .irq_tx_disable = z_uart_async_to_irq_irq_tx_disable, \
66 .irq_tx_ready = z_uart_async_to_irq_irq_tx_ready, \
67 .irq_rx_enable = z_uart_async_to_irq_irq_rx_enable, \
68 .irq_rx_disable = z_uart_async_to_irq_irq_rx_disable, \
69 .irq_tx_complete = z_uart_async_to_irq_irq_tx_complete,\
70 .irq_rx_ready = z_uart_async_to_irq_irq_rx_ready, \
71 .irq_err_enable = z_uart_async_to_irq_irq_err_enable, \
72 .irq_err_disable = z_uart_async_to_irq_irq_err_disable,\
73 .irq_is_pending = z_uart_async_to_irq_irq_is_pending, \
74 .irq_update = z_uart_async_to_irq_irq_update, \
75 .irq_callback_set = z_uart_async_to_irq_irq_callback_set
89#define UART_ASYNC_TO_IRQ_API_CONFIG_INITIALIZER(_api, _trampoline, _baudrate, _tx_buf, \
90 _tx_len, _rx_buf, _rx_len, _rx_cnt, _log) \
100 .trampoline = _trampoline, \
101 .baudrate = _baudrate, \
102 LOG_OBJECT_PTR_INIT(log, \
103 COND_CODE_1(IS_EMPTY(_log), \
104 (LOG_OBJECT_PTR(UART_ASYNC_TO_IRQ_LOG_NAME)), \
118 const struct uart_async_to_irq_config *
config);
145struct uart_async_to_irq_config {
156 const struct uart_async_to_irq_async_api *api;
169struct uart_async_to_irq_async_api {
170 int (*callback_set)(
const struct device *dev,
174 int (*tx)(
const struct device *dev,
const uint8_t *buf,
size_t len,
176 int (*tx_abort)(
const struct device *dev);
178 int (*rx_enable)(
const struct device *dev,
uint8_t *buf,
size_t len,
180 int (*rx_buf_rsp)(
const struct device *dev,
uint8_t *buf,
size_t len);
181 int (*rx_disable)(
const struct device *dev);
185struct uart_async_to_irq_rx_data {
197struct uart_async_to_irq_tx_data {
206struct uart_async_to_irq_data {
217 struct uart_async_to_irq_rx_data rx;
220 struct uart_async_to_irq_tx_data tx;
230int z_uart_async_to_irq_fifo_fill(
const struct device *dev,
235int z_uart_async_to_irq_fifo_read(
const struct device *dev,
240void z_uart_async_to_irq_irq_tx_enable(
const struct device *dev);
243void z_uart_async_to_irq_irq_tx_disable(
const struct device *dev);
246int z_uart_async_to_irq_irq_tx_ready(
const struct device *dev);
249void z_uart_async_to_irq_irq_rx_enable(
const struct device *dev);
252void z_uart_async_to_irq_irq_rx_disable(
const struct device *dev);
255int z_uart_async_to_irq_irq_tx_complete(
const struct device *dev);
258int z_uart_async_to_irq_irq_rx_ready(
const struct device *dev);
261void z_uart_async_to_irq_irq_err_enable(
const struct device *dev);
264void z_uart_async_to_irq_irq_err_disable(
const struct device *dev);
267int z_uart_async_to_irq_irq_is_pending(
const struct device *dev);
270int z_uart_async_to_irq_irq_update(
const struct device *dev);
273void z_uart_async_to_irq_irq_callback_set(
const struct device *dev,
long atomic_t
Definition: atomic_types.h:15
Public APIs for UART drivers.
void(* uart_callback_t)(const struct device *dev, struct uart_event *evt, void *user_data)
Define the application callback function signature for uart_callback_set() function.
Definition: uart.h:324
void(* uart_irq_callback_user_data_t)(const struct device *dev, void *user_data)
Define the application callback function signature for uart_irq_callback_user_data_set() function.
Definition: uart.h:141
#define LOG_INSTANCE_PTR_DECLARE(_name)
Declare a logger instance pointer in the module structure.
Definition: log_instance.h:147
flags
Definition: parser.h:96
Public interface for spinlocks.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition: device.h:399
void * data
Address of the device instance private data.
Definition: device.h:409
const void * config
Address of device instance config information.
Definition: device.h:403
Kernel Spin Lock.
Definition: spinlock.h:45
UART asynchronous RX helper configuration structure.
Definition: uart_async_rx.h:62
UART asynchronous RX helper structure.
Definition: uart_async_rx.h:36
Helper module for receiving using UART Asynchronous API.
int uart_async_to_irq_rx_enable(const struct device *dev)
int uart_async_to_irq_rx_disable(const struct device *dev)
void(* uart_async_to_irq_trampoline)(const struct device *dev)
Definition: uart_async_to_irq.h:48
int uart_async_to_irq_init(struct uart_async_to_irq_data *data, const struct uart_async_to_irq_config *config)
Initialize the adaptation layer.
void uart_async_to_irq_trampoline_cb(const struct device *dev)
Callback to be called from trampoline context.