6#ifndef __UART_ASYNC_ADAPTER_H
7#define __UART_ASYNC_ADAPTER_H
12#include <zephyr/device.h>
13#include <zephyr/drivers/uart.h>
14#include <zephyr/kernel.h>
97#define UART_ASYNC_ADAPTER_INST_DATA_NAME(_dev_name) _CONCAT(uart_async_adapter_data_, _dev_name)
99#define UART_ASYNC_ADAPTER_INST_STATE_NAME(_dev_name) _CONCAT(uart_async_adapter_state_, _dev_name)
101#define UART_ASYNC_ADAPTER_INST_NAME(_dev_name) _CONCAT(_dev_name, _inst)
108#define UART_ASYNC_ADAPTER_INST_DEFINE(_dev) \
109 static struct uart_async_adapter_data UART_ASYNC_ADAPTER_INST_DATA_NAME(_dev); \
110 static struct device_state UART_ASYNC_ADAPTER_INST_STATE_NAME(_dev); \
111 static const struct device UART_ASYNC_ADAPTER_INST_NAME(_dev) = { \
112 .name = STRINGIFY(_dev), \
113 .api = &uart_async_adapter_driver_api, \
114 .state = &UART_ASYNC_ADAPTER_INST_STATE_NAME(_dev), \
115 .data = &UART_ASYNC_ADAPTER_INST_DATA_NAME(_dev), \
117 static const struct device *const _dev = &UART_ASYNC_ADAPTER_INST_NAME(_dev)
void uart_async_adapter_init(const struct device *dev, const struct device *target)
Initialize adapter.
const struct uart_driver_api uart_async_adapter_driver_api
Driver API for async adapter.
volatile size_t size_left
Definition uart_async_adapter.h:55
const uint8_t * buf
Definition uart_async_adapter.h:51
bool enabled
Definition uart_async_adapter.h:59
const uint8_t * curr_buf
Definition uart_async_adapter.h:53
struct k_timer timeout_timer
Definition uart_async_adapter.h:57
Definition uart_async_adapter.h:49
struct k_timer timeout_timer
Definition uart_async_adapter.h:79
uint8_t * next_buf
Definition uart_async_adapter.h:73
int32_t timeout
Definition uart_async_adapter.h:77
uint8_t * curr_buf
Definition uart_async_adapter.h:67
bool enabled
Definition uart_async_adapter.h:81
uint8_t * buf
Definition uart_async_adapter.h:65
size_t size_left
Definition uart_async_adapter.h:71
size_t next_buf_len
Definition uart_async_adapter.h:75
uint8_t * last_notify_buf
Definition uart_async_adapter.h:69
Definition uart_async_adapter.h:63
const struct device * target
Definition uart_async_adapter.h:38
struct uart_async_adapter_data::uart_async_adapter_data_tx rx
struct k_spinlock lock
Definition uart_async_adapter.h:46
uart_callback_t user_callback
Definition uart_async_adapter.h:40
void * user_data
Definition uart_async_adapter.h:42
struct uart_async_adapter_data::uart_async_adapter_data_rx tx
UART asynch adapter data structure.
Definition uart_async_adapter.h:36