Zephyr API 3.6.99
Loading...
Searching...
No Matches
uart_emul.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Fabian Blatz
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_DRIVERS_SERIAL_UART_EMUL_H_
13#define ZEPHYR_INCLUDE_DRIVERS_SERIAL_UART_EMUL_H_
14
15#include <zephyr/device.h>
16#include <zephyr/types.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
30typedef void (*uart_emul_callback_tx_data_ready_t)(const struct device *dev, size_t size,
31 void *user_data);
32
44 uart_emul_callback_tx_data_ready_t cb, void *user_data);
45
55uint32_t uart_emul_put_rx_data(const struct device *dev, const uint8_t *data, size_t size);
56
66uint32_t uart_emul_get_tx_data(const struct device *dev, uint8_t *data, size_t size);
67
76
85
92void uart_emul_set_errors(const struct device *dev, int errors);
93
100void uart_emul_set_release_buffer_on_timeout(const struct device *dev, bool release_on_timeout);
101
102#ifdef __cplusplus
103}
104#endif
105
106#endif /* ZEPHYR_INCLUDE_DRIVERS_SERIAL_UART_EMUL_H_ */
uint32_t uart_emul_flush_tx_data(const struct device *dev)
Clear TX buffer content.
void uart_emul_set_errors(const struct device *dev, int errors)
Sets one or more driver errors.
uint32_t uart_emul_flush_rx_data(const struct device *dev)
Clear RX buffer content.
uint32_t uart_emul_put_rx_data(const struct device *dev, const uint8_t *data, size_t size)
Write (copy) data to RX buffer.
void(* uart_emul_callback_tx_data_ready_t)(const struct device *dev, size_t size, void *user_data)
Define the application callback function signature for uart_emul_callback_tx_data_ready_set() functio...
Definition uart_emul.h:30
uint32_t uart_emul_get_tx_data(const struct device *dev, uint8_t *data, size_t size)
Read data from TX buffer.
void uart_emul_set_release_buffer_on_timeout(const struct device *dev, bool release_on_timeout)
Configures if rx buffer should be released on timeout, even when only partially filled.
void uart_emul_callback_tx_data_ready_set(const struct device *dev, uart_emul_callback_tx_data_ready_t cb, void *user_data)
Set the TX data ready callback.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:403
void * data
Address of the device instance private data.
Definition device.h:413