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

eSPI Emulation Interface More...

Data Structures

struct  emul_espi_device_api
 
struct  espi_emul
 
struct  emul_espi_driver_api
 

Macros

#define EMUL_ESPI_HOST_CHIPSEL   0
 

Typedefs

typedef int(* emul_espi_api_set_vw) (struct espi_emul *emul, enum espi_vwire_signal vw, uint8_t level)
 
typedef int(* emul_espi_api_get_vw) (struct espi_emul *emul, enum espi_vwire_signal vw, uint8_t *level)
 
typedef struct espi_emul *(* emul_find_emul) (const struct device *dev, unsigned int chipsel)
 
typedef int(* emul_trigger_event) (const struct device *dev, struct espi_event *evt)
 

Functions

int espi_emul_register (const struct device *dev, const char *name, struct espi_emul *emul)
 
int emul_espi_host_send_vw (const struct device *espi_dev, enum espi_vwire_signal vw, uint8_t level)
 
int emul_espi_host_port80_write (const struct device *espi_dev, uint32_t data)
 

Detailed Description

eSPI Emulation Interface

Macro Definition Documentation

◆ EMUL_ESPI_HOST_CHIPSEL

#define EMUL_ESPI_HOST_CHIPSEL   0

Typedef Documentation

◆ emul_espi_api_get_vw

typedef int(* emul_espi_api_get_vw) (struct espi_emul *emul, enum espi_vwire_signal vw, uint8_t *level)

#include <include/drivers/espi_emul.h>

Passes eSPI virtual wires get request (virtual wire packet) to the emulator. The emulator returns the state (level) of its virtual wire.

Parameters
emulEmulator instance
vwThe signal to be get.
levelThe level of the signal to be get.
Return values
0If successful.
-EIOGeneral input / output error.

◆ emul_espi_api_set_vw

typedef int(* emul_espi_api_set_vw) (struct espi_emul *emul, enum espi_vwire_signal vw, uint8_t level)

#include <include/drivers/espi_emul.h>

Passes eSPI virtual wires set request (virtual wire packet) to the emulator. The emulator updates the state (level) of its virtual wire.

Parameters
emulEmulator instance
vwThe signal to be set.
levelThe level of signal requested LOW(0) or HIGH(1).
Return values
0If successful.
-EIOGeneral input / output error.

◆ emul_find_emul

typedef struct espi_emul *(* emul_find_emul) (const struct device *dev, unsigned int chipsel)

#include <include/drivers/espi_emul.h>

Find an emulator present on a eSPI bus

At present the function is used only to find an emulator of the host device. It may be useful in systems with the SPI flash chips.

Parameters
deveSPI emulation controller device
chipselChip-select value
Returns
emulator to use
NULL if not found

◆ emul_trigger_event

typedef int(* emul_trigger_event) (const struct device *dev, struct espi_event *evt)

#include <include/drivers/espi_emul.h>

Triggers an event on the emulator of eSPI controller side which causes calling specific callbacks.

Parameters
devDevice instance of emulated eSPI controller
evtEvent to be triggered
Return values
0If successful.
-EIOGeneral input / output error.

Function Documentation

◆ emul_espi_host_port80_write()

int emul_espi_host_port80_write ( const struct device espi_dev,
uint32_t  data 
)

#include <include/drivers/espi_emul.h>

Perform port80 write on the emulated host side, which will trigger a proper event(and callbacks) on the emulated eSPI controller

Parameters
espi_deveSPI emulation controller device
dataThe date to be written.
Return values
0If successful.
-EIOGeneral input / output error.

◆ emul_espi_host_send_vw()

int emul_espi_host_send_vw ( const struct device espi_dev,
enum espi_vwire_signal  vw,
uint8_t  level 
)

#include <include/drivers/espi_emul.h>

Sets the eSPI virtual wire on the host side, which will trigger a proper event(and callbacks) on the emulated eSPI controller

Parameters
espi_deveSPI emulation controller device
vwThe signal to be set.
levelThe level of the signal to be set.
Return values
0If successful.
-EIOGeneral input / output error.

◆ espi_emul_register()

int espi_emul_register ( const struct device dev,
const char *  name,
struct espi_emul emul 
)

#include <include/drivers/espi_emul.h>

Register an emulated device on the controller

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