Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
UART Mux Interface

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 deviceuart_mux_find (int dlci_address)
 Get UART related to a specific DLCI channel.
 
const struct deviceuart_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.
 

Detailed Description

UART Mux Interface.

Typedef Documentation

◆ uart_mux_attach_cb_t

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.

Parameters
muxUART mux device
dlci_addressDLCI id for the virtual muxing channel
connectedTrue if DLCI is connected, false otherwise.
user_dataArbitrary user data.

◆ uart_mux_cb_t

uart_mux_cb_t

#include <zephyr/drivers/console/uart_mux.h>

Callback used while iterating over UART muxes.

Parameters
uartPointer to UART device where the mux is running
devPointer to UART mux device
dlci_addressDLCI channel id this UART is muxed
user_dataA valid pointer to user data or NULL

Function Documentation

◆ uart_mux_alloc()

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.

Return values
deviceNew UART device that will automatically mux data sent to it.
NULLif error

◆ uart_mux_attach()

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 
)
inlinestatic

#include <zephyr/drivers/console/uart_mux.h>

Attach physical/real UART to UART muxing device.

Parameters
muxUART mux device structure.
uartReal UART device structure.
dlci_addressDLCI id for the virtual muxing channel
cbCallback is called when the DLCI is ready and connected
user_dataCaller supplied optional data
Return values
0No errors, the attachment was successful
<0Error

◆ uart_mux_disable()

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.

Parameters
devUART mux device pointer

◆ uart_mux_enable()

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.

Parameters
devUART mux device pointer

◆ uart_mux_find()

const struct device * uart_mux_find ( int  dlci_address)

#include <zephyr/drivers/console/uart_mux.h>

Get UART related to a specific DLCI channel.

Parameters
dlci_addressDLCI address, value >0 and <63
Returns
UART device if found, NULL otherwise

◆ uart_mux_foreach()

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.

Parameters
cbUser-supplied callback function to call
user_dataUser specified data