Zephyr Project API 4.4.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
93
100#define I3C_BCR_MAX_DATA_SPEED_LIMIT BIT(0)
101
103#define I3C_BCR_IBI_REQUEST_CAPABLE BIT(1)
104
112#define I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE BIT(2)
113
120#define I3C_BCR_OFFLINE_CAPABLE BIT(3)
121
128#define I3C_BCR_VIRTUAL_TARGET BIT(4)
129
137#define I3C_BCR_ADV_CAPABILITIES BIT(5)
138
140#define I3C_BCR_DEVICE_ROLE_I3C_TARGET 0U
141
143#define I3C_BCR_DEVICE_ROLE_I3C_CONTROLLER_CAPABLE 1U
144
146#define I3C_BCR_DEVICE_ROLE_MASK GENMASK(7U, 6U)
147
155#define I3C_BCR_DEVICE_ROLE(bcr) \
156 FIELD_GET(I3C_BCR_DEVICE_ROLE_MASK, (bcr))
157
159
179
181#define I3C_LVR_I2C_FM_PLUS_MODE 0
182
184#define I3C_LVR_I2C_FM_MODE 1
185
187#define I3C_LVR_I2C_MODE_MASK BIT(4)
188
196#define I3C_LVR_I2C_MODE(lvr) \
197 FIELD_GET(I3C_LVR_I2C_MODE_MASK, (lvr))
198
205#define I3C_LVR_I2C_DEV_IDX_0 0
206
213#define I3C_LVR_I2C_DEV_IDX_1 1
214
221#define I3C_LVR_I2C_DEV_IDX_2 2
222
224#define I3C_LVR_I2C_DEV_IDX_MASK GENMASK(7U, 5U)
225
233#define I3C_LVR_I2C_DEV_IDX(lvr) \
234 FIELD_GET(I3C_LVR_I2C_DEV_IDX_MASK, (lvr))
235
237
268
284
309
315
316/*
317 * I3C_MSG_* are I3C Message flags.
318 */
319
321#define I3C_MSG_WRITE (0U << 0U)
322
324#define I3C_MSG_READ BIT(0)
325
327#define I3C_MSG_RW_MASK BIT(0)
329
331#define I3C_MSG_STOP BIT(1)
332
342#define I3C_MSG_RESTART BIT(2)
343
345#define I3C_MSG_HDR BIT(3)
346
348#define I3C_MSG_NBCH BIT(4)
349
351#define I3C_MSG_NOACK_EXPECTED BIT(5)
352
354#define I3C_MSG_HDR_MODE0 BIT(0)
355
357#define I3C_MSG_HDR_MODE1 BIT(1)
358
360#define I3C_MSG_HDR_MODE2 BIT(2)
361
363#define I3C_MSG_HDR_MODE3 BIT(3)
364
366#define I3C_MSG_HDR_MODE4 BIT(4)
367
369#define I3C_MSG_HDR_MODE5 BIT(5)
370
372#define I3C_MSG_HDR_MODE6 BIT(6)
373
375#define I3C_MSG_HDR_MODE7 BIT(7)
376
378#define I3C_MSG_HDR_DDR I3C_MSG_HDR_MODE0
379
381#define I3C_MSG_HDR_TSP I3C_MSG_HDR_MODE1
382
384#define I3C_MSG_HDR_TSL I3C_MSG_HDR_MODE2
385
387#define I3C_MSG_HDR_BT I3C_MSG_HDR_MODE3
388
390
395
448
450
459
502
514
515 union {
518
525 void *ptr;
526 };
527};
528
536typedef void (*i3c_callback_t)(const struct device *dev, int result, void *data);
537
544struct i3c_device_desc;
545struct i3c_device_id;
547struct i3c_target_config;
548struct i3c_config_target;
549
550__subsystem struct i3c_driver_api {
560 struct i2c_driver_api i2c_api;
561
574 int (*configure)(const struct device *dev,
575 enum i3c_config_type type, void *config);
576
589 int (*config_get)(const struct device *dev,
590 enum i3c_config_type type, void *config);
591#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
604 int (*recover_bus)(const struct device *dev);
605
619 int (*attach_i3c_device)(const struct device *dev,
620 struct i3c_device_desc *target);
621
636 int (*reattach_i3c_device)(const struct device *dev,
637 struct i3c_device_desc *target,
638 uint8_t old_dyn_addr);
639
653 int (*detach_i3c_device)(const struct device *dev,
654 struct i3c_device_desc *target);
655
669 int (*attach_i2c_device)(const struct device *dev,
670 struct i3c_i2c_device_desc *target);
671
685 int (*detach_i2c_device)(const struct device *dev,
686 struct i3c_i2c_device_desc *target);
687
700 int (*do_daa)(const struct device *dev);
701
715 int (*do_ccc)(const struct device *dev,
716 struct i3c_ccc_payload *payload);
717
731 int (*i3c_xfers)(const struct device *dev,
732 struct i3c_device_desc *target,
733 struct i3c_msg *msgs,
734 uint8_t num_msgs);
735#if defined(CONFIG_I3C_CALLBACK) || defined(__DOXYGEN__)
751 int (*do_ccc_cb)(const struct device *dev,
752 struct i3c_ccc_payload *payload,
754 void *userdata);
755
771 int (*i3c_xfers_cb)(const struct device *dev,
772 struct i3c_device_desc *target,
773 struct i3c_msg *msgs,
774 uint8_t num_msgs,
776 void *userdata);
777#endif /* CONFIG_I3C_CALLBACK */
793 struct i3c_device_desc *(*i3c_device_find)(const struct device *dev,
794 const struct i3c_device_id *id);
795#endif /* CONFIG_I3C_CONTROLLER */
796#if defined(CONFIG_I3C_USE_IBI) || defined(__DOXYGEN__)
797#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
811 int (*ibi_raise)(const struct device *dev,
812 struct i3c_ibi *request);
813#endif /* CONFIG_I3C_TARGET */
814#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
826 int (*ibi_hj_response)(const struct device *dev,
827 bool ack);
828
840 int (*ibi_crr_response)(struct i3c_device_desc *target,
841 bool ack);
842
856 int (*ibi_enable)(const struct device *dev,
857 struct i3c_device_desc *target);
858
872 int (*ibi_disable)(const struct device *dev,
873 struct i3c_device_desc *target);
874#endif /* CONFIG_I3C_CONTROLLER */
875#endif /* CONFIG_I3C_USE_IBI */
876#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
893 int (*target_register)(const struct device *dev,
894 struct i3c_target_config *cfg);
895
912 int (*target_unregister)(const struct device *dev,
913 struct i3c_target_config *cfg);
914
932 int (*target_tx_write)(const struct device *dev,
933 uint8_t *buf, uint16_t len, uint8_t hdr_mode);
934
951 int (*target_controller_handoff)(const struct device *dev,
952 bool accept);
953#endif /* CONFIG_I3C_TARGET */
954#if defined(CONFIG_I3C_RTIO) || defined(__DOXYGEN__)
966 void (*iodev_submit)(const struct device *dev,
967 struct rtio_iodev_sqe *iodev_sqe);
968#endif /* CONFIG_I3C_RTIO */
969};
970
971DEVICE_API_EXTENDS(i3c, i2c, i2c_api);
972
976
983};
984
993#define I3C_DEVICE_ID(pid) \
994 { \
995 .pid = pid \
996 }
997
1016
1018 const struct device *bus;
1019
1021 const struct device *dev;
1022
1025
1039
1050
1059
1074
1080
1088
1089 struct {
1092
1095
1099
1100 struct {
1103
1106
1110
1113
1115 struct {
1116 union {
1125
1135 };
1136
1145
1158
1165
1166 /* Describes Controller Feature Capabilities */
1167 struct {
1176
1187
1192 void *controller_priv;
1194
1195#if defined(CONFIG_I3C_USE_IBI) || defined(__DOXYGEN__)
1201#endif /* CONFIG_I3C_USE_IBI */
1202};
1203
1219
1221 const struct device *bus;
1222
1225
1231
1236 void *controller_priv;
1238};
1239
1269
1282 struct i3c_device_desc * const i3c;
1283
1287 struct i3c_i2c_device_desc * const i2c;
1288
1293
1298};
1299
1306#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1309
1312
1315#elif defined(CONFIG_CPP)
1316 /* Empty struct has size 0 in C, size 1 in C++. Force them to be the same. */
1317 uint8_t unused_cpp_size_compatibility;
1318#endif
1319};
1320
1321#if defined(CONFIG_CPP)
1322BUILD_ASSERT(sizeof(struct i3c_driver_config) >= 1);
1323#endif
1324
1332#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1335#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
1338
1341#endif /* CONFIG_I3C_TARGET */
1342#endif /* CONFIG_I3C_CONTROLLER */
1343};
1344
1345#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1355#define I3C_BUS_FOR_EACH_I3CDEV(bus, desc) \
1356 SYS_SLIST_FOR_EACH_CONTAINER( \
1357 &((struct i3c_driver_data *)(bus->data))->attached_dev.devices.i3c, desc, node)
1358
1368#define I3C_BUS_FOR_EACH_I2CDEV(bus, desc) \
1369 SYS_SLIST_FOR_EACH_CONTAINER( \
1370 &((struct i3c_driver_data *)(bus->data))->attached_dev.devices.i2c, desc, node)
1371
1382#define I3C_BUS_FOR_EACH_I3CDEV_SAFE(bus, desc, desc_s) \
1383 SYS_SLIST_FOR_EACH_CONTAINER_SAFE( \
1384 &((struct i3c_driver_data *)(bus->data))->attached_dev.devices.i3c, desc, desc_s, \
1385 node)
1386
1397#define I3C_BUS_FOR_EACH_I2CDEV_SAFE(bus, desc, desc_s) \
1398 SYS_SLIST_FOR_EACH_CONTAINER_SAFE( \
1399 &((struct i3c_driver_data *)(bus->data))->attached_dev.devices.i2c, desc, desc_s, \
1400 node)
1401
1416struct i3c_device_desc *i3c_dev_list_find(const struct i3c_dev_list *dev_list,
1417 const struct i3c_device_id *id);
1418
1434 uint8_t addr);
1435
1451 uint8_t addr);
1452
1468 uint16_t addr);
1469
1523 uint64_t pid, bool must_match,
1524 bool assigned_okay,
1525 struct i3c_device_desc **target,
1526 uint8_t *addr);
1527#endif /* CONFIG_I3C_CONTROLLER */
1528
1542static inline int i3c_configure(const struct device *dev,
1543 enum i3c_config_type type, void *config)
1544{
1545 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
1546
1547 if (api->configure == NULL) {
1548 return -ENOSYS;
1549 }
1550
1551 return api->configure(dev, type, config);
1552}
1553
1554#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1572static inline int i3c_configure_controller(const struct device *dev,
1573 struct i3c_config_controller *config)
1574{
1575 return i3c_configure(dev, I3C_CONFIG_CONTROLLER, config);
1576}
1577#endif /* CONFIG_I3C_CONTROLLER */
1578
1579#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
1597static inline int i3c_configure_target(const struct device *dev,
1598 struct i3c_config_target *config)
1599{
1600 return i3c_configure(dev, I3C_CONFIG_TARGET, config);
1601}
1602#endif /* CONFIG_I3C_TARGET */
1603
1624static inline int i3c_config_get(const struct device *dev,
1625 enum i3c_config_type type, void *config)
1626{
1627 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
1628
1629 if (api->config_get == NULL) {
1630 return -ENOSYS;
1631 }
1632
1633 return api->config_get(dev, type, config);
1634}
1635
1636#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1654static inline int i3c_config_get_controller(const struct device *dev,
1655 struct i3c_config_controller *config)
1656{
1657 return i3c_config_get(dev, I3C_CONFIG_CONTROLLER, config);
1658}
1659#endif /* CONFIG_I3C_CONTROLLER */
1660
1661#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
1679static inline int i3c_config_get_target(const struct device *dev,
1680 struct i3c_config_target *config)
1681{
1682 return i3c_config_get(dev, I3C_CONFIG_TARGET, config);
1683}
1684#endif /* CONFIG_I3C_TARGET */
1685
1686#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
1699static inline int i3c_recover_bus(const struct device *dev)
1700{
1701 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
1702
1703 if (api->recover_bus == NULL) {
1704 return -ENOSYS;
1705 }
1706
1707 return api->recover_bus(dev);
1708}
1709
1732
1759int i3c_reattach_i3c_device(struct i3c_device_desc *target, uint8_t old_dyn_addr);
1760
1783
1797static inline bool i3c_is_i3c_device_attached(struct i3c_device_desc *target)
1798{
1799 struct i3c_device_desc *desc;
1800
1801 I3C_BUS_FOR_EACH_I3CDEV(target->bus, desc) {
1802 if (desc == target) {
1803 return true;
1804 }
1805 }
1806 return false;
1807}
1808
1830
1851
1863static inline bool i3c_is_i2c_device_attached(struct i3c_i2c_device_desc *target)
1864{
1865 struct i3c_i2c_device_desc *desc;
1866
1867 I3C_BUS_FOR_EACH_I2CDEV(target->bus, desc) {
1868 if (desc == target) {
1869 return true;
1870 }
1871 }
1872 return false;
1873}
1874
1900static inline int i3c_do_daa(const struct device *dev)
1901{
1902 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
1903
1904 if (api->do_daa == NULL) {
1905 return -ENOSYS;
1906 }
1907
1908 return api->do_daa(dev);
1909}
1910
1926__syscall int i3c_do_ccc(const struct device *dev,
1927 struct i3c_ccc_payload *payload);
1928
1929static inline int z_impl_i3c_do_ccc(const struct device *dev,
1930 struct i3c_ccc_payload *payload)
1931{
1932 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
1933
1934 if (api->do_ccc == NULL) {
1935 return -ENOSYS;
1936 }
1937
1938 return api->do_ccc(dev, payload);
1939}
1940
1941#if defined(CONFIG_I3C_CALLBACK) || defined(__DOXYGEN__)
1964__syscall int i3c_do_ccc_cb(const struct device *dev,
1965 struct i3c_ccc_payload *payload,
1966 i3c_callback_t cb,
1967 void *userdata);
1968
1969static inline int z_impl_i3c_do_ccc_cb(const struct device *dev,
1970 struct i3c_ccc_payload *payload,
1971 i3c_callback_t cb,
1972 void *userdata)
1973{
1974 const struct i3c_driver_api *api =
1975 (const struct i3c_driver_api *)dev->api;
1976
1977 if (api->do_ccc_cb == NULL) {
1978 return -ENOSYS;
1979 }
1980
1981 return api->do_ccc_cb(dev, payload, cb, userdata);
1982}
1983#endif /* CONFIG_I3C_CALLBACK */
1984
1989
2020__syscall int i3c_transfer(struct i3c_device_desc *target,
2021 struct i3c_msg *msgs, uint8_t num_msgs);
2022
2023static inline int z_impl_i3c_transfer(struct i3c_device_desc *target,
2024 struct i3c_msg *msgs, uint8_t num_msgs)
2025{
2026 return DEVICE_API_GET(i3c, target->bus)->i3c_xfers(target->bus, target, msgs, num_msgs);
2027}
2028
2029#if defined(CONFIG_I3C_CALLBACK) || defined(__DOXYGEN__)
2060__syscall int i3c_transfer_cb(struct i3c_device_desc *target,
2061 struct i3c_msg *msgs,
2062 uint8_t num_msgs,
2063 i3c_callback_t cb,
2064 void *userdata);
2065
2066static inline int z_impl_i3c_transfer_cb(struct i3c_device_desc *target,
2067 struct i3c_msg *msgs,
2068 uint8_t num_msgs,
2069 i3c_callback_t cb,
2070 void *userdata)
2071{
2072 const struct i3c_driver_api *api = (const struct i3c_driver_api *)target->bus->api;
2073
2074 if (api->i3c_xfers_cb == NULL) {
2075 return -ENOSYS;
2076 }
2077
2078 return api->i3c_xfers_cb(target->bus, target, msgs, num_msgs, cb, userdata);
2079}
2080#endif /* CONFIG_I3C_CALLBACK */
2081
2083
2100static inline
2102 const struct i3c_device_id *id)
2103{
2104 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
2105
2106 if (api->i3c_device_find == NULL) {
2107 return NULL;
2108 }
2109
2110 return api->i3c_device_find(dev, id);
2111}
2112#endif /* CONFIG_I3C_CONTROLLER */
2113
2114#if defined(CONFIG_I3C_USE_IBI) || defined(__DOXYGEN__)
2119
2120#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
2135static inline int i3c_ibi_hj_response(const struct device *dev,
2136 bool ack)
2137{
2138 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
2139
2140 if (api->ibi_hj_response == NULL) {
2141 return -ENOSYS;
2142 }
2143
2144 return api->ibi_hj_response(dev, ack);
2145}
2146
2161static inline int i3c_ibi_crr_response(struct i3c_device_desc *target,
2162 bool ack)
2163{
2164 const struct i3c_driver_api *api =
2165 (const struct i3c_driver_api *)target->bus->api;
2166
2167 if (api->ibi_crr_response == NULL) {
2168 return -ENOSYS;
2169 }
2170
2171 return api->ibi_crr_response(target, ack);
2172}
2173#endif /* CONFIG_I3C_CONTROLLER */
2174
2175#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
2189static inline int i3c_ibi_raise(const struct device *dev,
2190 struct i3c_ibi *request)
2191{
2192 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, dev);
2193
2194 if (api->ibi_raise == NULL) {
2195 return -ENOSYS;
2196 }
2197
2198 return api->ibi_raise(dev, request);
2199}
2200#endif /* CONFIG_I3C_TARGET */
2201
2202#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
2219static inline int i3c_ibi_enable(struct i3c_device_desc *target)
2220{
2221 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, target->bus);
2222
2223 if (api->ibi_enable == NULL) {
2224 return -ENOSYS;
2225 }
2226
2227 return api->ibi_enable(target->bus, target);
2228}
2229
2244static inline int i3c_ibi_disable(struct i3c_device_desc *target)
2245{
2246 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, target->bus);
2247
2248 if (api->ibi_disable == NULL) {
2249 return -ENOSYS;
2250 }
2251
2252 return api->ibi_disable(target->bus, target);
2253}
2254#endif /* CONFIG_I3C_CONTROLLER */
2255#endif /* CONFIG_I3C_USE_IBI */
2256
2268static inline int i3c_ibi_has_payload(struct i3c_device_desc *target)
2269{
2270 return (target->bcr & I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE)
2272}
2273
2285static inline int i3c_device_is_ibi_capable(struct i3c_device_desc *target)
2286{
2287 return (target->bcr & I3C_BCR_IBI_REQUEST_CAPABLE)
2289}
2290
2302static inline int i3c_device_is_controller_capable(struct i3c_device_desc *target)
2303{
2304 return I3C_BCR_DEVICE_ROLE(target->bcr)
2306}
2307
2309
2310#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
2315
2331static inline int i3c_write(struct i3c_device_desc *target,
2332 const uint8_t *buf, uint32_t num_bytes)
2333{
2334 struct i3c_msg msg;
2335
2336 msg.buf = (uint8_t *)buf;
2337 msg.len = num_bytes;
2339 msg.hdr_mode = 0;
2340 msg.hdr_cmd_code = 0;
2341
2342 return i3c_transfer(target, &msg, 1);
2343}
2344
2360static inline int i3c_read(struct i3c_device_desc *target,
2361 uint8_t *buf, uint32_t num_bytes)
2362{
2363 struct i3c_msg msg;
2364
2365 msg.buf = buf;
2366 msg.len = num_bytes;
2368 msg.hdr_mode = 0;
2369 msg.hdr_cmd_code = 0;
2370
2371 return i3c_transfer(target, &msg, 1);
2372}
2373
2393static inline int i3c_write_read(struct i3c_device_desc *target,
2394 const void *write_buf, size_t num_write,
2395 void *read_buf, size_t num_read)
2396{
2397 struct i3c_msg msg[2];
2398
2399 msg[0].buf = (uint8_t *)write_buf;
2400 msg[0].len = num_write;
2401 msg[0].flags = I3C_MSG_WRITE;
2402 msg[0].hdr_mode = 0;
2403 msg[0].hdr_cmd_code = 0;
2404
2405 msg[1].buf = (uint8_t *)read_buf;
2406 msg[1].len = num_read;
2408 msg[1].hdr_mode = 0;
2409 msg[1].hdr_cmd_code = 0;
2410
2411 return i3c_transfer(target, msg, 2);
2412}
2413
2433static inline int i3c_burst_read(struct i3c_device_desc *target,
2434 uint8_t start_addr,
2435 uint8_t *buf,
2436 uint32_t num_bytes)
2437{
2438 return i3c_write_read(target,
2439 &start_addr, sizeof(start_addr),
2440 buf, num_bytes);
2441}
2442
2465static inline int i3c_burst_write(struct i3c_device_desc *target,
2466 uint8_t start_addr,
2467 const uint8_t *buf,
2468 uint32_t num_bytes)
2469{
2470 struct i3c_msg msg[2];
2471
2472 msg[0].buf = &start_addr;
2473 msg[0].len = 1U;
2474 msg[0].flags = I3C_MSG_WRITE;
2475 msg[0].hdr_mode = 0;
2476 msg[0].hdr_cmd_code = 0;
2477
2478 msg[1].buf = (uint8_t *)buf;
2479 msg[1].len = num_bytes;
2480 msg[1].flags = I3C_MSG_WRITE | I3C_MSG_STOP;
2481 msg[1].hdr_mode = 0;
2482 msg[1].hdr_cmd_code = 0;
2483
2484 return i3c_transfer(target, msg, 2);
2485}
2486
2503static inline int i3c_reg_read_byte(struct i3c_device_desc *target,
2504 uint8_t reg_addr, uint8_t *value)
2505{
2506 return i3c_write_read(target,
2507 &reg_addr, sizeof(reg_addr),
2508 value, sizeof(*value));
2509}
2510
2530static inline int i3c_reg_write_byte(struct i3c_device_desc *target,
2531 uint8_t reg_addr, uint8_t value)
2532{
2533 uint8_t tx_buf[2] = {reg_addr, value};
2534
2535 return i3c_write(target, tx_buf, 2);
2536}
2537
2558static inline int i3c_reg_update_byte(struct i3c_device_desc *target,
2559 uint8_t reg_addr, uint8_t mask,
2560 uint8_t value)
2561{
2562 uint8_t old_value, new_value;
2563 int rc;
2564
2565 rc = i3c_reg_read_byte(target, reg_addr, &old_value);
2566 if (rc != 0) {
2567 return rc;
2568 }
2569
2570 new_value = (old_value & ~mask) | (value & mask);
2571 if (new_value == old_value) {
2572 return 0;
2573 }
2574
2575 return i3c_reg_write_byte(target, reg_addr, new_value);
2576}
2577
2604void i3c_dump_msgs(const char *name, const struct i3c_msg *msgs,
2605 uint8_t num_msgs, struct i3c_device_desc *target);
2606
2608
2626int i3c_bus_init(const struct device *dev,
2627 const struct i3c_dev_list *i3c_dev_list);
2628
2649
2675
2699static inline int i3c_device_info_get(struct i3c_device_desc *target)
2700{
2701 int rc;
2702
2703 rc = i3c_device_basic_info_get(target);
2704 if (rc != 0) {
2705 return rc;
2706 }
2707
2708 return i3c_device_adv_info_get(target);
2709}
2710
2723enum i3c_bus_mode i3c_bus_mode(const struct i3c_dev_list *dev_list);
2724
2737bool i3c_bus_has_sec_controller(const struct device *dev);
2738
2751int i3c_bus_rstdaa_all(const struct device *dev);
2752
2767int i3c_bus_setdasa(struct i3c_device_desc *desc, uint8_t dynamic_addr);
2768
2783int i3c_bus_setnewda(struct i3c_device_desc *desc, uint8_t dynamic_addr);
2784
2797int i3c_bus_setaasa(const struct device *dev);
2798
2812
2826
2840
2854
2868
2883int i3c_bus_setmrl(struct i3c_device_desc *desc, uint16_t mrl, uint8_t ibi_len);
2884
2899
2915int i3c_bus_setmrl_all(const struct device *dev, uint16_t mrl, uint8_t ibi_len, bool has_ibi_size);
2916
2930int i3c_bus_setmwl_all(const struct device *dev, uint16_t mwl);
2931
2932#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
2946
2960int i3c_bus_deftgts(const struct device *dev);
2961#endif /* CONFIG_I3C_TARGET */
2962
2975
2992int i3c_device_controller_handoff(struct i3c_device_desc *target, bool requested);
2993#endif /* CONFIG_I3C_CONTROLLER */
2994
2995#if defined(CONFIG_I3C_USE_IBI) || defined(__DOXYGEN__)
2996#if (defined(CONFIG_I3C_CONTROLLER) && defined(CONFIG_I3C_TARGET)) || defined(__DOXYGEN__)
3010void i3c_sec_handoffed(struct k_work *work);
3011#endif /* CONFIG_I3C_CONTROLLER && CONFIG_I3C_TARGET */
3012#endif /* CONFIG_I3C_USE_IBI */
3013
3014#if (defined(CONFIG_I3C_NUM_OF_DESC_MEM_SLABS) && CONFIG_I3C_NUM_OF_DESC_MEM_SLABS > 0) || \
3015 defined(__DOXYGEN__)
3016
3028
3039
3052
3053#else
3054
3055static inline struct i3c_device_desc *i3c_device_desc_alloc(void)
3056{
3057 return NULL;
3058}
3059
3060static inline void i3c_device_desc_free(struct i3c_device_desc *desc)
3061{
3062 ARG_UNUSED(desc);
3063}
3064
3065static inline bool i3c_device_desc_in_pool(struct i3c_device_desc *desc)
3066{
3067 ARG_UNUSED(desc);
3068 return false;
3069}
3070
3071#endif /* CONFIG_I3C_NUM_OF_DESC_MEM_SLABS > 0 */
3072
3073#if (defined(CONFIG_I3C_I2C_NUM_OF_DESC_MEM_SLABS) && CONFIG_I3C_I2C_NUM_OF_DESC_MEM_SLABS > 0) || \
3074 defined(__DOXYGEN__)
3075
3087
3098
3111
3112#else
3113
3114static inline struct i3c_i2c_device_desc *i3c_i2c_device_desc_alloc(void)
3115{
3116 return NULL;
3117}
3118
3119static inline void i3c_i2c_device_desc_free(struct i3c_i2c_device_desc *desc)
3120{
3121 ARG_UNUSED(desc);
3122}
3123
3124static inline bool i3c_i2c_device_desc_in_pool(struct i3c_i2c_device_desc *desc)
3125{
3126 ARG_UNUSED(desc);
3127 return false;
3128}
3129
3130#endif /* CONFIG_I3C_I2C_NUM_OF_DESC_MEM_SLABS > 0 */
3131
3132#if defined(CONFIG_I3C_RTIO) || defined(__DOXYGEN__)
3133
3135 const struct device *bus;
3136 const struct i3c_device_id dev_id;
3137};
3138
3151void i3c_iodev_submit_fallback(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe);
3152
3161static inline void i3c_iodev_submit(struct rtio_iodev_sqe *iodev_sqe)
3162{
3163 const struct i3c_iodev_data *data =
3164 (const struct i3c_iodev_data *)iodev_sqe->sqe.iodev->data;
3165 const struct i3c_driver_api *api = DEVICE_API_GET(i3c, data->bus);
3166
3167 if (api->iodev_submit == NULL) {
3168 rtio_iodev_sqe_err(iodev_sqe, -ENOSYS);
3169 return;
3170 }
3171 api->iodev_submit(data->bus, iodev_sqe);
3172}
3173
3174extern const struct rtio_iodev_api i3c_iodev_api;
3175
3187#define I3C_DT_IODEV_DEFINE(name, node_id) \
3188 const struct i3c_iodev_data _i3c_iodev_data_##name = { \
3189 .bus = DEVICE_DT_GET(DT_BUS(node_id)), \
3190 .dev_id = I3C_DEVICE_ID_DT(node_id), \
3191 }; \
3192 RTIO_IODEV_DEFINE(name, &i3c_iodev_api, (void *)&_i3c_iodev_data_##name)
3193
3205#define I3C_DT_INST_IODEV_DEFINE(name, inst) \
3206 I3C_DT_IODEV_DEFINE(name, DT_DRV_INST(inst))
3207
3222 struct rtio_iodev *iodev,
3223 const struct i3c_msg *msgs,
3224 uint8_t num_msgs);
3225
3226#endif /* CONFIG_I3C_RTIO */
3227
3228#if defined(CONFIG_I3C_TARGET) || defined(__DOXYGEN__)
3229/*
3230 * This needs to be after declaration of struct i3c_driver_api,
3231 * or else compiler complains about undefined type inside
3232 * the static inline API wrappers.
3233 */
3235#endif /* CONFIG_I3C_TARGET */
3236
3237#if defined(CONFIG_I3C_CONTROLLER) || defined(__DOXYGEN__)
3238/*
3239 * Include High-Data-Rate (HDR) inline helper functions
3240 */
3242#endif /* CONFIG_I3C_CONTROLLER */
3243
3244#ifdef __cplusplus
3245}
3246#endif
3247
3251
3252#include <zephyr/syscalls/i3c.h>
3253
3254#endif /* ZEPHYR_INCLUDE_DRIVERS_I3C_H_ */
workaround assembler barfing for ST r
Definition asm-macro-32-bit-gnu.h:27
#define DEVICE_API_EXTENDS(_child, _parent, _member)
Declare that API class _child is an extension of device API class _parent.
Definition device.h:1414
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1449
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:2244
static int i3c_ibi_has_payload(struct i3c_device_desc *target)
Check if target's IBI has payload.
Definition i3c.h:2268
static int i3c_ibi_crr_response(struct i3c_device_desc *target, bool ack)
ACK or NACK IBI Controller Role Requests.
Definition i3c.h:2161
static int i3c_ibi_raise(const struct device *dev, struct i3c_ibi *request)
Raise an In-Band Interrupt (IBI).
Definition i3c.h:2189
static int i3c_device_is_controller_capable(struct i3c_device_desc *target)
Check if the target is controller capable.
Definition i3c.h:2302
static int i3c_device_is_ibi_capable(struct i3c_device_desc *target)
Check if device is IBI capable.
Definition i3c.h:2285
static int i3c_ibi_enable(struct i3c_device_desc *target)
Enable IBI of a target device.
Definition i3c.h:2219
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:2135
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:103
#define I3C_BCR_DEVICE_ROLE_I3C_CONTROLLER_CAPABLE
Device Role - I3C Controller Capable.
Definition i3c.h:143
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:2101
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:1542
static int i3c_device_info_get(struct i3c_device_desc *target)
Get all information from device and update device descriptor.
Definition i3c.h:2699
static void i3c_iodev_submit(struct rtio_iodev_sqe *iodev_sqe)
Submit request(s) to an I3C device with RTIO.
Definition i3c.h:3161
#define I3C_BUS_FOR_EACH_I3CDEV(bus, desc)
iterate over all I3C devices present on the bus
Definition i3c.h:1355
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:1368
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:1863
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:454
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:274
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:241
static int i3c_recover_bus(const struct device *dev)
Attempt bus recovery on the I3C bus.
Definition i3c.h:1699
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:1597
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:1624
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:1679
#define I3C_BCR_DEVICE_ROLE(bcr)
Device Role.
Definition i3c.h:155
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:1654
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:1900
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:1797
void(* i3c_callback_t)(const struct device *dev, int result, void *data)
I3C callback for asynchronous transfer requests.
Definition i3c.h:536
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:112
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:290
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:1572
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:456
@ I3C_CONFIG_CUSTOM
Definition i3c.h:457
@ I3C_CONFIG_CONTROLLER
Definition i3c.h:455
@ I3C_I2C_SPEED_INVALID
Definition i3c.h:282
@ I3C_I2C_SPEED_MAX
Definition i3c.h:281
@ I3C_I2C_SPEED_FMPLUS
I2C FM+ mode.
Definition i3c.h:279
@ I3C_I2C_SPEED_FM
I2C FM mode.
Definition i3c.h:276
@ I3C_BUS_MODE_INVALID
Definition i3c.h:266
@ I3C_BUS_MODE_PURE
Only I3C devices are on the bus.
Definition i3c.h:243
@ I3C_BUS_MODE_MIXED_FAST
Both I3C and legacy I2C devices are on the bus.
Definition i3c.h:249
@ I3C_BUS_MODE_MAX
Definition i3c.h:265
@ I3C_BUS_MODE_MIXED_LIMITED
Both I3C and legacy I2C devices are on the bus.
Definition i3c.h:256
@ I3C_BUS_MODE_MIXED_SLOW
Both I3C and legacy I2C devices are on the bus.
Definition i3c.h:263
@ I3C_DATA_RATE_MAX
Definition i3c.h:306
@ I3C_DATA_RATE_INVALID
Definition i3c.h:307
@ I3C_DATA_RATE_HDR_TSP
High Data Rate - Ternary Symbol for Pure Bus.
Definition i3c.h:301
@ I3C_DATA_RATE_HDR_DDR
High Data Rate - Double Data Rate messaging.
Definition i3c.h:295
@ I3C_DATA_RATE_SDR
Single Data Rate messaging.
Definition i3c.h:292
@ I3C_DATA_RATE_HDR_TSL
High Data Rate - Ternary Symbol Legacy-inclusive-Bus.
Definition i3c.h:298
@ I3C_DATA_RATE_HDR_BT
High Data Rate - Bulk Transport.
Definition i3c.h:304
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:331
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:2393
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:2433
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:2558
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:324
#define I3C_MSG_WRITE
Write message to I3C bus.
Definition i3c.h:321
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:2503
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:2331
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:2360
#define I3C_MSG_RESTART
RESTART I3C transaction for this message.
Definition i3c.h:342
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:2465
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:2530
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:680
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
#define NULL
Definition iar_missing_defs.h:20
#define BUILD_ASSERT(EXPR, MSG...)
Definition llvm.h:51
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:513
void * data
Address of the device instance private data.
Definition device.h:523
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:519
@driver_ops{I2C}
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:463
uint32_t i3c
SCL frequency (in Hz) for I3C transfers.
Definition i3c.h:472
struct i3c_config_controller::@056312167321110215131324331046307064213325032241 scl
uint8_t supported_hdr
Bit mask of supported HDR modes (0 - 7).
Definition i3c.h:500
bool is_secondary
True if the controller is to be the secondary controller of the bus.
Definition i3c.h:468
uint32_t i2c
SCL frequency (in Hz) for I2C transfers.
Definition i3c.h:475
uint32_t low_ns
Requested minimum SCL Open-Drain LOW period in nanoseconds.
Definition i3c.h:491
struct i3c_config_controller::@014133034363263145217364064144071146332207047032 scl_od_min
uint32_t high_ns
Requested minimum SCL Open Drain High period in Nanoseconds.
Definition i3c.h:486
Custom I3C configuration parameters.
Definition i3c.h:511
void * ptr
Pointer to configuration parameter.
Definition i3c.h:525
uint32_t id
ID of the configuration parameter.
Definition i3c.h:513
uintptr_t val
Value of configuration parameter.
Definition i3c.h:517
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:1248
sys_slist_t i3c
Linked list of attached I3C devices.
Definition i3c.h:1261
sys_slist_t i2c
Linked list of attached I2C devices.
Definition i3c.h:1266
struct i3c_addr_slots addr_slots
Address slots:
Definition i3c.h:1255
struct i3c_dev_attached_list::@246250351113353101101072335153134170037123023325 devices
Structure for describing known devices for a controller.
Definition i3c.h:1278
struct i3c_i2c_device_desc *const i2c
Pointer to array of known I2C devices.
Definition i3c.h:1287
const uint8_t num_i3c
Number of I3C devices in array.
Definition i3c.h:1292
struct i3c_device_desc *const i3c
Pointer to array of known I3C devices.
Definition i3c.h:1282
const uint8_t num_i2c
Number of I2C devices in array.
Definition i3c.h:1297
Structure describing a I3C target device.
Definition i3c.h:1014
uint8_t maxwr
Maximum Write Speed.
Definition i3c.h:1094
const uint8_t init_dynamic_addr
Initial dynamic address.
Definition i3c.h:1049
uint8_t getcap1
I3C v1.1+ GETCAPS1 (I3C_CCC_GETCAPS1_*).
Definition i3c.h:1134
uint8_t static_addr
Static address for this target device.
Definition i3c.h:1038
uint8_t getcap2
GETCAPS2 (I3C_CCC_GETCAPS2_*).
Definition i3c.h:1144
uint8_t crcaps2
CRCAPS2.
Definition i3c.h:1185
uint32_t max_read_turnaround
Maximum Read turnaround time in microseconds.
Definition i3c.h:1097
uint8_t getcap4
GETCAPS4.
Definition i3c.h:1163
uint64_t pid
Device Provisioned ID.
Definition i3c.h:1024
uint8_t max_ibi
Maximum IBI Payload Size.
Definition i3c.h:1108
i3c_target_ibi_cb_t ibi_cb
In-Band Interrupt (IBI) callback.
Definition i3c.h:1200
uint16_t mwl
Maximum Write Length.
Definition i3c.h:1105
struct i3c_device_desc::@360344216022242204075200247271252277022102350070 data_length
struct i3c_device_desc::@344113175167251206324273037027234367204265164265 data_speed
uint8_t crhdly1
Controller Handoff Delay Parameters.
Definition i3c.h:1112
struct i3c_device_desc::@374345307316312053174345252357015060335301342357 crcaps
uint8_t getcap3
GETCAPS3 (I3C_CCC_GETCAPS3_*).
Definition i3c.h:1157
uint8_t dynamic_addr
Dynamic Address for this target device used for communication.
Definition i3c.h:1073
uint8_t crcaps1
CRCAPS1.
Definition i3c.h:1175
const uint8_t flags
Device Flags.
Definition i3c.h:1058
sys_snode_t node
Definition i3c.h:1015
const struct device * bus
I3C bus to which this target device is attached.
Definition i3c.h:1018
uint16_t mrl
Maximum Read Length.
Definition i3c.h:1102
uint8_t maxrd
Maximum Read Speed.
Definition i3c.h:1091
uint8_t gethdrcap
I3C v1.0 HDR Capabilities (I3C_CCC_GETCAPS1_*).
Definition i3c.h:1124
uint8_t bcr
Bus Characteristic Register (BCR).
Definition i3c.h:1079
uint8_t dcr
Device Characteristic Register (DCR).
Definition i3c.h:1087
const struct device * dev
Device driver instance of the I3C device.
Definition i3c.h:1021
struct i3c_device_desc::@177062035045125233337330056025025373240362240253 getcaps
Describes advanced (Target) capabilities and features.
Structure used for matching I3C devices.
Definition i3c.h:980
uint64_t pid
Device Provisioned ID.
Definition i3c.h:982
This structure is common to all I3C drivers and is expected to be the first element in the object poi...
Definition i3c.h:1305
uint8_t primary_controller_da
I3C Primary Controller Dynamic Address.
Definition i3c.h:1311
uint8_t flags
Driver config flags.
Definition i3c.h:1314
struct i3c_dev_list dev_list
I3C/I2C device list struct.
Definition i3c.h:1308
This structure is common to all I3C drivers and is expected to be the first element in the driver's s...
Definition i3c.h:1329
struct i3c_config_controller ctrl_config
Controller Configuration.
Definition i3c.h:1331
struct i3c_ccc_deftgts * deftgts
Received DEFTGTS Pointer.
Definition i3c.h:1337
bool deftgts_refreshed
DEFTGTS refreshed.
Definition i3c.h:1340
struct i3c_dev_attached_list attached_dev
Attached I3C/I2C devices and addresses.
Definition i3c.h:1334
Structure describing a I2C device on I3C bus.
Definition i3c.h:1217
const struct device * bus
I3C bus to which this I2C device is attached.
Definition i3c.h:1221
uint8_t lvr
Legacy Virtual Register (LVR).
Definition i3c.h:1230
uint16_t addr
Static address for this I2C device.
Definition i3c.h:1224
sys_snode_t node
Definition i3c.h:1218
Struct for IBI request.
Definition ibi.h:58
Definition i3c.h:3134
const struct device * bus
Definition i3c.h:3135
const struct i3c_device_id dev_id
Definition i3c.h:3136
One I3C Message.
Definition i3c.h:410
uint8_t flags
Flags for this message.
Definition i3c.h:435
uint8_t hdr_mode
HDR mode (I3C_MSG_HDR_MODE*) for transfer if any I3C_MSG_HDR_* is set in flags.
Definition i3c.h:443
uint32_t num_xfer
Total number of bytes transferred.
Definition i3c.h:424
uint8_t * buf
Data buffer in bytes.
Definition i3c.h:412
uint8_t hdr_cmd_code
HDR command code field (7-bit) for HDR-DDR, HDR-TSP and HDR-TSL.
Definition i3c.h:446
uint32_t len
Length of buffer in bytes.
Definition i3c.h:415
enum i3c_sdr_controller_error_types err
SDR Error Type.
Definition i3c.h:432
Structure describing a device that supports the I3C target API.
Definition target_device.h:101
A structure used to submit work.
Definition kernel.h:4667
API that an RTIO IO device should implement.
Definition iodev.h:34
IO device submission queue entry.
Definition sqe.h:403
struct rtio_sqe sqe
Submission this entry carries.
Definition sqe.h:404
An IO device with a function table for submitting requests.
Definition iodev.h:49
void * data
Data associated with this iodev.
Definition iodev.h:54
A submission queue event.
Definition sqe.h:310
const struct rtio_iodev * iodev
Device to operation on.
Definition sqe.h:319
An RTIO context containing what can be viewed as a pair of queues.
Definition rtio.h:71
Misc utilities.