123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #ifndef ZEPHYR_INCLUDE_DRIVERS_EMUL_H_
- #define ZEPHYR_INCLUDE_DRIVERS_EMUL_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- struct device;
- struct emul;
- struct emul_link_for_bus {
- const char *label;
- };
- struct emul_list_for_bus {
-
- const struct emul_link_for_bus *children;
-
- unsigned int num_children;
- };
- typedef int (*emul_init_t)(const struct emul *emul,
- const struct device *parent);
- struct emul {
-
- emul_init_t init;
-
- const char *dev_label;
-
- const void *cfg;
- };
- extern const struct emul __emul_list_start[];
- extern const struct emul __emul_list_end[];
- #define EMUL_REG_NAME(node_id) (_CONCAT(__emulreg_, node_id))
- #define EMUL_DEFINE(init_ptr, node_id, cfg_ptr) \
- static struct emul EMUL_REG_NAME(node_id) \
- __attribute__((__section__(".emulators"))) __used = { \
- .init = (init_ptr), \
- .dev_label = DT_LABEL(node_id), \
- .cfg = (cfg_ptr), \
- };
- int emul_init_for_bus_from_list(const struct device *dev,
- const struct emul_list_for_bus *list);
- #ifdef __cplusplus
- }
- #endif
- #endif
|