Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
uart_emul.h
Go to the documentation of this file.
1/*
2 * Copyright 2024 Basalte bv
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DRIVERS_UART_EMUL_H_
8#define ZEPHYR_INCLUDE_DRIVERS_UART_EMUL_H_
9
10#include <zephyr/device.h>
11#include <zephyr/drivers/emul.h>
12#include <zephyr/drivers/uart.h>
13#include <zephyr/sys/slist.h>
14#include <zephyr/types.h>
15
22
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
36
44typedef void (*uart_emul_device_tx_data_ready_t)(const struct device *dev, size_t size,
45 const struct emul *target);
46
48struct uart_emul {
52 const struct emul *target;
55};
56
62
70int uart_emul_register(const struct device *dev, struct uart_emul *emul);
71
72#ifdef __cplusplus
73}
74#endif
75
79
80#endif /* ZEPHYR_INCLUDE_DRIVERS_UART_EMUL_H_ */
APIs and macros for the Zephyr device model.
Public APIs for the device emulation framework.
Main header file for UART driver API.
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:44
int uart_emul_register(const struct device *dev, struct uart_emul *emul)
Register an emulated device on the controller.
void(* uart_emul_device_tx_data_ready_t)(const struct device *dev, size_t size, const struct emul *target)
Define the emulation callback function signature.
Definition uart_emul.h:44
Header file for the single-linked list API.
Runtime device structure (in ROM) per driver instance.
Definition device.h:543
An emulator instance - represents the target emulated device/peripheral that is interacted with throu...
Definition emul.h:88
Definition of the emulator API.
Definition uart_emul.h:58
uart_emul_device_tx_data_ready_t tx_data_ready
Called when there is new data in the TX buffer.
Definition uart_emul.h:60
Node in a linked list of emulators for UART devices.
Definition uart_emul.h:48
sys_snode_t node
Node in the controller's linked list of emulators.
Definition uart_emul.h:50
const struct uart_emul_device_api * api
API provided for this device.
Definition uart_emul.h:54
const struct emul * target
Target emulator - REQUIRED for all emulated bus nodes of any type.
Definition uart_emul.h:52