Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
SPI Emulation Interface

SPI Emulation Interface. More...

Data Structures

struct  spi_emul
 Node in a linked list of emulators for SPI devices. More...
 
struct  spi_emul_api
 Definition of the emulator API. More...
 

Typedefs

typedef int(* spi_emul_io_t) (const struct emul *target, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs)
 Passes SPI messages to the emulator.
 

Functions

int spi_emul_register (const struct device *dev, struct spi_emul *emul)
 Register an emulated device on the controller.
 
uint32_t spi_emul_get_config (const struct device *dev)
 Back door to allow an emulator to retrieve the host configuration.
 

Detailed Description

SPI Emulation Interface.

Typedef Documentation

◆ spi_emul_io_t

typedef int(* spi_emul_io_t) (const struct emul *target, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs)

#include <zephyr/drivers/spi_emul.h>

Passes SPI messages to the emulator.

The emulator updates the data with what was read back.

Parameters
targetThe device Emulator instance
configPointer to a valid spi_config structure instance. Pointer-comparison may be used to detect changes from previous operations.
tx_bufsBuffer array where data to be sent originates from, or NULL if none.
rx_bufsBuffer array where data to be read will be written to, or NULL if none.
Return values
0If successful.
-EIOGeneral input / output error.

Function Documentation

◆ spi_emul_get_config()

uint32_t spi_emul_get_config ( const struct device dev)

#include <zephyr/drivers/spi_emul.h>

Back door to allow an emulator to retrieve the host configuration.

Parameters
devSPI device associated with the emulator
Returns
Bit-packed 32-bit value containing the device's runtime configuration

◆ spi_emul_register()

int spi_emul_register ( const struct device dev,
struct spi_emul emul 
)

#include <zephyr/drivers/spi_emul.h>

Register an emulated device on the controller.

Parameters
devDevice that will use the emulator
emulSPI emulator to use
Returns
0 indicating success (always)