Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
|
UART Mux Interface. More...
Data Structures | |
struct | uart_mux_driver_api |
UART mux driver API structure. More... | |
Typedefs | |
typedef 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. | |
typedef 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. | |
Functions | |
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. | |
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. | |
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. | |
void | uart_mux_disable (const struct device *dev) |
Disable the mux. | |
void | uart_mux_enable (const struct device *dev) |
Enable the mux. | |
UART Mux Interface.
uart_mux_attach_cb_t |
#include <zephyr/drivers/console/uart_mux.h>
Define the user callback function which is called when the UART mux is attached properly.
mux | UART mux device |
dlci_address | DLCI id for the virtual muxing channel |
connected | True if DLCI is connected, false otherwise. |
user_data | Arbitrary user data. |
uart_mux_cb_t |
#include <zephyr/drivers/console/uart_mux.h>
Callback used while iterating over UART muxes.
uart | Pointer to UART device where the mux is running |
dev | Pointer to UART mux device |
dlci_address | DLCI channel id this UART is muxed |
user_data | A valid pointer to user data or NULL |
const struct device * uart_mux_alloc | ( | void | ) |
#include <zephyr/drivers/console/uart_mux.h>
Allocate muxing UART device.
This will return next available uart mux driver that will mux the data when read or written. This device corresponds to one DLCI channel. User must first call this to allocate the DLCI and then call the attach function to fully enable the muxing.
device | New UART device that will automatically mux data sent to it. |
NULL | if error |
|
inlinestatic |
#include <zephyr/drivers/console/uart_mux.h>
Attach physical/real UART to UART muxing device.
mux | UART mux device structure. |
uart | Real UART device structure. |
dlci_address | DLCI id for the virtual muxing channel |
cb | Callback is called when the DLCI is ready and connected |
user_data | Caller supplied optional data |
0 | No errors, the attachment was successful |
<0 | Error |
void uart_mux_disable | ( | const struct device * | dev | ) |
#include <zephyr/drivers/console/uart_mux.h>
Disable the mux.
Disable does not re-instate whatever ISRs and configs were present before the mux was enabled. This must be done by the user.
dev | UART mux device pointer |
void uart_mux_enable | ( | const struct device * | dev | ) |
#include <zephyr/drivers/console/uart_mux.h>
Enable the mux.
Enables the correct ISRs for the UART mux.
dev | UART mux device pointer |
const struct device * uart_mux_find | ( | int | dlci_address | ) |
#include <zephyr/drivers/console/uart_mux.h>
Get UART related to a specific DLCI channel.
dlci_address | DLCI address, value >0 and <63 |
void uart_mux_foreach | ( | uart_mux_cb_t | cb, |
void * | user_data | ||
) |
#include <zephyr/drivers/console/uart_mux.h>
Go through all the UART muxes and call callback for each of them.
cb | User-supplied callback function to call |
user_data | User specified data |