Zephyr Project API  3.2.0
A Scalable Open Source RTOS
i2c_emul.h
Go to the documentation of this file.
1
7/*
8 * Copyright 2020 Google LLC
9 * Copyright (c) 2020 Nordic Semiconductor ASA
10 *
11 * SPDX-License-Identifier: Apache-2.0
12 */
13#ifndef ZEPHYR_INCLUDE_DRIVERS_I2C_I2C_EMUL_H_
14#define ZEPHYR_INCLUDE_DRIVERS_I2C_I2C_EMUL_H_
15
16#include <zephyr/device.h>
17#include <zephyr/drivers/emul.h>
18#include <zephyr/types.h>
19
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31struct i2c_msg;
32struct i2c_emul_api;
33
35struct i2c_emul {
37
39 const struct emul *target;
40
41 /* API provided for this device */
42 const struct i2c_emul_api *api;
43
44 /* I2C address of the emulated device */
46};
47
61typedef int (*i2c_emul_transfer_t)(const struct emul *target, struct i2c_msg *msgs, int num_msgs,
62 int addr);
63
71int i2c_emul_register(const struct device *dev, struct i2c_emul *emul);
72
76};
77
78#ifdef __cplusplus
79}
80#endif
81
86#endif /* ZEPHYR_INCLUDE_DRIVERS_I2C_I2C_EMUL_H_ */
int(* i2c_emul_transfer_t)(const struct emul *target, struct i2c_msg *msgs, int num_msgs, int addr)
Definition: i2c_emul.h:61
int i2c_emul_register(const struct device *dev, struct i2c_emul *emul)
int target
Definition: main.c:68
struct _snode sys_snode_t
Definition: slist.h:33
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition: device.h:435
Definition: emul.h:67
Definition: i2c_emul.h:74
i2c_emul_transfer_t transfer
Definition: i2c_emul.h:75
Definition: i2c_emul.h:35
const struct emul * target
Definition: i2c_emul.h:39
sys_snode_t node
Definition: i2c_emul.h:36
const struct i2c_emul_api * api
Definition: i2c_emul.h:42
uint16_t addr
Definition: i2c_emul.h:45
One I2C Message.
Definition: i2c.h:180