Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
i3c.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Intel Corporation
3 * Copyright 2023 Meta Platforms, Inc. and its affiliates
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
13
14#ifndef ZEPHYR_INCLUDE_DRIVERS_I3C_H_
15#define ZEPHYR_INCLUDE_DRIVERS_I3C_H_
16
25
26#include <errno.h>
27#include <stdint.h>
28#include <stddef.h>
29
30#include <zephyr/device.h>
36#include <zephyr/drivers/i2c.h>
37#include <zephyr/sys/slist.h>
38#include <zephyr/sys/util.h>
39#include <zephyr/rtio/rtio.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
49#define I3C_OD_TLOW_MIN_NS 200
50#define I3C_OD_MIXED_BUS_THIGH_MAX_NS 41
51#define I3C_OD_FIRST_BC_THIGH_MIN_NS 200
52
56#define I3C_BUS_TCAS_MIN_PS 38400U
57
61#define I3C_BUS_TCAS_MAX_PS 1000000U
62
66#define I3C_BUS_TCAS_FIRST_BC_MIN_PS 200000U
67
108
115#define I3C_BCR_MAX_DATA_SPEED_LIMIT BIT(0)
116
118#define I3C_BCR_IBI_REQUEST_CAPABLE BIT(1)
119
127#define I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE BIT(2)
128
135#define I3C_BCR_OFFLINE_CAPABLE BIT(3)
136
143#define I3C_BCR_VIRTUAL_TARGET BIT(4)
144
152#define I3C_BCR_ADV_CAPABILITIES BIT(5)
153
155#define I3C_BCR_DEVICE_ROLE_I3C_TARGET 0U
156
158#define I3C_BCR_DEVICE_ROLE_I3C_CONTROLLER_CAPABLE 1U
159
161#define I3C_BCR_DEVICE_ROLE_MASK GENMASK(7U, 6U)
162
170#define I3C_BCR_DEVICE_ROLE(bcr) \
171 FIELD_GET(I3C_BCR_DEVICE_ROLE_MASK, (bcr))
172
174
194
196#define I3C_LVR_I2C_FM_PLUS_MODE 0
197
199#define I3C_LVR_I2C_FM_MODE 1
200
202#define I3C_LVR_I2C_MODE_MASK BIT(4)
203
211#define I3C_LVR_I2C_MODE(lvr) \
212 FIELD_GET(I3C_LVR_I2C_MODE_MASK, (lvr))
213
220#define I3C_LVR_I2C_DEV_IDX_0 0
221
228#define I3C_LVR_I2C_DEV_IDX_1 1
229
236#define I3C_LVR_I2C_DEV_IDX_2 2
237
239#define I3C_LVR_I2C_DEV_IDX_MASK GENMASK(7U, 5U)
240
248#define I3C_LVR_I2C_DEV_IDX(lvr) \
249 FIELD_GET(I3C_LVR_I2C_DEV_IDX_MASK, (lvr))
250
252
283
299
324
330
331/*
332 * I3C_MSG_* are I3C Message flags.
333 */
334
336#define I3C_MSG_WRITE (0U << 0U)
337
339#define I3C_MSG_READ BIT(0)
340
342#define I3C_MSG_RW_MASK BIT(0)
344
346#define I3C_MSG_STOP BIT(1)
347
357#define I3C_MSG_RESTART BIT(2)
358
360#define I3C_MSG_HDR BIT(3)
361
363#define I3C_MSG_NBCH BIT(4)
364
366#define I3C_MSG_NOACK_EXPECTED BIT(5)
367
369#define I3C_MSG_HDR_MODE0 BIT(0)
370
372#define I3C_MSG_HDR_MODE1 BIT(1)
373
375#define I3C_MSG_HDR_MODE2 BIT(2)
376
378#define I3C_MSG_HDR_MODE3 BIT(3)
379
381#define I3C_MSG_HDR_MODE4 BIT(4)
382
384#define I3C_MSG_HDR_MODE5 BIT(5)
385
387#define I3C_MSG_HDR_MODE6 BIT(6)
388
390#define I3C_MSG_HDR_MODE7 BIT(7)
391
393#define I3C_MSG_HDR_DDR I3C_MSG_HDR_MODE0
394
396#define I3C_MSG_HDR_TSP I3C_MSG_HDR_MODE1
397
399#define I3C_MSG_HDR_TSL I3C_MSG_HDR_MODE2
400
402#define I3C_MSG_HDR_BT I3C_MSG_HDR_MODE3
403
405
410
463
465
474
539
551
553 union {
556
563 void *ptr;
564 };
565};
566
574typedef void (*i3c_callback_t)(const struct device *dev, int result, void *data);
575
582struct i3c_device_desc;
583struct i3c_device_id;
585struct i3c_target_config;
586struct i3c_config_target;
587
588__subsystem struct i3c_driver_api {
598 struct i2c_driver_api i2c_api;
599
612 int (*configure)(const struct device *dev,
613 enum i3c_config_type type, void *config);
614
627 int (*config_get)(const struct device *dev,
628 enum i3c_config_type type, void *config);
629#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
642 int (*recover_bus)(const struct device *dev);
643
657 int (*attach_i3c_device)(const struct device *dev,
658 struct i3c_device_desc *target);
659
674 int (*reattach_i3c_device)(const struct device *dev,
675 struct i3c_device_desc *target,
676 uint8_t old_dyn_addr);
677
691 int (*detach_i3c_device)(const struct device *dev,
692 struct i3c_device_desc *target);
693
707 int (*attach_i2c_device)(const struct device *dev,
708 struct i3c_i2c_device_desc *target);
709
723 int (*detach_i2c_device)(const struct device *dev,
724 struct i3c_i2c_device_desc *target);
725
738 int (*do_daa)(const struct device *dev);
739
753 int (*do_ccc)(const struct device *dev,
754 struct i3c_ccc_payload *payload);
755
769 int (*i3c_xfers)(const struct device *dev,
770 struct i3c_device_desc *target,
771 struct i3c_msg *msgs,
772 uint8_t num_msgs);
773#if defined(CONFIG_I3C_CALLBACK) || defined(__DOXYGEN__)
789 int (*do_ccc_cb)(const struct device *dev,
790 struct i3c_ccc_payload *payload,
792 void *userdata);
793
809 int (*i3c_xfers_cb)(const struct device *dev,
810 struct i3c_device_desc *target,
811 struct i3c_msg *msgs,
812 uint8_t num_msgs,
814 void *userdata);
815#endif /* CONFIG_I3C_CALLBACK */
831 struct i3c_device_desc *(*i3c_device_find)(const struct device *dev,
832 const struct i3c_device_id *id);
833#endif /* CONFIG_I3C_CONTROLLER */
834#if defined(CONFIG_I3C_USE_IBI) || defined(__DOXYGEN__)
835#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
849 int (*ibi_raise)(const struct device *dev,
850 struct i3c_ibi *request);
851#endif /* CONFIG_I3C_TARGET */
852#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
864 int (*ibi_hj_response)(const struct device *dev,
865 bool ack);
866
878 int (*ibi_crr_response)(struct i3c_device_desc *target,
879 bool ack);
880
894 int (*ibi_enable)(const struct device *dev,
895 struct i3c_device_desc *target);
896
910 int (*ibi_disable)(const struct device *dev,
911 struct i3c_device_desc *target);
912#endif /* CONFIG_I3C_CONTROLLER */
913#endif /* CONFIG_I3C_USE_IBI */
914#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
931 int (*target_register)(const struct device *dev,
932 struct i3c_target_config *cfg);
933
950 int (*target_unregister)(const struct device *dev,
951 struct i3c_target_config *cfg);
952
970 int (*target_tx_write)(const struct device *dev,
971 uint8_t *buf, uint16_t len, uint8_t hdr_mode);
972
989 int (*target_controller_handoff)(const struct device *dev,
990 bool accept);
991#endif /* CONFIG_I3C_TARGET */
992#if defined(CONFIG_I3C_RTIO) || defined(__DOXYGEN__)
1004 void (*iodev_submit)(const struct device *dev,
1005 struct rtio_iodev_sqe *iodev_sqe);
1006#endif /* CONFIG_I3C_RTIO */
1007};
1008
1009DEVICE_API_EXTENDS(i3c, i2c, i2c_api);
1010
1014
1021};
1022
1031#define I3C_DEVICE_ID(pid_val) {.pid = pid_val}
1032
1051
1053 const struct device *bus;
1054
1056 const struct device *dev;
1057
1060
1074
1085
1094
1109
1115
1123
1127 struct {
1130
1133
1137
1141 struct {
1144
1147
1151
1154
1156 struct {
1157 union {
1166
1176 };
1177
1186
1199
1206
1208 struct {
1217
1228
1233 void *controller_priv;
1235
1236#if defined(CONFIG_I3C_USE_IBI) || defined(__DOXYGEN__)
1242#endif /* CONFIG_I3C_USE_IBI */
1243};
1244
1260
1262 const struct device *bus;
1263
1266
1272
1277 void *controller_priv;
1279};
1280
1313
1326 struct i3c_device_desc * const i3c;
1327
1331 struct i3c_i2c_device_desc * const i2c;
1332
1337
1342};
1343
1350#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1353
1356
1359#elif defined(CONFIG_CPP)
1360 /* Empty struct has size 0 in C, size 1 in C++. Force them to be the same. */
1361 uint8_t unused_cpp_size_compatibility;
1362#endif
1363};
1364
1365#if defined(CONFIG_CPP)
1366BUILD_ASSERT(sizeof(struct i3c_driver_config) >= 1);
1367#endif
1368
1376#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1379#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
1382
1385#endif /* CONFIG_I3C_TARGET */
1386#endif /* CONFIG_I3C_CONTROLLER */
1387};
1388
1389#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1399#define I3C_BUS_FOR_EACH_I3CDEV(bus, desc) \
1400 SYS_SLIST_FOR_EACH_CONTAINER( \
1401 &((struct i3c_driver_data *)(bus->data))->attached_dev.devices.i3c, desc, node)
1402
1412#define I3C_BUS_FOR_EACH_I2CDEV(bus, desc) \
1413 SYS_SLIST_FOR_EACH_CONTAINER( \
1414 &((struct i3c_driver_data *)(bus->data))->attached_dev.devices.i2c, desc, node)
1415
1426#define I3C_BUS_FOR_EACH_I3CDEV_SAFE(bus, desc, desc_s) \
1427 SYS_SLIST_FOR_EACH_CONTAINER_SAFE( \
1428 &((struct i3c_driver_data *)(bus->data))->attached_dev.devices.i3c, desc, desc_s, \
1429 node)
1430
1441#define I3C_BUS_FOR_EACH_I2CDEV_SAFE(bus, desc, desc_s) \
1442 SYS_SLIST_FOR_EACH_CONTAINER_SAFE( \
1443 &((struct i3c_driver_data *)(bus->data))->attached_dev.devices.i2c, desc, desc_s, \
1444 node)
1445
1460struct i3c_device_desc *i3c_dev_list_find(const struct i3c_dev_list *dev_list,
1461 const struct i3c_device_id *id);
1462
1478 uint8_t addr);
1479
1495 uint8_t addr);
1496
1512 uint16_t addr);
1513
1567 uint64_t pid, bool must_match,
1568 bool assigned_okay,
1569 struct i3c_device_desc **target,
1570 uint8_t *addr);
1571#endif /* CONFIG_I3C_CONTROLLER */
1572
1586static inline int i3c_configure(const struct device *dev,
1587 enum i3c_config_type type, void *config)
1588{
1589 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
1590
1591 if (api->configure == NULL) {
1592 return -ENOSYS;
1593 }
1594
1595 return api->configure(dev, type, config);
1596}
1597
1598#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1616static inline int i3c_configure_controller(const struct device *dev,
1617 struct i3c_config_controller *config)
1618{
1619 return i3c_configure(dev, I3C_CONFIG_CONTROLLER, config);
1620}
1621#endif /* CONFIG_I3C_CONTROLLER */
1622
1623#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
1641static inline int i3c_configure_target(const struct device *dev,
1642 struct i3c_config_target *config)
1643{
1644 return i3c_configure(dev, I3C_CONFIG_TARGET, config);
1645}
1646#endif /* CONFIG_I3C_TARGET */
1647
1668static inline int i3c_config_get(const struct device *dev,
1669 enum i3c_config_type type, void *config)
1670{
1671 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
1672
1673 if (api->config_get == NULL) {
1674 return -ENOSYS;
1675 }
1676
1677 return api->config_get(dev, type, config);
1678}
1679
1680#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1698static inline int i3c_config_get_controller(const struct device *dev,
1699 struct i3c_config_controller *config)
1700{
1701 return i3c_config_get(dev, I3C_CONFIG_CONTROLLER, config);
1702}
1703#endif /* CONFIG_I3C_CONTROLLER */
1704
1705#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
1723static inline int i3c_config_get_target(const struct device *dev,
1724 struct i3c_config_target *config)
1725{
1726 return i3c_config_get(dev, I3C_CONFIG_TARGET, config);
1727}
1728#endif /* CONFIG_I3C_TARGET */
1729
1730#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1743static inline int i3c_recover_bus(const struct device *dev)
1744{
1745 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
1746
1747 if (api->recover_bus == NULL) {
1748 return -ENOSYS;
1749 }
1750
1751 return api->recover_bus(dev);
1752}
1753
1776
1803int i3c_reattach_i3c_device(struct i3c_device_desc *target, uint8_t old_dyn_addr);
1804
1827
1841static inline bool i3c_is_i3c_device_attached(struct i3c_device_desc *target)
1842{
1843 struct i3c_device_desc *desc;
1844
1845 I3C_BUS_FOR_EACH_I3CDEV(target->bus, desc) {
1846 if (desc == target) {
1847 return true;
1848 }
1849 }
1850 return false;
1851}
1852
1874
1895
1907static inline bool i3c_is_i2c_device_attached(struct i3c_i2c_device_desc *target)
1908{
1909 struct i3c_i2c_device_desc *desc;
1910
1911 I3C_BUS_FOR_EACH_I2CDEV(target->bus, desc) {
1912 if (desc == target) {
1913 return true;
1914 }
1915 }
1916 return false;
1917}
1918
1944static inline int i3c_do_daa(const struct device *dev)
1945{
1946 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
1947
1948 if (api->do_daa == NULL) {
1949 return -ENOSYS;
1950 }
1951
1952 return api->do_daa(dev);
1953}
1954
1970__syscall int i3c_do_ccc(const struct device *dev,
1971 struct i3c_ccc_payload *payload);
1972
1973static inline int z_impl_i3c_do_ccc(const struct device *dev,
1974 struct i3c_ccc_payload *payload)
1975{
1976 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
1977
1978 if (api->do_ccc == NULL) {
1979 return -ENOSYS;
1980 }
1981
1982 return api->do_ccc(dev, payload);
1983}
1984
1985#if defined(CONFIG_I3C_CALLBACK) || defined(__DOXYGEN__)
2008__syscall int i3c_do_ccc_cb(const struct device *dev,
2009 struct i3c_ccc_payload *payload,
2010 i3c_callback_t cb,
2011 void *userdata);
2012
2013static inline int z_impl_i3c_do_ccc_cb(const struct device *dev,
2014 struct i3c_ccc_payload *payload,
2015 i3c_callback_t cb,
2016 void *userdata)
2017{
2018 const struct i3c_driver_api *api =
2019 (const struct i3c_driver_api *)dev->api;
2020
2021 if (api->do_ccc_cb == NULL) {
2022 return -ENOSYS;
2023 }
2024
2025 return api->do_ccc_cb(dev, payload, cb, userdata);
2026}
2027#endif /* CONFIG_I3C_CALLBACK */
2028
2033
2064__syscall int i3c_transfer(struct i3c_device_desc *target,
2065 struct i3c_msg *msgs, uint8_t num_msgs);
2066
2067static inline int z_impl_i3c_transfer(struct i3c_device_desc *target,
2068 struct i3c_msg *msgs, uint8_t num_msgs)
2069{
2070 return DEVICE_API_GET(i3c, target->bus)->i3c_xfers(target->bus, target, msgs, num_msgs);
2071}
2072
2073#if defined(CONFIG_I3C_CALLBACK) || defined(__DOXYGEN__)
2104__syscall int i3c_transfer_cb(struct i3c_device_desc *target,
2105 struct i3c_msg *msgs,
2106 uint8_t num_msgs,
2107 i3c_callback_t cb,
2108 void *userdata);
2109
2110static inline int z_impl_i3c_transfer_cb(struct i3c_device_desc *target,
2111 struct i3c_msg *msgs,
2112 uint8_t num_msgs,
2113 i3c_callback_t cb,
2114 void *userdata)
2115{
2116 const struct i3c_driver_api *api = (const struct i3c_driver_api *)target->bus->api;
2117
2118 if (api->i3c_xfers_cb == NULL) {
2119 return -ENOSYS;
2120 }
2121
2122 return api->i3c_xfers_cb(target->bus, target, msgs, num_msgs, cb, userdata);
2123}
2124#endif /* CONFIG_I3C_CALLBACK */
2125
2127
2144static inline
2146 const struct i3c_device_id *id)
2147{
2148 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
2149
2150 if (api->i3c_device_find == NULL) {
2151 return NULL;
2152 }
2153
2154 return api->i3c_device_find(dev, id);
2155}
2156#endif /* CONFIG_I3C_CONTROLLER */
2157
2158#if defined(CONFIG_I3C_USE_IBI) || defined(__DOXYGEN__)
2163
2164#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
2179static inline int i3c_ibi_hj_response(const struct device *dev,
2180 bool ack)
2181{
2182 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
2183
2184 if (api->ibi_hj_response == NULL) {
2185 return -ENOSYS;
2186 }
2187
2188 return api->ibi_hj_response(dev, ack);
2189}
2190
2205static inline int i3c_ibi_crr_response(struct i3c_device_desc *target,
2206 bool ack)
2207{
2208 const struct i3c_driver_api *api =
2209 (const struct i3c_driver_api *)target->bus->api;
2210
2211 if (api->ibi_crr_response == NULL) {
2212 return -ENOSYS;
2213 }
2214
2215 return api->ibi_crr_response(target, ack);
2216}
2217#endif /* CONFIG_I3C_CONTROLLER */
2218
2219#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
2233static inline int i3c_ibi_raise(const struct device *dev,
2234 struct i3c_ibi *request)
2235{
2236 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
2237
2238 if (api->ibi_raise == NULL) {
2239 return -ENOSYS;
2240 }
2241
2242 return api->ibi_raise(dev, request);
2243}
2244#endif /* CONFIG_I3C_TARGET */
2245
2246#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
2263static inline int i3c_ibi_enable(struct i3c_device_desc *target)
2264{
2265 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, target->bus);
2266
2267 if (api->ibi_enable == NULL) {
2268 return -ENOSYS;
2269 }
2270
2271 return api->ibi_enable(target->bus, target);
2272}
2273
2288static inline int i3c_ibi_disable(struct i3c_device_desc *target)
2289{
2290 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, target->bus);
2291
2292 if (api->ibi_disable == NULL) {
2293 return -ENOSYS;
2294 }
2295
2296 return api->ibi_disable(target->bus, target);
2297}
2298#endif /* CONFIG_I3C_CONTROLLER */
2299#endif /* CONFIG_I3C_USE_IBI */
2300
2312static inline int i3c_ibi_has_payload(struct i3c_device_desc *target)
2313{
2314 return (target->bcr & I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE)
2316}
2317
2329static inline int i3c_device_is_ibi_capable(struct i3c_device_desc *target)
2330{
2331 return (target->bcr & I3C_BCR_IBI_REQUEST_CAPABLE)
2333}
2334
2346static inline int i3c_device_is_controller_capable(struct i3c_device_desc *target)
2347{
2348 return I3C_BCR_DEVICE_ROLE(target->bcr)
2350}
2351
2353
2354#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
2359
2375static inline int i3c_write(struct i3c_device_desc *target,
2376 const uint8_t *buf, uint32_t num_bytes)
2377{
2378 struct i3c_msg msg;
2379
2380 msg.buf = (uint8_t *)buf;
2381 msg.len = num_bytes;
2383 msg.hdr_mode = 0;
2384 msg.hdr_cmd_code = 0;
2385
2386 return i3c_transfer(target, &msg, 1);
2387}
2388
2404static inline int i3c_read(struct i3c_device_desc *target,
2405 uint8_t *buf, uint32_t num_bytes)
2406{
2407 struct i3c_msg msg;
2408
2409 msg.buf = buf;
2410 msg.len = num_bytes;
2412 msg.hdr_mode = 0;
2413 msg.hdr_cmd_code = 0;
2414
2415 return i3c_transfer(target, &msg, 1);
2416}
2417
2437static inline int i3c_write_read(struct i3c_device_desc *target,
2438 const void *write_buf, size_t num_write,
2439 void *read_buf, size_t num_read)
2440{
2441 struct i3c_msg msg[2];
2442
2443 msg[0].buf = (uint8_t *)write_buf;
2444 msg[0].len = num_write;
2445 msg[0].flags = I3C_MSG_WRITE;
2446 msg[0].hdr_mode = 0;
2447 msg[0].hdr_cmd_code = 0;
2448
2449 msg[1].buf = (uint8_t *)read_buf;
2450 msg[1].len = num_read;
2452 msg[1].hdr_mode = 0;
2453 msg[1].hdr_cmd_code = 0;
2454
2455 return i3c_transfer(target, msg, 2);
2456}
2457
2477static inline int i3c_burst_read(struct i3c_device_desc *target,
2478 uint8_t start_addr,
2479 uint8_t *buf,
2480 uint32_t num_bytes)
2481{
2482 return i3c_write_read(target,
2483 &start_addr, sizeof(start_addr),
2484 buf, num_bytes);
2485}
2486
2509static inline int i3c_burst_write(struct i3c_device_desc *target,
2510 uint8_t start_addr,
2511 const uint8_t *buf,
2512 uint32_t num_bytes)
2513{
2514 struct i3c_msg msg[2];
2515
2516 msg[0].buf = &start_addr;
2517 msg[0].len = 1U;
2518 msg[0].flags = I3C_MSG_WRITE;
2519 msg[0].hdr_mode = 0;
2520 msg[0].hdr_cmd_code = 0;
2521
2522 msg[1].buf = (uint8_t *)buf;
2523 msg[1].len = num_bytes;
2524 msg[1].flags = I3C_MSG_WRITE | I3C_MSG_STOP;
2525 msg[1].hdr_mode = 0;
2526 msg[1].hdr_cmd_code = 0;
2527
2528 return i3c_transfer(target, msg, 2);
2529}
2530
2547static inline int i3c_reg_read_byte(struct i3c_device_desc *target,
2548 uint8_t reg_addr, uint8_t *value)
2549{
2550 return i3c_write_read(target,
2551 &reg_addr, sizeof(reg_addr),
2552 value, sizeof(*value));
2553}
2554
2574static inline int i3c_reg_write_byte(struct i3c_device_desc *target,
2575 uint8_t reg_addr, uint8_t value)
2576{
2577 uint8_t tx_buf[2] = {reg_addr, value};
2578
2579 return i3c_write(target, tx_buf, 2);
2580}
2581
2602static inline int i3c_reg_update_byte(struct i3c_device_desc *target,
2603 uint8_t reg_addr, uint8_t mask,
2604 uint8_t value)
2605{
2606 uint8_t old_value, new_value;
2607 int rc;
2608
2609 rc = i3c_reg_read_byte(target, reg_addr, &old_value);
2610 if (rc != 0) {
2611 return rc;
2612 }
2613
2614 new_value = (old_value & ~mask) | (value & mask);
2615 if (new_value == old_value) {
2616 return 0;
2617 }
2618
2619 return i3c_reg_write_byte(target, reg_addr, new_value);
2620}
2621
2648void i3c_dump_msgs(const char *name, const struct i3c_msg *msgs,
2649 uint8_t num_msgs, struct i3c_device_desc *target);
2650
2652
2670int i3c_bus_init(const struct device *dev,
2671 const struct i3c_dev_list *i3c_dev_list);
2672
2693
2719
2743static inline int i3c_device_info_get(struct i3c_device_desc *target)
2744{
2745 int rc;
2746
2747 rc = i3c_device_basic_info_get(target);
2748 if (rc != 0) {
2749 return rc;
2750 }
2751
2752 return i3c_device_adv_info_get(target);
2753}
2754
2767enum i3c_bus_mode i3c_bus_mode(const struct i3c_dev_list *dev_list);
2768
2781bool i3c_bus_has_sec_controller(const struct device *dev);
2782
2795int i3c_bus_rstdaa_all(const struct device *dev);
2796
2811int i3c_bus_setdasa(struct i3c_device_desc *desc, uint8_t dynamic_addr);
2812
2827int i3c_bus_setnewda(struct i3c_device_desc *desc, uint8_t dynamic_addr);
2828
2841int i3c_bus_setaasa(const struct device *dev);
2842
2856
2870
2884
2898
2912
2927int i3c_bus_setmrl(struct i3c_device_desc *desc, uint16_t mrl, uint8_t ibi_len);
2928
2943
2959int i3c_bus_setmrl_all(const struct device *dev, uint16_t mrl, uint8_t ibi_len, bool has_ibi_size);
2960
2974int i3c_bus_setmwl_all(const struct device *dev, uint16_t mwl);
2975
2976#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
2990
3004int i3c_bus_deftgts(const struct device *dev);
3005#endif /* CONFIG_I3C_TARGET */
3006
3019
3036int i3c_device_controller_handoff(struct i3c_device_desc *target, bool requested);
3037#endif /* CONFIG_I3C_CONTROLLER */
3038
3039#if defined(CONFIG_I3C_USE_IBI) || defined(__DOXYGEN__)
3040#if (defined(CONFIG_I3C_CONTROLLER) && defined(CONFIG_I3C_TARGET)) || defined(__DOXYGEN__)
3054void i3c_sec_handoffed(struct k_work *work);
3055#endif /* CONFIG_I3C_CONTROLLER && CONFIG_I3C_TARGET */
3056#endif /* CONFIG_I3C_USE_IBI */
3057
3058#if (defined(CONFIG_I3C_NUM_OF_DESC_MEM_SLABS) && CONFIG_I3C_NUM_OF_DESC_MEM_SLABS > 0) || \
3059 defined(__DOXYGEN__)
3060
3072
3083
3096
3097#else
3098
3099static inline struct i3c_device_desc *i3c_device_desc_alloc(void)
3100{
3101 return NULL;
3102}
3103
3104static inline void i3c_device_desc_free(struct i3c_device_desc *desc)
3105{
3106 ARG_UNUSED(desc);
3107}
3108
3109static inline bool i3c_device_desc_in_pool(struct i3c_device_desc *desc)
3110{
3111 ARG_UNUSED(desc);
3112 return false;
3113}
3114
3115#endif /* CONFIG_I3C_NUM_OF_DESC_MEM_SLABS > 0 */
3116
3117#if (defined(CONFIG_I3C_I2C_NUM_OF_DESC_MEM_SLABS) && CONFIG_I3C_I2C_NUM_OF_DESC_MEM_SLABS > 0) || \
3118 defined(__DOXYGEN__)
3119
3131
3142
3155
3156#else
3157
3158static inline struct i3c_i2c_device_desc *i3c_i2c_device_desc_alloc(void)
3159{
3160 return NULL;
3161}
3162
3163static inline void i3c_i2c_device_desc_free(struct i3c_i2c_device_desc *desc)
3164{
3165 ARG_UNUSED(desc);
3166}
3167
3168static inline bool i3c_i2c_device_desc_in_pool(struct i3c_i2c_device_desc *desc)
3169{
3170 ARG_UNUSED(desc);
3171 return false;
3172}
3173
3174#endif /* CONFIG_I3C_I2C_NUM_OF_DESC_MEM_SLABS > 0 */
3175
3176#if defined(CONFIG_I3C_RTIO) || defined(__DOXYGEN__)
3177
3179 const struct device *bus;
3180 const struct i3c_device_id dev_id;
3181};
3182
3195void i3c_iodev_submit_fallback(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe);
3196
3205static inline void i3c_iodev_submit(struct rtio_iodev_sqe *iodev_sqe)
3206{
3207 const struct i3c_iodev_data *data =
3208 (const struct i3c_iodev_data *)iodev_sqe->sqe.iodev->data;
3209 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, data->bus);
3210
3211 if (api->iodev_submit == NULL) {
3212 rtio_iodev_sqe_err(iodev_sqe, -ENOSYS);
3213 return;
3214 }
3215 api->iodev_submit(data->bus, iodev_sqe);
3216}
3217
3218extern const struct rtio_iodev_api i3c_iodev_api;
3219
3231#define I3C_DT_IODEV_DEFINE(name, node_id) \
3232 const struct i3c_iodev_data _i3c_iodev_data_##name = { \
3233 .bus = DEVICE_DT_GET(DT_BUS(node_id)), \
3234 .dev_id = I3C_DEVICE_ID_DT(node_id), \
3235 }; \
3236 RTIO_IODEV_DEFINE(name, &i3c_iodev_api, (void *)&_i3c_iodev_data_##name)
3237
3249#define I3C_DT_INST_IODEV_DEFINE(name, inst) \
3250 I3C_DT_IODEV_DEFINE(name, DT_DRV_INST(inst))
3251
3265struct rtio_sqe *i3c_rtio_copy(struct rtio *r,
3266 struct rtio_iodev *iodev,
3267 const struct i3c_msg *msgs,
3268 uint8_t num_msgs);
3269
3270#endif /* CONFIG_I3C_RTIO */
3271
3272#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
3273/*
3274 * This needs to be after declaration of struct i3c_driver_api,
3275 * or else compiler complains about undefined type inside
3276 * the static inline API wrappers.
3277 */
3279#endif /* CONFIG_I3C_TARGET */
3280
3281#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
3282/*
3283 * Include High-Data-Rate (HDR) inline helper functions
3284 */
3286#endif /* CONFIG_I3C_CONTROLLER */
3287
3288#ifdef __cplusplus
3289}
3290#endif
3291
3295
3296#include <zephyr/syscalls/i3c.h>
3297
3298#endif /* ZEPHYR_INCLUDE_DRIVERS_I3C_H_ */
APIs and macros for the Zephyr device model.
#define DEVICE_API_EXTENDS(_child, _parent, _member)
Declare that API class _child is an extension of device API class _parent.
Definition device.h:1470
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1505
Main header file for I2C (Inter-Integrated Circuit) driver API.
System error numbers.
i3c_sdr_controller_error_types
I3C SDR Controller Error Types.
Definition error_types.h:24
static int i3c_ibi_disable(struct i3c_device_desc *target)
Disable IBI of a target device.
Definition i3c.h:2288
static int i3c_ibi_has_payload(struct i3c_device_desc *target)
Check if target's IBI has payload.
Definition i3c.h:2312
static int i3c_ibi_crr_response(struct i3c_device_desc *target, bool ack)
ACK or NACK IBI Controller Role Requests.
Definition i3c.h:2205
static int i3c_ibi_raise(const struct device *dev, struct i3c_ibi *request)
Raise an In-Band Interrupt (IBI).
Definition i3c.h:2233
static int i3c_device_is_controller_capable(struct i3c_device_desc *target)
Check if the target is controller capable.
Definition i3c.h:2346
static int i3c_device_is_ibi_capable(struct i3c_device_desc *target)
Check if device is IBI capable.
Definition i3c.h:2329
static int i3c_ibi_enable(struct i3c_device_desc *target)
Enable IBI of a target device.
Definition i3c.h:2263
int(* i3c_target_ibi_cb_t)(struct i3c_device_desc *target, struct i3c_ibi_payload *payload)
Function called when In-Band Interrupt received from target device.
Definition ibi.h:146
static int i3c_ibi_hj_response(const struct device *dev, bool ack)
ACK or NACK IBI HJ Requests.
Definition i3c.h:2179
int i3c_attach_i3c_device(struct i3c_device_desc *target)
Attach an I3C device.
#define I3C_BCR_IBI_REQUEST_CAPABLE
IBI Request Capable bit.
Definition i3c.h:118
#define I3C_BCR_DEVICE_ROLE_I3C_CONTROLLER_CAPABLE
Device Role - I3C Controller Capable.
Definition i3c.h:158
struct i3c_device_desc * i3c_dev_list_i3c_addr_find(const struct device *dev, uint8_t addr)
Find a I3C target device descriptor by dynamic address.
static struct i3c_device_desc * i3c_device_find(const struct device *dev, const struct i3c_device_id *id)
Find a registered I3C target device.
Definition i3c.h:2145
int i3c_bus_getpid(struct i3c_device_desc *desc)
Retrieve the Provisional ID (PID) of a device.
bool i3c_bus_has_sec_controller(const struct device *dev)
Check if the bus has a secondary controller.
int i3c_bus_rstdaa_all(const struct device *dev)
Reset all devices on the bus and clear their dynamic addresses.
struct i3c_i2c_device_desc * i3c_i2c_device_desc_alloc(void)
Allocate memory for a i3c i2c device descriptor.
void i3c_sec_handoffed(struct k_work *work)
Call back for when Controllership is Handoffed to itself.
void i3c_device_desc_free(struct i3c_device_desc *desc)
Free memory from a i3c device descriptor.
int i3c_bus_setmrl_all(const struct device *dev, uint16_t mrl, uint8_t ibi_len, bool has_ibi_size)
Set the Maximum Read Length (MRL) for all devices on the bus.
int i3c_bus_setdasa(struct i3c_device_desc *desc, uint8_t dynamic_addr)
Assign a dynamic address to a device using its static address.
static int i3c_configure(const struct device *dev, enum i3c_config_type type, void *config)
Configure the I3C hardware.
Definition i3c.h:1586
static int i3c_device_info_get(struct i3c_device_desc *target)
Get all information from device and update device descriptor.
Definition i3c.h:2743
static void i3c_iodev_submit(struct rtio_iodev_sqe *iodev_sqe)
Submit request(s) to an I3C device with RTIO.
Definition i3c.h:3205
#define I3C_BUS_FOR_EACH_I3CDEV(bus, desc)
iterate over all I3C devices present on the bus
Definition i3c.h:1399
int i3c_dev_list_daa_addr_helper(const struct device *dev, uint64_t pid, bool must_match, bool assigned_okay, struct i3c_device_desc **target, uint8_t *addr)
Helper function to find a usable address during ENTDAA.
#define I3C_BUS_FOR_EACH_I2CDEV(bus, desc)
iterate over all I2C devices present on the bus
Definition i3c.h:1412
static bool i3c_is_i2c_device_attached(struct i3c_i2c_device_desc *target)
Check if an I2C device is attached to the bus.
Definition i3c.h:1907
int i3c_device_adv_info_get(struct i3c_device_desc *target)
Get advanced information from device and update device descriptor.
int i3c_bus_getmrl(struct i3c_device_desc *desc)
Retrieve the Maximum Read Length (MRL) of a device.
int i3c_bus_deftgts(const struct device *dev)
Send the CCC DEFTGTS.
int i3c_bus_setnewda(struct i3c_device_desc *desc, uint8_t dynamic_addr)
Assign a new dynamic address to a device.
i3c_config_type
Type of configuration being passed to configure function.
Definition i3c.h:469
int i3c_attach_i2c_device(struct i3c_i2c_device_desc *target)
Attach an I2C device.
void i3c_i2c_device_desc_free(struct i3c_i2c_device_desc *desc)
Free memory from a i3c i2c device descriptor.
i3c_i2c_speed_type
I2C bus speed under I3C bus.
Definition i3c.h:289
int i3c_detach_i3c_device(struct i3c_device_desc *target)
Detach I3C Device.
int i3c_bus_setmrl(struct i3c_device_desc *desc, uint16_t mrl, uint8_t ibi_len)
Set the Maximum Read Length (MRL) for a device.
int i3c_do_ccc_cb(const struct device *dev, struct i3c_ccc_payload *payload, i3c_callback_t cb, void *userdata)
Send an async CCC to the bus with a callback.
i3c_bus_mode
I3C bus mode.
Definition i3c.h:256
static int i3c_recover_bus(const struct device *dev)
Attempt bus recovery on the I3C bus.
Definition i3c.h:1743
static int i3c_configure_target(const struct device *dev, struct i3c_config_target *config)
Set the target device configuration for an I3C device.
Definition i3c.h:1641
int i3c_bus_setmwl(struct i3c_device_desc *desc, uint16_t mwl)
Set the Maximum Write Length (MWL) for a device.
static int i3c_config_get(const struct device *dev, enum i3c_config_type type, void *config)
Get configuration of the I3C hardware.
Definition i3c.h:1668
int i3c_bus_getacccr(struct i3c_device_desc *desc)
Retrieve the Active Controller's Dynamic Address (ACCCR).
int i3c_bus_getmwl(struct i3c_device_desc *desc)
Retrieve the Maximum Write Length (MWL) of a device.
int i3c_detach_i2c_device(struct i3c_i2c_device_desc *target)
Detach I2C Device.
static int i3c_config_get_target(const struct device *dev, struct i3c_config_target *config)
Get the target device configuration for an I3C device.
Definition i3c.h:1723
#define I3C_BCR_DEVICE_ROLE(bcr)
Device Role.
Definition i3c.h:170
void i3c_iodev_submit_fallback(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe)
Fallback submit implementation.
static int i3c_config_get_controller(const struct device *dev, struct i3c_config_controller *config)
Get the controller device configuration for an I3C device.
Definition i3c.h:1698
struct i3c_device_desc * i3c_dev_list_find(const struct i3c_dev_list *dev_list, const struct i3c_device_id *id)
Find a I3C target device descriptor by ID.
int i3c_bus_init(const struct device *dev, const struct i3c_dev_list *i3c_dev_list)
Generic helper function to perform bus initialization.
int i3c_do_ccc(const struct device *dev, struct i3c_ccc_payload *payload)
Send CCC to the bus.
int i3c_bus_getdcr(struct i3c_device_desc *desc)
Retrieve the Device Characteristics Register (DCR) of a device.
int i3c_device_basic_info_get(struct i3c_device_desc *target)
Get basic information from device and update device descriptor.
uint8_t i3c_odd_parity(uint8_t p)
Calculate odd parity.
struct rtio_sqe * i3c_rtio_copy(struct rtio *r, struct rtio_iodev *iodev, const struct i3c_msg *msgs, uint8_t num_msgs)
Copy the i3c_msgs into a set of RTIO requests.
int i3c_bus_setaasa(const struct device *dev)
Assign static addresses as dynamic addresses for all devices on the bus.
struct i3c_device_desc * i3c_device_desc_alloc(void)
Allocate memory for a i3c device descriptor.
static int i3c_do_daa(const struct device *dev)
Perform Dynamic Address Assignment on the I3C bus.
Definition i3c.h:1944
bool i3c_i2c_device_desc_in_pool(struct i3c_i2c_device_desc *desc)
Report if the i3c i2c device descriptor was from a mem slab.
static bool i3c_is_i3c_device_attached(struct i3c_device_desc *target)
Check if an I3C device is attached to the bus.
Definition i3c.h:1841
void(* i3c_callback_t)(const struct device *dev, int result, void *data)
I3C callback for asynchronous transfer requests.
Definition i3c.h:574
int i3c_bus_getbcr(struct i3c_device_desc *desc)
Retrieve the Bus Characteristics Register (BCR) of a device.
const struct rtio_iodev_api i3c_iodev_api
int i3c_bus_setmwl_all(const struct device *dev, uint16_t mwl)
Set the Maximum Write Length (MWL) for all devices on the bus.
#define I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE
IBI Payload bit.
Definition i3c.h:127
int i3c_reattach_i3c_device(struct i3c_device_desc *target, uint8_t old_dyn_addr)
Reattach I3C device.
i3c_data_rate
I3C data rate.
Definition i3c.h:305
static int i3c_configure_controller(const struct device *dev, struct i3c_config_controller *config)
Set the controller device configuration for an I3C device.
Definition i3c.h:1616
struct i3c_device_desc * i3c_dev_list_i3c_static_addr_find(const struct device *dev, uint8_t addr)
Find a I3C target device descriptor by static address.
int i3c_device_controller_handoff(struct i3c_device_desc *target, bool requested)
Perform Controller Handoff.
bool i3c_device_desc_in_pool(struct i3c_device_desc *desc)
Report if the i3c device descriptor was from a mem slab.
struct i3c_i2c_device_desc * i3c_dev_list_i2c_addr_find(const struct device *dev, uint16_t addr)
Find a I2C target device descriptor by address.
@ I3C_CONFIG_TARGET
Definition i3c.h:471
@ I3C_CONFIG_CUSTOM
Definition i3c.h:472
@ I3C_CONFIG_CONTROLLER
Definition i3c.h:470
@ I3C_I2C_SPEED_INVALID
Definition i3c.h:297
@ I3C_I2C_SPEED_MAX
Definition i3c.h:296
@ I3C_I2C_SPEED_FMPLUS
I2C FM+ mode.
Definition i3c.h:294
@ I3C_I2C_SPEED_FM
I2C FM mode.
Definition i3c.h:291
@ I3C_BUS_MODE_INVALID
Definition i3c.h:281
@ I3C_BUS_MODE_PURE
Only I3C devices are on the bus.
Definition i3c.h:258
@ I3C_BUS_MODE_MIXED_FAST
Both I3C and legacy I2C devices are on the bus.
Definition i3c.h:264
@ I3C_BUS_MODE_MAX
Definition i3c.h:280
@ I3C_BUS_MODE_MIXED_LIMITED
Both I3C and legacy I2C devices are on the bus.
Definition i3c.h:271
@ I3C_BUS_MODE_MIXED_SLOW
Both I3C and legacy I2C devices are on the bus.
Definition i3c.h:278
@ I3C_DATA_RATE_MAX
Definition i3c.h:321
@ I3C_DATA_RATE_INVALID
Definition i3c.h:322
@ I3C_DATA_RATE_HDR_TSP
High Data Rate - Ternary Symbol for Pure Bus.
Definition i3c.h:316
@ I3C_DATA_RATE_HDR_DDR
High Data Rate - Double Data Rate messaging.
Definition i3c.h:310
@ I3C_DATA_RATE_SDR
Single Data Rate messaging.
Definition i3c.h:307
@ I3C_DATA_RATE_HDR_TSL
High Data Rate - Ternary Symbol Legacy-inclusive-Bus.
Definition i3c.h:313
@ I3C_DATA_RATE_HDR_BT
High Data Rate - Bulk Transport.
Definition i3c.h:319
int i3c_transfer(struct i3c_device_desc *target, struct i3c_msg *msgs, uint8_t num_msgs)
Perform data transfer from the controller to a I3C target device.
#define I3C_MSG_STOP
Send STOP after this message.
Definition i3c.h:346
int i3c_transfer_cb(struct i3c_device_desc *target, struct i3c_msg *msgs, uint8_t num_msgs, i3c_callback_t cb, void *userdata)
Perform an async data transfer from the controller to a I3C target device with a callback.
static int i3c_write_read(struct i3c_device_desc *target, const void *write_buf, size_t num_write, void *read_buf, size_t num_read)
Write then read data from an I3C target device.
Definition i3c.h:2437
static int i3c_burst_read(struct i3c_device_desc *target, uint8_t start_addr, uint8_t *buf, uint32_t num_bytes)
Read multiple bytes from an internal address of an I3C target device.
Definition i3c.h:2477
static int i3c_reg_update_byte(struct i3c_device_desc *target, uint8_t reg_addr, uint8_t mask, uint8_t value)
Update internal register of an I3C target device.
Definition i3c.h:2602
void i3c_dump_msgs(const char *name, const struct i3c_msg *msgs, uint8_t num_msgs, struct i3c_device_desc *target)
Dump out an I3C message.
#define I3C_MSG_READ
Read message from I3C bus.
Definition i3c.h:339
#define I3C_MSG_WRITE
Write message to I3C bus.
Definition i3c.h:336
static int i3c_reg_read_byte(struct i3c_device_desc *target, uint8_t reg_addr, uint8_t *value)
Read internal register of an I3C target device.
Definition i3c.h:2547
static int i3c_write(struct i3c_device_desc *target, const uint8_t *buf, uint32_t num_bytes)
Write a set amount of data to an I3C target device.
Definition i3c.h:2375
static int i3c_read(struct i3c_device_desc *target, uint8_t *buf, uint32_t num_bytes)
Read a set amount of data from an I3C target device.
Definition i3c.h:2404
#define I3C_MSG_RESTART
RESTART I3C transaction for this message.
Definition i3c.h:357
static int i3c_burst_write(struct i3c_device_desc *target, uint8_t start_addr, const uint8_t *buf, uint32_t num_bytes)
Write multiple bytes to an internal address of an I3C target device.
Definition i3c.h:2509
static int i3c_reg_write_byte(struct i3c_device_desc *target, uint8_t reg_addr, uint8_t value)
Write internal register of an I3C target device.
Definition i3c.h:2574
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:738
struct _slist sys_slist_t
Single-linked list structure.
Definition slist.h:54
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:44
#define ENOSYS
Function not implemented.
Definition errno.h:83
int accept(int sock, struct sockaddr *addr, socklen_t *addrlen)
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
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:543
void * data
Address of the device instance private data.
Definition device.h:553
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:549
<span class="mlabel">Driver Operations</span> I2C driver operations
Definition i2c.h:339
Structure to keep track of addresses on I3C bus.
Definition addresses.h:58
Payload for DEFTGTS CCC (Define List of Targets).
Definition ccc.h:477
Payload structure for one CCC transaction.
Definition ccc.h:283
Configuration parameters for I3C hardware to act as controller.
Definition i3c.h:478
struct i3c_config_controller::@171175234007106124341357122051356217163277103172 scl_od_min
struct i3c_config_controller::@014075316065214041357310317133027267244366227361 scl_pp_min
Requested minimum SCL Push-Pull clock periods.
uint32_t i3c
SCL frequency (in Hz) for I3C transfers.
Definition i3c.h:487
uint8_t supported_hdr
Bit mask of supported HDR modes (0 - 7).
Definition i3c.h:537
bool is_secondary
True if the controller is to be the secondary controller of the bus.
Definition i3c.h:483
uint32_t i2c
SCL frequency (in Hz) for I2C transfers.
Definition i3c.h:490
uint32_t tcas_ps
Requested tCAS in picoseconds (pure I3C bus).
Definition i3c.h:529
uint32_t low_ns
Requested minimum SCL Open-Drain LOW period in nanoseconds.
Definition i3c.h:506
struct i3c_config_controller::@056135366137020063162136324011126070110331100007 scl
uint32_t high_ns
Requested minimum SCL Open Drain High period in Nanoseconds.
Definition i3c.h:501
Custom I3C configuration parameters.
Definition i3c.h:548
void * ptr
Pointer to configuration parameter.
Definition i3c.h:563
uint32_t id
ID of the configuration parameter.
Definition i3c.h:550
uintptr_t val
Value of configuration parameter.
Definition i3c.h:555
Configuration parameters for I3C hardware to act as target device.
Definition target_device.h:36
Structure for describing attached devices for a controller.
Definition i3c.h:1289
sys_slist_t i3c
Linked list of attached I3C devices.
Definition i3c.h:1305
sys_slist_t i2c
Linked list of attached I2C devices.
Definition i3c.h:1310
struct i3c_addr_slots addr_slots
Address slots:
Definition i3c.h:1296
struct i3c_dev_attached_list::@043171057314352332015067106373053220000327262053 devices
Linked lists of attached I3C and I2C devices.
Structure for describing known devices for a controller.
Definition i3c.h:1322
struct i3c_i2c_device_desc *const i2c
Pointer to array of known I2C devices.
Definition i3c.h:1331
const uint8_t num_i3c
Number of I3C devices in array.
Definition i3c.h:1336
struct i3c_device_desc *const i3c
Pointer to array of known I3C devices.
Definition i3c.h:1326
const uint8_t num_i2c
Number of I2C devices in array.
Definition i3c.h:1341
Structure describing a I3C target device.
Definition i3c.h:1049
uint8_t maxwr
Maximum Write Speed.
Definition i3c.h:1132
const uint8_t init_dynamic_addr
Initial dynamic address.
Definition i3c.h:1084
uint8_t getcap1
I3C v1.1+ GETCAPS1 (I3C_CCC_GETCAPS1_*).
Definition i3c.h:1175
uint8_t static_addr
Static address for this target device.
Definition i3c.h:1073
uint8_t getcap2
GETCAPS2 (I3C_CCC_GETCAPS2_*).
Definition i3c.h:1185
uint8_t crcaps2
CRCAPS2.
Definition i3c.h:1226
uint32_t max_read_turnaround
Maximum Read turnaround time in microseconds.
Definition i3c.h:1135
uint8_t getcap4
GETCAPS4.
Definition i3c.h:1204
uint64_t pid
Device Provisioned ID.
Definition i3c.h:1059
uint8_t max_ibi
Maximum IBI Payload Size.
Definition i3c.h:1149
i3c_target_ibi_cb_t ibi_cb
In-Band Interrupt (IBI) callback.
Definition i3c.h:1241
uint16_t mwl
Maximum Write Length.
Definition i3c.h:1146
uint8_t crhdly1
Controller Handoff Delay Parameters.
Definition i3c.h:1153
uint8_t getcap3
GETCAPS3 (I3C_CCC_GETCAPS3_*).
Definition i3c.h:1198
uint8_t dynamic_addr
Dynamic Address for this target device used for communication.
Definition i3c.h:1108
uint8_t crcaps1
CRCAPS1.
Definition i3c.h:1216
const uint8_t flags
Device Flags.
Definition i3c.h:1093
sys_snode_t node
Definition i3c.h:1050
const struct device * bus
I3C bus to which this target device is attached.
Definition i3c.h:1053
struct i3c_device_desc::@354012327114236120073125301213366107212276207024 getcaps
Describes advanced (Target) capabilities and features.
uint16_t mrl
Maximum Read Length.
Definition i3c.h:1143
uint8_t maxrd
Maximum Read Speed.
Definition i3c.h:1129
struct i3c_device_desc::@025161371003043020356247061065002050371177151366 data_speed
Maximum data speed (GETMXDS CCC).
uint8_t gethdrcap
I3C v1.0 HDR Capabilities (I3C_CCC_GETCAPS1_*).
Definition i3c.h:1165
uint8_t bcr
Bus Characteristic Register (BCR).
Definition i3c.h:1114
uint8_t dcr
Device Characteristic Register (DCR).
Definition i3c.h:1122
const struct device * dev
Device driver instance of the I3C device.
Definition i3c.h:1056
struct i3c_device_desc::@233130030357247267201022070232022115366221343347 crcaps
Describes Controller Feature Capabilities.
struct i3c_device_desc::@171122044300150030070232076155234262120067102161 data_length
Maximum data lengths (GETMXDS CCC).
Structure used for matching I3C devices.
Definition i3c.h:1018
uint64_t pid
Device Provisioned ID.
Definition i3c.h:1020
This structure is common to all I3C drivers and is expected to be the first element in the object poi...
Definition i3c.h:1349
uint8_t primary_controller_da
I3C Primary Controller Dynamic Address.
Definition i3c.h:1355
uint8_t flags
Driver config flags.
Definition i3c.h:1358
struct i3c_dev_list dev_list
I3C/I2C device list struct.
Definition i3c.h:1352
This structure is common to all I3C drivers and is expected to be the first element in the driver's s...
Definition i3c.h:1373
struct i3c_config_controller ctrl_config
Controller Configuration.
Definition i3c.h:1375
struct i3c_ccc_deftgts * deftgts
Received DEFTGTS Pointer.
Definition i3c.h:1381
bool deftgts_refreshed
DEFTGTS refreshed.
Definition i3c.h:1384
struct i3c_dev_attached_list attached_dev
Attached I3C/I2C devices and addresses.
Definition i3c.h:1378
Structure describing a I2C device on I3C bus.
Definition i3c.h:1258
const struct device * bus
I3C bus to which this I2C device is attached.
Definition i3c.h:1262
uint8_t lvr
Legacy Virtual Register (LVR).
Definition i3c.h:1271
uint16_t addr
Static address for this I2C device.
Definition i3c.h:1265
sys_snode_t node
Definition i3c.h:1259
Struct for IBI request.
Definition ibi.h:58
Definition i3c.h:3178
const struct device * bus
Definition i3c.h:3179
const struct i3c_device_id dev_id
Definition i3c.h:3180
One I3C Message.
Definition i3c.h:425
uint8_t flags
Flags for this message.
Definition i3c.h:450
uint8_t hdr_mode
HDR mode (I3C_MSG_HDR_MODE*) for transfer if any I3C_MSG_HDR_* is set in flags.
Definition i3c.h:458
uint32_t num_xfer
Total number of bytes transferred.
Definition i3c.h:439
uint8_t * buf
Data buffer in bytes.
Definition i3c.h:427
uint8_t hdr_cmd_code
HDR command code field (7-bit) for HDR-DDR, HDR-TSP and HDR-TSL.
Definition i3c.h:461
uint32_t len
Length of buffer in bytes.
Definition i3c.h:430
enum i3c_sdr_controller_error_types err
SDR Error Type.
Definition i3c.h:447
Structure describing a device that supports the I3C target API.
Definition target_device.h:101
A structure used to submit work.
Definition kernel.h:4913
API that an RTIO IO device should implement.
Definition iodev.h:38
IO device submission queue entry.
Definition sqe.h:468
struct rtio_sqe sqe
The submission queue entry this wraps.
Definition sqe.h:470
An IO device with a function table for submitting requests.
Definition iodev.h:83
void * data
Data associated with this iodev.
Definition iodev.h:88
A submission queue event.
Definition sqe.h:346
const struct rtio_iodev * iodev
Device to operation on.
Definition sqe.h:355
An RTIO context containing what can be viewed as a pair of queues.
Definition rtio.h:85
Misc utilities.