13#ifndef ZEPHYR_INCLUDE_DRIVERS_I2C_H_
14#define ZEPHYR_INCLUDE_DRIVERS_I2C_H_
43#define I2C_SPEED_STANDARD (0x1U)
46#define I2C_SPEED_FAST (0x2U)
49#define I2C_SPEED_FAST_PLUS (0x3U)
52#define I2C_SPEED_HIGH (0x4U)
55#define I2C_SPEED_ULTRA (0x5U)
58#define I2C_SPEED_DT (0x7U)
60#define I2C_SPEED_SHIFT (1U)
61#define I2C_SPEED_SET(speed) (((speed) << I2C_SPEED_SHIFT) \
63#define I2C_SPEED_MASK (0x7U << I2C_SPEED_SHIFT)
64#define I2C_SPEED_GET(cfg) (((cfg) & I2C_SPEED_MASK) \
68#define I2C_ADDR_10_BITS BIT(0)
71#define I2C_MODE_CONTROLLER BIT(4)
73#if CONFIG_I2C_TRANSFER_TIMEOUT_SUPPORTED
76#if CONFIG_I2C_TRANSFER_TIMEOUT_MS
77#define I2C_TRANSFER_TIMEOUT K_MSEC(CONFIG_I2C_TRANSFER_TIMEOUT_MS)
79#define I2C_TRANSFER_TIMEOUT K_FOREVER
91#define I2C_DT_INST_TRANSFER_TIMEOUT_MS(inst) \
92 DT_INST_PROP_OR(inst, zephyr_transfer_timeout_ms, CONFIG_I2C_TRANSFER_TIMEOUT_MS)
106#define I2C_DT_INST_TRANSFER_TIMEOUT(inst) \
107 SYS_TIMEOUT_MS_INIT(((I2C_DT_INST_TRANSFER_TIMEOUT_MS(inst) != 0) \
108 ? I2C_DT_INST_TRANSFER_TIMEOUT_MS(inst) \
112#define BUILD_ASSERT_INVALID_I2C_TRANSFER_TIMEOUT() \
113 BUILD_ASSERT(CONFIG_I2C_TRANSFER_TIMEOUT_MS != 0, \
114 "infinite i2c transfer timeout not unsupported")
138#define I2C_DT_SPEC_GET_ON_I3C(node_id) \
139 .bus = DEVICE_DT_GET(DT_BUS(node_id)), \
140 .addr = DT_PROP_BY_IDX(node_id, reg, 0)
152#define I2C_DT_SPEC_GET_ON_I2C(node_id) \
153 .bus = DEVICE_DT_GET(DT_BUS(node_id)), \
154 .addr = DT_REG_ADDR(node_id)
166#define I2C_DT_SPEC_GET(node_id) \
168 COND_CODE_1(DT_ON_BUS(node_id, i3c), \
169 (I2C_DT_SPEC_GET_ON_I3C(node_id)), \
170 (I2C_DT_SPEC_GET_ON_I2C(node_id))) \
181#define I2C_DT_SPEC_INST_GET(inst) \
182 I2C_DT_SPEC_GET(DT_DRV_INST(inst))
190#define I2C_MSG_WRITE (0U << 0U)
193#define I2C_MSG_READ BIT(0)
196#define I2C_MSG_RW_MASK BIT(0)
200#define I2C_MSG_STOP BIT(1)
209#define I2C_MSG_RESTART BIT(2)
214#define I2C_MSG_ADDR_10_BITS BIT(3)
294#if defined(CONFIG_I2C_CALLBACK) || defined(__DOXYGEN__)
307#if defined(CONFIG_I2C_RTIO) || defined(__DOXYGEN__)
336#if defined(CONFIG_I2C_CALLBACK) || defined(__DOXYGEN__)
343#if defined(CONFIG_I2C_RTIO) || defined(__DOXYGEN__)
379#define I2C_TARGET_FLAGS_ADDR_10_BITS BIT(0)
463#if defined(CONFIG_I2C_TARGET_BUFFER_MODE) || defined(__DOXYGEN__)
565#if defined(CONFIG_I2C_TARGET_BUFFER_MODE) || defined(__DOXYGEN__)
707#if defined(CONFIG_I2C_STATS) || defined(__DOXYGEN__)
755 for (
uint8_t i = 0U; i < num_msgs; i++) {
757 bytes_read += msgs[i].
len;
759 bytes_written += msgs[i].
len;
771#define Z_I2C_DEVICE_STATE_DEFINE(dev_id) \
772 static struct i2c_device_state Z_DEVICE_STATE_NAME(dev_id) \
773 __attribute__((__section__(".z_devstate")))
781#define Z_I2C_INIT_FN(dev_id, init_fn) \
782 static inline int UTIL_CAT(dev_id, _init)(const struct device *dev) \
784 struct i2c_device_state *state = \
785 CONTAINER_OF(dev->state, struct i2c_device_state, devstate); \
786 stats_init(&state->stats.s_hdr, STATS_SIZE_32, 4, \
787 STATS_NAME_INIT_PARMS(i2c)); \
788 stats_register(dev->name, &(state->stats.s_hdr)); \
789 if (!is_null_no_warn(init_fn)) { \
790 return init_fn(dev); \
827#define I2C_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, \
828 data, config, level, prio, api, ...)\
829 Z_I2C_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \
830 Z_I2C_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \
831 Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
832 DEVICE_DT_NAME(node_id), \
833 &UTIL_CAT(Z_DEVICE_DT_DEV_ID(node_id), _init), \
834 deinit_fn, Z_DEVICE_DT_FLAGS(node_id), pm, data,\
835 config, level, prio, api, \
836 &(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \
846 ARG_UNUSED(num_msgs);
849#define I2C_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, \
850 data, config, level, prio, api, ...)\
851 DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, deinit_fn, pm, data, \
852 config, level, prio, api, __VA_ARGS__)
859#define I2C_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \
861 I2C_DEVICE_DT_DEINIT_DEFINE(node_id, init_fn, NULL, pm, data, \
862 config, level, prio, api, \
873#define I2C_DEVICE_DT_INST_DEINIT_DEFINE(inst, ...) \
874 I2C_DEVICE_DT_DEINIT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
884#define I2C_DEVICE_DT_INST_DEFINE(inst, ...) \
885 I2C_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
899static inline int z_impl_i2c_configure(
const struct device *dev,
946static inline int z_impl_i2c_get_config(
const struct device *dev,
uint32_t *dev_config)
992static inline int z_impl_i2c_transfer(
const struct device *dev,
1000 if (!
IS_ENABLED(CONFIG_I2C_ALLOW_NO_STOP_TRANSACTIONS)) {
1004 int res =
DEVICE_API_GET(i2c, dev)->transfer(dev, msgs, num_msgs, addr);
1015#if defined(CONFIG_I2C_CALLBACK) || defined(__DOXYGEN__)
1053 cb(dev, 0, userdata);
1057 if (!
IS_ENABLED(CONFIG_I2C_ALLOW_NO_STOP_TRANSACTIONS)) {
1061 return api->
transfer_cb(dev, msgs, num_msgs, addr, cb, userdata);
1112 size_t num_write,
void *read_buf,
size_t num_read,
1115 if ((msgs ==
NULL) || (num_msgs != 2)) {
1120 msgs[0].
len = num_write;
1124 msgs[1].
len = num_read;
1152 uint8_t num_msgs,
const void *write_buf,
size_t num_write,
1157 read_buf, num_read, cb, userdata);
1160#if defined(CONFIG_POLL) || defined(__DOXYGEN__)
1163void z_i2c_transfer_signal_cb(
const struct device *dev,
int result,
void *userdata);
1199 return api->
transfer_cb(dev, msgs, num_msgs, addr, z_i2c_transfer_signal_cb, sig);
1207#if defined(CONFIG_I2C_RTIO) || defined(__DOXYGEN__)
1230 const struct device *dev = dt_spec->
bus;
1242#define I2C_CAT2(x, y) x ## y
1253#define I2C_DT_IODEV_DEFINE(name, node_id) \
1254 const struct i2c_dt_spec _i2c_dt_spec_##name = \
1255 I2C_DT_SPEC_GET(node_id); \
1256 RTIO_IODEV_DEFINE(name, &i2c_iodev_api, (void *)&_i2c_dt_spec_##name)
1267#define I2C_DT_INST_IODEV_DEFINE(name, inst) \
1268 I2C_DT_IODEV_DEFINE(name, DT_DRV_INST(inst))
1280#define I2C_IODEV_DEFINE(name, _bus, _addr) \
1281 const struct i2c_dt_spec I2C_CAT2(_i2c_dt_spec_, name) = { \
1282 .bus = DEVICE_DT_GET(_bus), \
1285 RTIO_IODEV_DEFINE(name, &i2c_iodev_api, (void *)&I2C_CAT2(_i2c_dt_spec_, name))
1345 uint8_t start_addr,
void *
buf,
size_t num_bytes);
1382static inline int z_impl_i2c_recover_bus(
const struct device *dev)
1472static inline int z_impl_i2c_target_driver_register(
const struct device *dev)
1492static inline int z_impl_i2c_target_driver_unregister(
const struct device *dev)
1521 msg.
len = num_bytes;
1566 msg.
len = num_bytes;
1609 const void *write_buf,
size_t num_write,
1610 void *read_buf,
size_t num_read)
1615 msg[0].
len = num_write;
1619 msg[1].
len = num_read;
1643 const void *write_buf,
size_t num_write,
1644 void *read_buf,
size_t num_read)
1647 write_buf, num_write,
1648 read_buf, num_read);
1676 &start_addr,
sizeof(start_addr),
1700 start_addr,
buf, num_bytes);
1732 msg[0].
buf = &start_addr;
1737 msg[1].
len = num_bytes;
1763 start_addr,
buf, num_bytes);
1786 ®_addr,
sizeof(reg_addr),
1787 value,
sizeof(*value));
1831 uint8_t tx_buf[2] = {reg_addr, value};
1833 return i2c_write(dev, tx_buf, 2, dev_addr);
1887 new_value = (old_value & ~mask) | (value & mask);
1888 if (new_value == old_value) {
1914 reg_addr, mask, value);
1925#include <zephyr/syscalls/i2c.h>
workaround assembler barfing for ST r
Definition asm-macro-32-bit-gnu.h:27
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1449
bool device_is_ready(const struct device *dev)
Verify that a device is ready for use.
void(* i2c_api_iodev_submit)(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe)
Callback API to submit an RTIO request to the I2C controller.
Definition i2c.h:312
static int i2c_transfer_cb_dt(const struct i2c_dt_spec *spec, struct i2c_msg *msgs, uint8_t num_msgs, i2c_callback_t cb, void *userdata)
Perform data transfer to another I2C device in master mode asynchronously.
Definition i2c.h:1079
int i2c_target_driver_unregister(const struct device *dev)
Instructs the I2C Target device to unregister itself from the I2C Controller.
static int i2c_burst_write_dt(const struct i2c_dt_spec *spec, uint8_t start_addr, const uint8_t *buf, uint32_t num_bytes)
Write multiple bytes to an internal address of an I2C device.
Definition i2c.h:1757
static int i2c_target_unregister(const struct device *dev, struct i2c_target_config *cfg)
Unregisters the provided config as Target device.
Definition i2c.h:1445
static int i2c_write_read(const struct device *dev, uint16_t addr, const void *write_buf, size_t num_write, void *read_buf, size_t num_read)
Write then read data from an I2C device.
Definition i2c.h:1608
static bool i2c_is_restart_op(const struct i2c_msg *msg)
Check if the current message includes a restart.
Definition i2c.h:653
int i2c_target_driver_register(const struct device *dev)
Instructs the I2C Target device to register itself to the I2C Controller.
static void i2c_iodev_submit(struct rtio_iodev_sqe *iodev_sqe)
Submit request(s) to an I2C device with RTIO.
Definition i2c.h:1227
int(* i2c_api_configure_t)(const struct device *dev, uint32_t dev_config)
@def_driverbackendgroup{I2C,i2c_interface}
Definition i2c.h:261
struct rtio_sqe * i2c_rtio_copy(struct rtio *r, struct rtio_iodev *iodev, const struct i2c_msg *msgs, uint8_t num_msgs)
Copy the i2c_msgs into a set of RTIO requests.
void i2c_dump_msgs_rw(const struct device *dev, const struct i2c_msg *msgs, uint8_t num_msgs, uint16_t addr, bool dump_read)
Dump out an I2C message.
int(* i2c_target_read_requested_cb_t)(struct i2c_target_config *config, uint8_t *val)
Function called when a read from the device is initiated.
Definition i2c.h:438
int i2c_transfer(const struct device *dev, struct i2c_msg *msgs, uint8_t num_msgs, uint16_t addr)
Perform data transfer to another I2C device in controller mode.
static int i2c_write(const struct device *dev, const uint8_t *buf, uint32_t num_bytes, uint16_t addr)
Write a set amount of data to an I2C device.
Definition i2c.h:1515
static int i2c_write_dt(const struct i2c_dt_spec *spec, const uint8_t *buf, uint32_t num_bytes)
Write a set amount of data to an I2C device.
Definition i2c.h:1540
int(* i2c_api_full_io_t)(const struct device *dev, struct i2c_msg *msgs, uint8_t num_msgs, uint16_t addr)
Callback API to transfer messages on the I2C bus in controller mode.
Definition i2c.h:275
static int i2c_write_read_dt(const struct i2c_dt_spec *spec, const void *write_buf, size_t num_write, void *read_buf, size_t num_read)
Write then read data from an I2C device.
Definition i2c.h:1642
int(* i2c_api_transfer_cb_t)(const struct device *dev, struct i2c_msg *msgs, uint8_t num_msgs, uint16_t addr, i2c_callback_t cb, void *userdata)
Callback API to transfer messages on the I2C bus asynchronously.
Definition i2c.h:299
void(* i2c_target_error_cb_t)(struct i2c_target_config *config, enum i2c_error_reason error_code)
Function called when an error is detected on the I2C bus while acting as a target.
Definition i2c.h:547
static int i2c_write_read_cb(const struct device *dev, struct i2c_msg *msgs, uint8_t num_msgs, uint16_t addr, const void *write_buf, size_t num_write, void *read_buf, size_t num_read, i2c_callback_t cb, void *userdata)
Write then read data from an I2C device asynchronously.
Definition i2c.h:1110
static bool i2c_is_stop_op(const struct i2c_msg *msg)
Check if the current message includes a stop.
Definition i2c.h:641
int(* i2c_target_stop_cb_t)(struct i2c_target_config *config)
Function called when a stop condition is observed after a start condition addressed to a particular d...
Definition i2c.h:520
static bool i2c_is_ready_iodev(const struct rtio_iodev *i2c_iodev)
Validate that I2C bus is ready.
Definition i2c.h:1295
i2c_error_reason
I2C error reasons.
Definition i2c.h:528
static int i2c_burst_read(const struct device *dev, uint16_t dev_addr, uint8_t start_addr, uint8_t *buf, uint32_t num_bytes)
Read multiple bytes from an internal address of an I2C device.
Definition i2c.h:1669
int(* i2c_target_read_processed_cb_t)(struct i2c_target_config *config, uint8_t *val)
Function called when a read from the device is continued.
Definition i2c.h:460
int(* i2c_target_write_requested_cb_t)(struct i2c_target_config *config)
Function called when a write to the device is initiated.
Definition i2c.h:396
void i2c_iodev_submit_fallback(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe)
Fallback submit implementation.
int(* i2c_target_api_unregister_t)(const struct device *dev)
Callback API to instruct the I2C target device to unregister itself.
Definition i2c.h:364
static int i2c_reg_update_byte_dt(const struct i2c_dt_spec *spec, uint8_t reg_addr, uint8_t mask, uint8_t value)
Update internal register of an I2C device.
Definition i2c.h:1909
void(* i2c_callback_t)(const struct device *dev, int result, void *data)
I2C callback for asynchronous transfer requests.
Definition i2c.h:248
static int i2c_read_dt(const struct i2c_dt_spec *spec, uint8_t *buf, uint32_t num_bytes)
Read a set amount of data from an I2C device.
Definition i2c.h:1585
int(* i2c_api_target_unregister_t)(const struct device *dev, struct i2c_target_config *cfg)
Callback API to unregister a target device from the I2C controller.
Definition i2c.h:291
int(* i2c_target_write_received_cb_t)(struct i2c_target_config *config, uint8_t val)
Function called when a write to the device is continued.
Definition i2c.h:416
static int i2c_reg_write_byte_dt(const struct i2c_dt_spec *spec, uint8_t reg_addr, uint8_t value)
Write internal register of an I2C device.
Definition i2c.h:1849
int i2c_get_config(const struct device *dev, uint32_t *dev_config)
Get configuration of a host controller.
static int i2c_reg_write_byte(const struct device *dev, uint16_t dev_addr, uint8_t reg_addr, uint8_t value)
Write internal register of an I2C device.
Definition i2c.h:1827
#define I2C_MSG_READ
Read message from I2C bus.
Definition i2c.h:193
static int i2c_reg_read_byte_dt(const struct i2c_dt_spec *spec, uint8_t reg_addr, uint8_t *value)
Read internal register of an I2C device.
Definition i2c.h:1803
int i2c_configure(const struct device *dev, uint32_t dev_config)
Configure operation of a host controller.
static int i2c_configure_dt(const struct i2c_dt_spec *spec, uint32_t dev_config)
Configure operation of a host controller.
Definition i2c.h:918
static int i2c_write_read_cb_dt(const struct i2c_dt_spec *spec, struct i2c_msg *msgs, uint8_t num_msgs, const void *write_buf, size_t num_write, void *read_buf, size_t num_read, i2c_callback_t cb, void *userdata)
Write then read data from an I2C device asynchronously.
Definition i2c.h:1151
int(* i2c_target_api_register_t)(const struct device *dev)
Callback API to instruct the I2C target device to register itself.
Definition i2c.h:358
#define I2C_MSG_RESTART
RESTART I2C transaction for this message.
Definition i2c.h:209
static int i2c_transfer_dt(const struct i2c_dt_spec *spec, struct i2c_msg *msgs, uint8_t num_msgs)
Perform data transfer to another I2C device in controller mode.
Definition i2c.h:1362
int i2c_recover_bus(const struct device *dev)
Recover the I2C bus.
static int i2c_read(const struct device *dev, uint8_t *buf, uint32_t num_bytes, uint16_t addr)
Read a set amount of data from an I2C device.
Definition i2c.h:1560
static bool i2c_is_read_op(const struct i2c_msg *msg)
Check if the current message is a read operation.
Definition i2c.h:629
static int i2c_burst_read_dt(const struct i2c_dt_spec *spec, uint8_t start_addr, uint8_t *buf, uint32_t num_bytes)
Read multiple bytes from an internal address of an I2C device.
Definition i2c.h:1694
static int i2c_target_register(const struct device *dev, struct i2c_target_config *cfg)
Registers the provided config as Target device of a controller.
Definition i2c.h:1417
int(* i2c_target_buf_read_requested_cb_t)(struct i2c_target_config *config, uint8_t **ptr, uint32_t *len)
Function called when a read from the device is initiated.
Definition i2c.h:502
static int i2c_transfer_cb(const struct device *dev, struct i2c_msg *msgs, uint8_t num_msgs, uint16_t addr, i2c_callback_t cb, void *userdata)
Perform data transfer to another I2C device in controller mode.
Definition i2c.h:1039
#define I2C_MSG_STOP
Send STOP after this message.
Definition i2c.h:200
int(* i2c_api_target_register_t)(const struct device *dev, struct i2c_target_config *cfg)
Callback API to register a target device on the I2C controller.
Definition i2c.h:284
static void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs, uint8_t num_msgs)
Updates the i2c stats for i2c transfers.
Definition i2c.h:745
static void i2c_dump_msgs(const struct device *dev, const struct i2c_msg *msgs, uint8_t num_msgs, uint16_t addr)
Dump out an I2C message, before it is executed.
Definition i2c.h:701
static int i2c_transfer_signal(const struct device *dev, struct i2c_msg *msgs, uint8_t num_msgs, uint16_t addr, struct k_poll_signal *sig)
Perform data transfer to another I2C device in controller mode.
Definition i2c.h:1187
void(* i2c_target_buf_write_received_cb_t)(struct i2c_target_config *config, uint8_t *ptr, uint32_t len)
Function called when a write to the device is completed.
Definition i2c.h:477
static int i2c_reg_update_byte(const struct device *dev, uint8_t dev_addr, uint8_t reg_addr, uint8_t mask, uint8_t value)
Update internal register of an I2C device.
Definition i2c.h:1874
int(* i2c_api_recover_bus_t)(const struct device *dev)
Callback API to recover the I2C bus.
Definition i2c.h:320
int(* i2c_api_get_config_t)(const struct device *dev, uint32_t *dev_config)
Callback API to get the current configuration of the I2C controller.
Definition i2c.h:268
const struct rtio_iodev_api i2c_iodev_api
struct rtio_sqe * i2c_rtio_copy_reg_write_byte(struct rtio *r, struct rtio_iodev *iodev, uint8_t reg_addr, uint8_t data)
Copy the register address and data to a SQE.
#define I2C_MSG_WRITE
Write message to I2C bus.
Definition i2c.h:190
static int i2c_reg_read_byte(const struct device *dev, uint16_t dev_addr, uint8_t reg_addr, uint8_t *value)
Read internal register of an I2C device.
Definition i2c.h:1781
static int i2c_burst_write(const struct device *dev, uint16_t dev_addr, uint8_t start_addr, const uint8_t *buf, uint32_t num_bytes)
Write multiple bytes to an internal address of an I2C device.
Definition i2c.h:1724
struct rtio_sqe * i2c_rtio_copy_reg_burst_read(struct rtio *r, struct rtio_iodev *iodev, uint8_t start_addr, void *buf, size_t num_bytes)
acquire and configure a i2c burst read transmission
static bool i2c_is_ready_dt(const struct i2c_dt_spec *spec)
Validate that I2C bus is ready.
Definition i2c.h:616
@ I2C_ERROR_DMA
Definition i2c.h:532
@ I2C_ERROR_SIZE
Definition i2c.h:531
@ I2C_ERROR_GENERIC
Definition i2c.h:533
@ I2C_ERROR_TIMEOUT
Definition i2c.h:529
@ I2C_ERROR_ARBITRATION
Definition i2c.h:530
static void rtio_iodev_sqe_err(struct rtio_iodev_sqe *iodev_sqe, int result)
Inform the executor of a submissions completion with error.
Definition rtio.h:673
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:44
#define STATS_SECT_END
Ends a stats group struct definition.
Definition stats.h:169
#define STATS_NAME(sectname__, entry__)
Add an entry name to a statistics entry name map.
Definition stats.h:519
#define STATS_SECT_ENTRY32(var__)
Declares a 32-bit stat entry inside a group struct.
Definition stats.h:204
#define STATS_NAME_START(sectname__)
Begin a statistics entry name map.
Definition stats.h:510
#define STATS_NAME_END(sectname__)
End a statistics entry name map.
Definition stats.h:527
#define STATS_INC(group__, var__)
Increments a statistic entry.
Definition stats.h:255
#define STATS_INCN(group__, var__, n__)
Increases a statistic entry by the specified amount.
Definition stats.h:243
#define STATS_SECT_START(group__)
Begins a stats group struct definition.
Definition stats.h:181
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:154
#define CONTAINER_OF(ptr, type, field)
Get a pointer to a structure containing the element.
Definition util.h:281
#define EINVAL
Invalid argument.
Definition errno.h:61
#define ENOSYS
Function not implemented.
Definition errno.h:83
#define NULL
Definition iar_missing_defs.h:20
flags
Definition parser.h:97
state
Definition parser_state.h:29
Real-Time IO device API for moving bytes with low effort.
Header file for the single-linked list API.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device dynamic structure (in RAM) per driver instance.
Definition device.h:458
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
void * data
Address of the device instance private data.
Definition device.h:523
struct device_state * state
Address of the common device state.
Definition device.h:521
I2C specific device state which allows for i2c device class specific additions.
Definition i2c.h:733
struct stats_i2c stats
Definition i2c.h:735
struct device_state devstate
Definition i2c.h:734
@driver_ops{I2C}
Definition i2c.h:325
i2c_api_target_unregister_t target_unregister
@driver_ops_optional Unregisters the provided config as Target device.
Definition i2c.h:335
i2c_api_recover_bus_t recover_bus
@driver_ops_optional Recover the I2C bus.
Definition i2c.h:351
i2c_api_full_io_t transfer
@driver_ops_mandatory Perform data transfer to another I2C device in controller mode.
Definition i2c.h:331
i2c_api_iodev_submit iodev_submit
@driver_ops_optional Submit request(s) to an I2C device with RTIO.
Definition i2c.h:348
i2c_api_get_config_t get_config
@driver_ops_optional Get configuration of a host controller.
Definition i2c.h:329
i2c_api_configure_t configure
@driver_ops_mandatory Configure operation of a host controller.
Definition i2c.h:327
i2c_api_target_register_t target_register
@driver_ops_optional Registers the provided config as Target device of a controller.
Definition i2c.h:333
i2c_api_transfer_cb_t transfer_cb
@driver_ops_optional Perform data transfer to another I2C device in controller mode.
Definition i2c.h:341
Complete I2C DT information.
Definition i2c.h:121
const struct device * bus
I2C bus.
Definition i2c.h:123
uint16_t addr
Target address.
Definition i2c.h:125
One I2C Message.
Definition i2c.h:230
uint8_t * buf
Data buffer in bytes.
Definition i2c.h:232
uint32_t len
Length of buffer in bytes.
Definition i2c.h:235
uint8_t flags
Flags for this message.
Definition i2c.h:238
Structure providing callbacks to be implemented for devices that supports the I2C target API.
Definition i2c.h:556
i2c_target_read_requested_cb_t read_requested
Function called when a read from the device is initiated.
Definition i2c.h:560
i2c_target_write_received_cb_t write_received
Function called when a write to the device is continued.
Definition i2c.h:562
i2c_target_read_processed_cb_t read_processed
Function called when a read from the device is continued.
Definition i2c.h:564
i2c_target_write_requested_cb_t write_requested
Function called when a write to the device is initiated.
Definition i2c.h:558
i2c_target_stop_cb_t stop
Function called when a stop condition is observed after a start condition addressed to a particular d...
Definition i2c.h:578
i2c_target_buf_read_requested_cb_t buf_read_requested
Definition i2c.h:575
i2c_target_error_cb_t error
Function called when an error is detected on the I2C bus while acting as a target.
Definition i2c.h:580
i2c_target_buf_write_received_cb_t buf_write_received
Definition i2c.h:570
Structure describing a device that supports the I2C target API.
Definition i2c.h:594
uint8_t flags
Flags for the target device defined by I2C_TARGET_FLAGS_* constants.
Definition i2c.h:599
uint16_t address
Address for this target device.
Definition i2c.h:602
sys_snode_t node
Private, do not modify.
Definition i2c.h:596
const struct i2c_target_callbacks * callbacks
Callback functions.
Definition i2c.h:605
@driver_ops{I2C Target}
Definition i2c.h:369
i2c_target_api_unregister_t driver_unregister
@driver_ops_mandatory Instructs the I2C Target device to unregister itself from the I2C Controller.
Definition i2c.h:373
i2c_target_api_register_t driver_register
@driver_ops_mandatory Instructs the I2C Target device to register itself to the I2C Controller.
Definition i2c.h:371
Poll signal object.
Definition kernel.h:6862
API that an RTIO IO device should implement.
Definition iodev.h:33
IO device submission queue entry.
Definition sqe.h:394
struct rtio_sqe sqe
Definition sqe.h:395
An IO device with a function table for submitting requests.
Definition iodev.h:48
void * data
Definition iodev.h:53
A submission queue event.
Definition sqe.h:304
const struct rtio_iodev * iodev
Device to operation on.
Definition sqe.h:313
const uint8_t * buf
Buffer to write from.
Definition sqe.h:329
An RTIO context containing what can be viewed as a pair of queues.
Definition rtio.h:70