Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
uart_mux.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_DRIVERS_UART_MUX_H_
13#define ZEPHYR_INCLUDE_DRIVERS_UART_MUX_H_
14
22#include <device.h>
23#include <drivers/uart.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29struct gsm_dlci;
30
42typedef void (*uart_mux_attach_cb_t)(const struct device *mux,
43 int dlci_address,
44 bool connected, void *user_data);
45
47__subsystem struct uart_mux_driver_api {
54
59 int (*attach)(const struct device *mux, const struct device *uart,
60 int dlci_address, uart_mux_attach_cb_t cb,
61 void *user_data);
62};
63
76static inline int uart_mux_attach(const struct device *mux,
77 const struct device *uart,
78 int dlci_address, uart_mux_attach_cb_t cb,
79 void *user_data)
80{
81 const struct uart_mux_driver_api *api =
82 (const struct uart_mux_driver_api *)mux->api;
83
84 return api->attach(mux, uart, dlci_address, cb, user_data);
85}
86
94__syscall const struct device *uart_mux_find(int dlci_address);
95
107const struct device *uart_mux_alloc(void);
108
118typedef void (*uart_mux_cb_t)(const struct device *uart,
119 const struct device *dev,
120 int dlci_address, void *user_data);
121
130
139void uart_mux_disable(const struct device *dev);
140
148void uart_mux_enable(const struct device *dev);
149
150#ifdef __cplusplus
151}
152#endif
153
154#include <syscalls/uart_mux.h>
155
160#endif /* ZEPHYR_INCLUDE_DRIVERS_UART_MUX_H_ */
void
Definition: eswifi_shell.c:15
void uart_mux_disable(const struct device *dev)
Disable the mux.
const struct device * uart_mux_find(int dlci_address)
Get UART related to a specific DLCI channel.
const struct device * uart_mux_alloc(void)
Allocate muxing UART device.
static int uart_mux_attach(const struct device *mux, const struct device *uart, int dlci_address, uart_mux_attach_cb_t cb, void *user_data)
Attach physical/real UART to UART muxing device.
Definition: uart_mux.h:76
void(* uart_mux_attach_cb_t)(const struct device *mux, int dlci_address, bool connected, void *user_data)
Define the user callback function which is called when the UART mux is attached properly.
Definition: uart_mux.h:42
void uart_mux_enable(const struct device *dev)
Enable the mux.
void(* uart_mux_cb_t)(const struct device *uart, const struct device *dev, int dlci_address, void *user_data)
Callback used while iterating over UART muxes.
Definition: uart_mux.h:118
void uart_mux_foreach(uart_mux_cb_t cb, void *user_data)
Go through all the UART muxes and call callback for each of them.
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
const void * api
Definition: device.h:373
Driver API structure.
Definition: uart.h:352
UART mux driver API structure.
Definition: uart_mux.h:47
int(* attach)(const struct device *mux, const struct device *uart, int dlci_address, uart_mux_attach_cb_t cb, void *user_data)
Definition: uart_mux.h:59
struct uart_driver_api uart_api
Definition: uart_mux.h:53
static const intptr_t user_data[5]
Definition: main.c:590
Public APIs for UART drivers.