Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
emul.h File Reference

Go to the source code of this file.

Data Structures

struct  emul_link_for_bus
 Structure uniquely identifying a device to be emulated. More...
 
struct  emul_list_for_bus
 List of emulators attached to a bus. More...
 
struct  no_bus_emul
 Emulator API stub when an emulator is not actually placed on a bus. More...
 
struct  emul
 An emulator instance - represents the target emulated device/peripheral that is interacted with through an emulated bus. More...
 
union  emul::bus
 Pointer to the emulated bus node. More...
 

Macros

#define EMUL_DT_NAME_GET(node_id)   _CONCAT(__emulreg_, node_id)
 Use the devicetree node identifier as a unique name.
 
#define EMUL_DT_DEFINE(node_id, init_fn, data_ptr, cfg_ptr, bus_api, _backend_api)
 Define a new emulator.
 
#define EMUL_DT_INST_DEFINE(inst, ...)   EMUL_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
 Like EMUL_DT_DEFINE(), but uses an instance of a DT_DRV_COMPAT compatible instead of a node identifier.
 
#define EMUL_DT_GET(node_id)   (&EMUL_DT_NAME_GET(node_id))
 Get a const struct emul* from a devicetree node identifier.
 
#define EMUL_DT_GET_OR_NULL(node_id)    COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), (EMUL_DT_GET(node_id)), (NULL))
 Utility macro to obtain an optional reference to an emulator.
 

Typedefs

typedef int(* emul_init_t) (const struct emul *emul, const struct device *parent)
 Standard callback for emulator initialisation providing the initialiser record and the device that calls the emulator functions.
 

Enumerations

enum  emul_bus_type {
  EMUL_BUS_TYPE_I2C , EMUL_BUS_TYPE_ESPI , EMUL_BUS_TYPE_SPI , EMUL_BUS_TYPE_MSPI ,
  EMUL_BUS_TYPE_NONE
}
 The types of supported buses. More...
 

Functions

int emul_init_for_bus (const struct device *dev)
 Set up a list of emulators.
 
const struct emulemul_get_binding (const char *name)
 Retrieve the emul structure for an emulator by name.
 
 DT_FOREACH_STATUS_OKAY_NODE (Z_MAYBE_EMUL_DECLARE_INTERNAL)
 

Function Documentation

◆ DT_FOREACH_STATUS_OKAY_NODE()

DT_FOREACH_STATUS_OKAY_NODE ( Z_MAYBE_EMUL_DECLARE_INTERNAL  )