Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Devmux Driver APIs. More...

Functions

ssize_t devmux_select_get (const struct device *dev)
 Get the current selection of a devmux device.
 
int devmux_select_set (struct device *dev, size_t index)
 Set the selection of a devmux device.
 

Detailed Description

Devmux Driver APIs.

Devmux operates as a device multiplexer, forwarding the characteristics of the selected device.

+----------+ +----------+
| devmux | | devmux |
| | | |
dev0 | | dev0 | |
+----------> \ | +----------> |
| \ | | |
dev1 | \ | dev0 dev1 | | dev2
+----------> O +----------> +----------> O +---------->
| | | / |
dev2 | | dev2 | / |
+----------> | +----------> / |
| | | |
| | | |
| | | |
+-----^----+ +-----^----+
| |
select == 0 | select == 2 |
+--------------+ +---------------+
int select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds, zsock_fd_set *exceptfds, struct timeval *timeout)

Function Documentation

◆ devmux_select_get()

ssize_t devmux_select_get ( const struct device dev)

#include <zephyr/drivers/misc/devmux/devmux.h>

Get the current selection of a devmux device.

Return the index of the currently selected device.

Parameters
devthe devmux device
Returns
The index (>= 0) of the currently active multiplexed device on success
Return values
-EINVALIf dev is invalid

◆ devmux_select_set()

int devmux_select_set ( struct device dev,
size_t  index 
)

#include <zephyr/drivers/misc/devmux/devmux.h>

Set the selection of a devmux device.

Select the device at index.

Parameters
[in]devthe devmux device
indexthe index representing the desired selection
Return values
0On success
-EINVALIf dev is invalid
-ENODEVIf the multiplexed device at index is not ready