Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
SPI Emulation Interface

SPI Emulation Interface. More...

Data Structures

struct  spi_emul
 
struct  spi_emul_api
 

Typedefs

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

Functions

int spi_emul_register (const struct device *dev, const char *name, struct spi_emul *emul)
 
uint32_t spi_emul_get_config (const struct device *dev)
 

Detailed Description

SPI Emulation Interface.

Typedef Documentation

◆ spi_emul_io_t

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

#include <include/drivers/spi_emul.h>

Passes SPI messages to the emulator. The emulator updates the data with what was read back.

Parameters
emulEmulator 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 <include/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,
const char *  name,
struct spi_emul emul 
)

#include <include/drivers/spi_emul.h>

Register an emulated device on the controller

Parameters
devDevice that will use the emulator
nameUser-friendly name for this emulator
emulSPI emulator to use
Returns
0 indicating success (always)