Zephyr API Documentation
3.0.0
A Scalable Open Source RTOS
|
|
3.0.0 |
Emulators used to test drivers and higher-level code that uses them. More...
Modules | |
I2C Emulation Interface | |
I2C Emulation Interface. | |
SPI Emulation Interface | |
SPI Emulation Interface. | |
eSPI Emulation Interface | |
eSPI Emulation Interface | |
Data Structures | |
struct | emul_link_for_bus |
struct | emul_list_for_bus |
struct | emul |
Macros | |
#define | EMUL_REG_NAME(node_id) (_CONCAT(__emulreg_, node_id)) |
#define | EMUL_DEFINE(init_ptr, node_id, cfg_ptr, data_ptr) |
Typedefs | |
typedef int(* | emul_init_t) (const struct emul *emul, const struct device *parent) |
Functions | |
int | emul_init_for_bus_from_list (const struct device *dev, const struct emul_list_for_bus *list) |
const struct emul * | emul_get_binding (const char *name) |
Retrieve the emul structure for an emulator by name. More... | |
Emulators used to test drivers and higher-level code that uses them.
#define EMUL_DEFINE | ( | init_ptr, | |
node_id, | |||
cfg_ptr, | |||
data_ptr | |||
) |
#include <include/drivers/emul.h>
Define a new emulator
This adds a new struct emul to the linker list of emulations. This is typically used in your emulator's DT_INST_FOREACH_STATUS_OKAY() clause.
init_ptr | function to call to initialise the emulator (see emul_init typedef) |
node_id | Node ID of the driver to emulate (e.g. DT_DRV_INST(n)) |
cfg_ptr | emulator-specific configuration data |
data_ptr | emulator-specific data |
#define EMUL_REG_NAME | ( | node_id | ) | (_CONCAT(__emulreg_, node_id)) |
#include <include/drivers/emul.h>
#include <include/drivers/emul.h>
Standard callback for emulator initialisation providing the initialiser record and the device that calls the emulator functions.
emul | Emulator to init |
parent | Parent device that is using the emulator |
const struct emul * emul_get_binding | ( | const char * | name | ) |
#include <include/drivers/emul.h>
Retrieve the emul structure for an emulator by name.
Emulator objects are created via the EMUL_DEFINE() macro and placed in memory by the linker. If the emulator structure is needed for custom API calls, it can be retrieved by the name that the emulator exposes to the system (this is the devicetree node's label by default).
name | Emulator name to search for. A null pointer, or a pointer to an empty string, will cause NULL to be returned. |
int emul_init_for_bus_from_list | ( | const struct device * | dev, |
const struct emul_list_for_bus * | list | ||
) |
#include <include/drivers/emul.h>
Set up a list of emulators
dev | Device the emulators are attached to (e.g. an I2C controller) |
list | List of devices to set up |