Zephyr API Documentation  3.6.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
8#ifndef ZEPHYR_INCLUDE_DRIVERS_I3C_H_
9#define ZEPHYR_INCLUDE_DRIVERS_I3C_H_
10
20#include <zephyr/types.h>
21#include <zephyr/device.h>
22
27#include <zephyr/drivers/i2c.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
79#define I3C_BCR_MAX_DATA_SPEED_LIMIT BIT(0)
80
82#define I3C_BCR_IBI_REQUEST_CAPABLE BIT(1)
83
91#define I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE BIT(2)
92
99#define I3C_BCR_OFFLINE_CAPABLE BIT(3)
100
107#define I3C_BCR_VIRTUAL_TARGET BIT(4)
108
116#define I3C_BCR_ADV_CAPABILITIES BIT(5)
117
119#define I3C_BCR_DEVICE_ROLE_I3C_TARGET 0U
120
122#define I3C_BCR_DEVICE_ROLE_I3C_CONTROLLER_CAPABLE 1U
123
125#define I3C_BCR_DEVICE_ROLE_SHIFT 6U
126
128#define I3C_BCR_DEVICE_ROLE_MASK (0x03U << I3C_BCR_DEVICE_ROLE_SHIFT)
129
137#define I3C_BCR_DEVICE_ROLE(bcr) \
138 (((bcr) & I3C_BCR_DEVICE_ROLE_MASK) >> I3C_BCR_DEVICE_ROLE_SHIFT)
139
162#define I3C_LVR_I2C_FM_PLUS_MODE 0
163
165#define I3C_LVR_I2C_FM_MODE 1
166
168#define I3C_LVR_I2C_MODE_SHIFT 4
169
171#define I3C_LVR_I2C_MODE_MASK BIT(4)
172
180#define I3C_LVR_I2C_MODE(lvr) \
181 (((lvr) & I3C_LVR_I2C_MODE_MASK) >> I3C_LVR_I2C_MODE_SHIFT)
182
189#define I3C_LVR_I2C_DEV_IDX_0 0
190
197#define I3C_LVR_I2C_DEV_IDX_1 1
198
205#define I3C_LVR_I2C_DEV_IDX_2 2
206
208#define I3C_LVR_I2C_DEV_IDX_SHIFT 5
209
211#define I3C_LVR_I2C_DEV_IDX_MASK (0x07U << I3C_LVR_I2C_DEV_IDX_SHIFT)
212
220#define I3C_LVR_I2C_DEV_IDX(lvr) \
221 (((lvr) & I3C_LVR_I2C_DEV_IDX_MASK) >> I3C_LVR_I2C_DEV_IDX_SHIFT)
222
231
237
244
251
254};
255
264
267
270};
271
280
283
286
289
292
295};
296
310
313
316
319
322
325
328};
329
346
349
352
355
358
361
364
367
370
373
376};
377
384/*
385 * I3C_MSG_* are I3C Message flags.
386 */
387
389#define I3C_MSG_WRITE (0U << 0U)
390
392#define I3C_MSG_READ BIT(0)
393
395#define I3C_MSG_RW_MASK BIT(0)
399#define I3C_MSG_STOP BIT(1)
400
410#define I3C_MSG_RESTART BIT(2)
411
413#define I3C_MSG_HDR BIT(3)
414
416#define I3C_MSG_NBCH BIT(4)
417
419#define I3C_MSG_HDR_MODE0 BIT(0)
420
422#define I3C_MSG_HDR_MODE1 BIT(1)
423
425#define I3C_MSG_HDR_MODE2 BIT(2)
426
428#define I3C_MSG_HDR_MODE3 BIT(3)
429
431#define I3C_MSG_HDR_MODE4 BIT(4)
432
434#define I3C_MSG_HDR_MODE5 BIT(5)
435
437#define I3C_MSG_HDR_MODE6 BIT(6)
438
440#define I3C_MSG_HDR_MODE7 BIT(7)
441
443#define I3C_MSG_HDR_DDR I3C_MSG_HDR_MODE0
444
446#define I3C_MSG_HDR_TSP I3C_MSG_HDR_MODE1
447
449#define I3C_MSG_HDR_TSL I3C_MSG_HDR_MODE2
450
452#define I3C_MSG_HDR_BT I3C_MSG_HDR_MODE3
453
475struct i3c_msg {
478
481
490
493
501};
502
512};
513
523
524 struct {
527
531
539};
540
552
553 union {
556
563 void *ptr;
564 };
565};
566
573struct i3c_device_desc;
574struct i3c_device_id;
576struct i3c_target_config;
577
578__subsystem struct i3c_driver_api {
586 struct i2c_driver_api i2c_api;
587
600 int (*configure)(const struct device *dev,
601 enum i3c_config_type type, void *config);
602
615 int (*config_get)(const struct device *dev,
616 enum i3c_config_type type, void *config);
617
629 int (*recover_bus)(const struct device *dev);
630
644 int (*attach_i3c_device)(const struct device *dev,
645 struct i3c_device_desc *target,
646 uint8_t addr);
647
661 int (*reattach_i3c_device)(const struct device *dev,
662 struct i3c_device_desc *target,
663 uint8_t old_dyn_addr);
664
677 int (*detach_i3c_device)(const struct device *dev,
678 struct i3c_device_desc *target);
679
692 int (*attach_i2c_device)(const struct device *dev,
693 struct i3c_i2c_device_desc *target);
694
707 int (*detach_i2c_device)(const struct device *dev,
708 struct i3c_i2c_device_desc *target);
709
721 int (*do_daa)(const struct device *dev);
722
735 int (*do_ccc)(const struct device *dev,
736 struct i3c_ccc_payload *payload);
737
750 int (*i3c_xfers)(const struct device *dev,
751 struct i3c_device_desc *target,
752 struct i3c_msg *msgs,
753 uint8_t num_msgs);
754
768 struct i3c_device_desc *(*i3c_device_find)(const struct device *dev,
769 const struct i3c_device_id *id);
770
783 int (*ibi_raise)(const struct device *dev,
784 struct i3c_ibi *request);
785
798 int (*ibi_enable)(const struct device *dev,
799 struct i3c_device_desc *target);
800
813 int (*ibi_disable)(const struct device *dev,
814 struct i3c_device_desc *target);
815
831 int (*target_register)(const struct device *dev,
832 struct i3c_target_config *cfg);
833
849 int (*target_unregister)(const struct device *dev,
850 struct i3c_target_config *cfg);
851
867 int (*target_tx_write)(const struct device *dev,
868 uint8_t *buf, uint16_t len);
869};
870
880 const uint64_t pid:48;
881};
882
891#define I3C_DEVICE_ID(pid) \
892 { \
893 .pid = pid \
894 }
895
919 sys_snode_t node;
923 const struct device * const bus;
924
926 const struct device * const dev;
927
929 const uint64_t pid:48;
930
944
955
970
971#if defined(CONFIG_I3C_USE_GROUP_ADDR) || defined(__DOXYGEN__)
980#endif /* CONFIG_I3C_USE_GROUP_ADDR */
981
1012
1020
1021 struct {
1024
1027
1031
1032 struct {
1035
1038
1042
1048 void *controller_priv;
1051#if defined(CONFIG_I3C_USE_IBI) || defined(__DOXYGEN__)
1056#endif /* CONFIG_I3C_USE_IBI */
1057};
1058
1078 sys_snode_t node;
1082 const struct device *bus;
1083
1086
1102
1108 void *controller_priv;
1110};
1111
1128
1129 struct {
1134
1140};
1141
1154 struct i3c_device_desc * const i3c;
1155
1159 struct i3c_i2c_device_desc * const i2c;
1160
1165
1170};
1171
1180};
1181
1189
1192};
1193
1206struct i3c_device_desc *i3c_dev_list_find(const struct i3c_dev_list *dev_list,
1207 const struct i3c_device_id *id);
1208
1222 uint8_t addr);
1223
1237 uint16_t addr);
1238
1253
1306 const struct i3c_dev_list *dev_list,
1307 uint64_t pid, bool must_match,
1308 bool assigned_okay,
1309 struct i3c_device_desc **target,
1310 uint8_t *addr);
1311
1325static inline int i3c_configure(const struct device *dev,
1326 enum i3c_config_type type, void *config)
1327{
1328 const struct i3c_driver_api *api =
1329 (const struct i3c_driver_api *)dev->api;
1330
1331 if (api->configure == NULL) {
1332 return -ENOSYS;
1333 }
1334
1335 return api->configure(dev, type, config);
1336}
1337
1358static inline int i3c_config_get(const struct device *dev,
1359 enum i3c_config_type type, void *config)
1360{
1361 const struct i3c_driver_api *api =
1362 (const struct i3c_driver_api *)dev->api;
1363
1364 if (api->config_get == NULL) {
1365 return -ENOSYS;
1366 }
1367
1368 return api->config_get(dev, type, config);
1369}
1370
1381static inline int i3c_recover_bus(const struct device *dev)
1382{
1383 const struct i3c_driver_api *api =
1384 (const struct i3c_driver_api *)dev->api;
1385
1386 if (api->recover_bus == NULL) {
1387 return -ENOSYS;
1388 }
1389
1390 return api->recover_bus(dev);
1391}
1392
1413
1438int i3c_reattach_i3c_device(struct i3c_device_desc *target, uint8_t old_dyn_addr);
1439
1460
1480
1499
1523static inline int i3c_do_daa(const struct device *dev)
1524{
1525 const struct i3c_driver_api *api =
1526 (const struct i3c_driver_api *)dev->api;
1527
1528 if (api->do_daa == NULL) {
1529 return -ENOSYS;
1530 }
1531
1532 return api->do_daa(dev);
1533}
1534
1548__syscall int i3c_do_ccc(const struct device *dev,
1549 struct i3c_ccc_payload *payload);
1550
1551static inline int z_impl_i3c_do_ccc(const struct device *dev,
1552 struct i3c_ccc_payload *payload)
1553{
1554 const struct i3c_driver_api *api =
1555 (const struct i3c_driver_api *)dev->api;
1556
1557 if (api->do_ccc == NULL) {
1558 return -ENOSYS;
1559 }
1560
1561 return api->do_ccc(dev, payload);
1562}
1563
1595__syscall int i3c_transfer(struct i3c_device_desc *target,
1596 struct i3c_msg *msgs, uint8_t num_msgs);
1597
1598static inline int z_impl_i3c_transfer(struct i3c_device_desc *target,
1599 struct i3c_msg *msgs, uint8_t num_msgs)
1600{
1601 const struct i3c_driver_api *api =
1602 (const struct i3c_driver_api *)target->bus->api;
1603
1604 return api->i3c_xfers(target->bus, target, msgs, num_msgs);
1605}
1606
1623static inline
1625 const struct i3c_device_id *id)
1626{
1627 const struct i3c_driver_api *api =
1628 (const struct i3c_driver_api *)dev->api;
1629
1630 if (api->i3c_device_find == NULL) {
1631 return NULL;
1632 }
1633
1634 return api->i3c_device_find(dev, id);
1635}
1636
1653static inline int i3c_ibi_raise(const struct device *dev,
1654 struct i3c_ibi *request)
1655{
1656 const struct i3c_driver_api *api =
1657 (const struct i3c_driver_api *)dev->api;
1658
1659 if (api->ibi_raise == NULL) {
1660 return -ENOSYS;
1661 }
1662
1663 return api->ibi_raise(dev, request);
1664}
1665
1680static inline int i3c_ibi_enable(struct i3c_device_desc *target)
1681{
1682 const struct i3c_driver_api *api =
1683 (const struct i3c_driver_api *)target->bus->api;
1684
1685 if (api->ibi_enable == NULL) {
1686 return -ENOSYS;
1687 }
1688
1689 return api->ibi_enable(target->bus, target);
1690}
1691
1704static inline int i3c_ibi_disable(struct i3c_device_desc *target)
1705{
1706 const struct i3c_driver_api *api =
1707 (const struct i3c_driver_api *)target->bus->api;
1708
1709 if (api->ibi_disable == NULL) {
1710 return -ENOSYS;
1711 }
1712
1713 return api->ibi_disable(target->bus, target);
1714}
1715
1727static inline int i3c_ibi_has_payload(struct i3c_device_desc *target)
1728{
1729 return (target->bcr & I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE)
1731}
1732
1744static inline int i3c_device_is_ibi_capable(struct i3c_device_desc *target)
1745{
1746 return (target->bcr & I3C_BCR_IBI_REQUEST_CAPABLE)
1748}
1749
1770static inline int i3c_write(struct i3c_device_desc *target,
1771 const uint8_t *buf, uint32_t num_bytes)
1772{
1773 struct i3c_msg msg;
1774
1775 msg.buf = (uint8_t *)buf;
1776 msg.len = num_bytes;
1778
1779 return i3c_transfer(target, &msg, 1);
1780}
1781
1795static inline int i3c_read(struct i3c_device_desc *target,
1796 uint8_t *buf, uint32_t num_bytes)
1797{
1798 struct i3c_msg msg;
1799
1800 msg.buf = buf;
1801 msg.len = num_bytes;
1803
1804 return i3c_transfer(target, &msg, 1);
1805}
1806
1824static inline int i3c_write_read(struct i3c_device_desc *target,
1825 const void *write_buf, size_t num_write,
1826 void *read_buf, size_t num_read)
1827{
1828 struct i3c_msg msg[2];
1829
1830 msg[0].buf = (uint8_t *)write_buf;
1831 msg[0].len = num_write;
1832 msg[0].flags = I3C_MSG_WRITE;
1833
1834 msg[1].buf = (uint8_t *)read_buf;
1835 msg[1].len = num_read;
1837
1838 return i3c_transfer(target, msg, 2);
1839}
1840
1858static inline int i3c_burst_read(struct i3c_device_desc *target,
1859 uint8_t start_addr,
1860 uint8_t *buf,
1861 uint32_t num_bytes)
1862{
1863 return i3c_write_read(target,
1864 &start_addr, sizeof(start_addr),
1865 buf, num_bytes);
1866}
1867
1888static inline int i3c_burst_write(struct i3c_device_desc *target,
1889 uint8_t start_addr,
1890 const uint8_t *buf,
1891 uint32_t num_bytes)
1892{
1893 struct i3c_msg msg[2];
1894
1895 msg[0].buf = &start_addr;
1896 msg[0].len = 1U;
1897 msg[0].flags = I3C_MSG_WRITE;
1898
1899 msg[1].buf = (uint8_t *)buf;
1900 msg[1].len = num_bytes;
1901 msg[1].flags = I3C_MSG_WRITE | I3C_MSG_STOP;
1902
1903 return i3c_transfer(target, msg, 2);
1904}
1905
1920static inline int i3c_reg_read_byte(struct i3c_device_desc *target,
1921 uint8_t reg_addr, uint8_t *value)
1922{
1923 return i3c_write_read(target,
1924 &reg_addr, sizeof(reg_addr),
1925 value, sizeof(*value));
1926}
1927
1945static inline int i3c_reg_write_byte(struct i3c_device_desc *target,
1946 uint8_t reg_addr, uint8_t value)
1947{
1948 uint8_t tx_buf[2] = {reg_addr, value};
1949
1950 return i3c_write(target, tx_buf, 2);
1951}
1952
1971static inline int i3c_reg_update_byte(struct i3c_device_desc *target,
1972 uint8_t reg_addr, uint8_t mask,
1973 uint8_t value)
1974{
1975 uint8_t old_value, new_value;
1976 int rc;
1977
1978 rc = i3c_reg_read_byte(target, reg_addr, &old_value);
1979 if (rc != 0) {
1980 return rc;
1981 }
1982
1983 new_value = (old_value & ~mask) | (value & mask);
1984 if (new_value == old_value) {
1985 return 0;
1986 }
1987
1988 return i3c_reg_write_byte(target, reg_addr, new_value);
1989}
1990
2015void i3c_dump_msgs(const char *name, const struct i3c_msg *msgs,
2016 uint8_t num_msgs, struct i3c_device_desc *target);
2017
2035int i3c_bus_init(const struct device *dev,
2036 const struct i3c_dev_list *i3c_dev_list);
2037
2058
2059/*
2060 * This needs to be after declaration of struct i3c_driver_api,
2061 * or else compiler complains about undefined type inside
2062 * the static inline API wrappers.
2063 */
2065
2066#ifdef __cplusplus
2067}
2068#endif
2069
2074#include <syscalls/i3c.h>
2075
2076#endif /* ZEPHYR_INCLUDE_DRIVERS_I3C_H_ */
Public APIs for the I2C drivers.
static int i3c_ibi_disable(struct i3c_device_desc *target)
Disable IBI of a target device.
Definition: i3c.h:1704
static int i3c_ibi_has_payload(struct i3c_device_desc *target)
Check if target's IBI has payload.
Definition: i3c.h:1727
static int i3c_ibi_raise(const struct device *dev, struct i3c_ibi *request)
Raise an In-Band Interrupt (IBI).
Definition: i3c.h:1653
static int i3c_device_is_ibi_capable(struct i3c_device_desc *target)
Check if device is IBI capable.
Definition: i3c.h:1744
static int i3c_ibi_enable(struct i3c_device_desc *target)
Enable IBI of a target device.
Definition: i3c.h:1680
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:151
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:82
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:1624
i3c_sdr_target_error_codes
I3C SDR Target Error Codes.
Definition: i3c.h:340
static int i3c_configure(const struct device *dev, enum i3c_config_type type, void *config)
Configure the I3C hardware.
Definition: i3c.h:1325
int i3c_dev_list_daa_addr_helper(struct i3c_addr_slots *addr_slots, const struct i3c_dev_list *dev_list, 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.
i3c_config_type
Type of configuration being passed to configure function.
Definition: i3c.h:508
int i3c_attach_i2c_device(struct i3c_i2c_device_desc *target)
Attach an I2C device.
int i3c_determine_default_addr(struct i3c_device_desc *target, uint8_t *addr)
Helper function to find the default address an i3c device is attached with.
i3c_i2c_speed_type
I2C bus speed under I3C bus.
Definition: i3c.h:261
int i3c_detach_i3c_device(struct i3c_device_desc *target)
Detach I3C Device.
i3c_bus_mode
I3C bus mode.
Definition: i3c.h:228
static int i3c_recover_bus(const struct device *dev)
Attempt bus recovery on the I3C bus.
Definition: i3c.h:1381
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:1358
int i3c_detach_i2c_device(struct i3c_i2c_device_desc *target)
Detach I2C Device.
struct i3c_i2c_device_desc * i3c_dev_list_i2c_addr_find(struct i3c_dev_attached_list *dev_list, uint16_t addr)
Find a I2C target device descriptor by address.
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.
i3c_sdr_controller_error_codes
I3C SDR Controller Error Codes.
Definition: i3c.h:307
int i3c_do_ccc(const struct device *dev, struct i3c_ccc_payload *payload)
Send CCC to the bus.
struct i3c_device_desc * i3c_dev_list_i3c_addr_find(struct i3c_dev_attached_list *dev_list, uint8_t addr)
Find a I3C target device descriptor by dynamic address.
int i3c_device_basic_info_get(struct i3c_device_desc *target)
Get basic information from device and update device descriptor.
static int i3c_do_daa(const struct device *dev)
Perform Dynamic Address Assignment on the I3C bus.
Definition: i3c.h:1523
#define I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE
IBI Payload bit.
Definition: i3c.h:91
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:277
@ I3C_ERROR_TE_UNKNOWN
Unknown error (not official error code)
Definition: i3c.h:369
@ I3C_ERROR_TE6
Monitoring Error.
Definition: i3c.h:363
@ I3C_ERROR_TE4
0x7E/R missing after RESTART during Dynamic Address Arbitration
Definition: i3c.h:357
@ I3C_ERROR_TE3
Assigned Address during Dynamic Address Arbitration.
Definition: i3c.h:354
@ I3C_ERROR_TE_NONE
No error (not official error code)
Definition: i3c.h:372
@ I3C_ERROR_TE_MAX
Definition: i3c.h:374
@ I3C_ERROR_TE1
CCC Code.
Definition: i3c.h:348
@ I3C_ERROR_TE5
Transaction after detecting CCC.
Definition: i3c.h:360
@ I3C_ERROR_DBR
Dead Bus Recovery.
Definition: i3c.h:366
@ I3C_ERROR_TE2
Write Data.
Definition: i3c.h:351
@ I3C_ERROR_TE_INVALID
Definition: i3c.h:375
@ I3C_ERROR_TE0
Invalid Broadcast Address or Dynamic Address after DA assignment.
Definition: i3c.h:345
@ I3C_CONFIG_TARGET
Definition: i3c.h:510
@ I3C_CONFIG_CUSTOM
Definition: i3c.h:511
@ I3C_CONFIG_CONTROLLER
Definition: i3c.h:509
@ I3C_I2C_SPEED_INVALID
Definition: i3c.h:269
@ I3C_I2C_SPEED_MAX
Definition: i3c.h:268
@ I3C_I2C_SPEED_FMPLUS
I2C FM+ mode.
Definition: i3c.h:266
@ I3C_I2C_SPEED_FM
I2C FM mode.
Definition: i3c.h:263
@ I3C_BUS_MODE_INVALID
Definition: i3c.h:253
@ I3C_BUS_MODE_PURE
Only I3C devices are on the bus.
Definition: i3c.h:230
@ I3C_BUS_MODE_MIXED_FAST
Both I3C and legacy I2C devices are on the bus.
Definition: i3c.h:236
@ I3C_BUS_MODE_MAX
Definition: i3c.h:252
@ I3C_BUS_MODE_MIXED_LIMITED
Both I3C and legacy I2C devices are on the bus.
Definition: i3c.h:243
@ I3C_BUS_MODE_MIXED_SLOW
Both I3C and legacy I2C devices are on the bus.
Definition: i3c.h:250
@ I3C_ERROR_CE0
Transaction after sending CCC.
Definition: i3c.h:309
@ I3C_ERROR_CE2
No response to broadcast address (0x7E)
Definition: i3c.h:315
@ I3C_ERROR_CE_INVALID
Definition: i3c.h:327
@ I3C_ERROR_CE_MAX
Definition: i3c.h:326
@ I3C_ERROR_CE_UNKNOWN
Unknown error (not official error code)
Definition: i3c.h:321
@ I3C_ERROR_CE3
Failed Controller Handoff.
Definition: i3c.h:318
@ I3C_ERROR_CE1
Monitoring Error.
Definition: i3c.h:312
@ I3C_ERROR_CE_NONE
No error (not official error code)
Definition: i3c.h:324
@ I3C_DATA_RATE_MAX
Definition: i3c.h:293
@ I3C_DATA_RATE_INVALID
Definition: i3c.h:294
@ I3C_DATA_RATE_HDR_TSP
High Data Rate - Ternary Symbol for Pure Bus.
Definition: i3c.h:288
@ I3C_DATA_RATE_HDR_DDR
High Data Rate - Double Data Rate messaging.
Definition: i3c.h:282
@ I3C_DATA_RATE_SDR
Single Data Rate messaging.
Definition: i3c.h:279
@ I3C_DATA_RATE_HDR_TSL
High Data Rate - Ternary Symbol Legacy-inclusive-Bus.
Definition: i3c.h:285
@ I3C_DATA_RATE_HDR_BT
High Data Rate - Bulk Transport.
Definition: i3c.h:291
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:399
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:1824
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:1858
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:1971
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:392
#define I3C_MSG_WRITE
Write message to I3C bus.
Definition: i3c.h:389
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:1920
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:1770
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:1795
#define I3C_MSG_RESTART
RESTART I3C transaction for this message.
Definition: i3c.h:410
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:1888
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:1945
struct _slist sys_slist_t
Single-linked list structure.
Definition: slist.h:49
struct _snode sys_snode_t
Single-linked list node structure.
Definition: slist.h:39
#define ENOSYS
Function not implemented.
Definition: errno.h:83
__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:399
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:405
Structure to keep track of addresses on I3C bus.
Definition: addresses.h:57
Payload structure for one CCC transaction.
Definition: ccc.h:266
Configuration parameters for I3C hardware to act as controller.
Definition: i3c.h:517
uint32_t i3c
SCL frequency (in Hz) for I3C transfers.
Definition: i3c.h:526
uint8_t supported_hdr
Bit mask of supported HDR modes (0 - 7).
Definition: i3c.h:538
bool is_secondary
True if the controller is to be the secondary controller of the bus.
Definition: i3c.h:522
uint32_t i2c
SCL frequency (in Hz) for I2C transfers.
Definition: i3c.h:529
struct i3c_config_controller::@163 scl
Custom I3C configuration parameters.
Definition: i3c.h:549
void * ptr
Pointer to configuration parameter.
Definition: i3c.h:563
uint32_t id
ID of the configuration parameter.
Definition: i3c.h:551
uintptr_t val
Value of configuration parameter.
Definition: i3c.h:555
Structure for describing attached devices for a controller.
Definition: i3c.h:1120
struct i3c_dev_attached_list::@168 devices
sys_slist_t i3c
Linked list of attached I3C devices.
Definition: i3c.h:1133
sys_slist_t i2c
Linked list of attached I2C devices.
Definition: i3c.h:1138
struct i3c_addr_slots addr_slots
Address slots:
Definition: i3c.h:1127
Structure for describing known devices for a controller.
Definition: i3c.h:1150
struct i3c_i2c_device_desc *const i2c
Pointer to array of known I2C devices.
Definition: i3c.h:1159
const uint8_t num_i3c
Number of I3C devices in array.
Definition: i3c.h:1164
struct i3c_device_desc *const i3c
Pointer to array of known I3C devices.
Definition: i3c.h:1154
const uint8_t num_i2c
Number of I2C devices in array.
Definition: i3c.h:1169
Structure describing a I3C target device.
Definition: i3c.h:913
uint8_t maxwr
Maximum Write Speed.
Definition: i3c.h:1026
const uint8_t init_dynamic_addr
Initial dynamic address.
Definition: i3c.h:954
uint32_t max_read_turnaround
Maximum Read turnaround time in microseconds.
Definition: i3c.h:1029
const uint8_t static_addr
Static address for this target device.
Definition: i3c.h:943
struct i3c_device_desc::@166 data_speed
uint8_t max_ibi
Maximum IBI Payload Size.
Definition: i3c.h:1040
i3c_target_ibi_cb_t ibi_cb
Private data by the controller to aid in transactions.
Definition: i3c.h:1055
uint8_t group_addr
Group address for this target device.
Definition: i3c.h:979
uint16_t mwl
Maximum Write Length.
Definition: i3c.h:1037
uint8_t dynamic_addr
Dynamic Address for this target device used for communication.
Definition: i3c.h:969
const struct device *const dev
Device driver instance of the I3C device.
Definition: i3c.h:926
struct i3c_device_desc::@167 data_length
uint16_t mrl
Maximum Read Length.
Definition: i3c.h:1034
const uint64_t pid
Device Provisioned ID.
Definition: i3c.h:929
uint8_t maxrd
Maximum Read Speed.
Definition: i3c.h:1023
uint8_t bcr
Bus Characteristic Register (BCR)
Definition: i3c.h:1011
uint8_t dcr
Device Characteristic Register (DCR)
Definition: i3c.h:1019
const struct device *const bus
Used to attach this node onto a linked list.
Definition: i3c.h:923
Structure used for matching I3C devices.
Definition: i3c.h:878
const uint64_t pid
Device Provisioned ID.
Definition: i3c.h:880
This structure is common to all I3C drivers and is expected to be the first element in the object poi...
Definition: i3c.h:1177
struct i3c_dev_list dev_list
I3C/I2C device list struct.
Definition: i3c.h:1179
This structure is common to all I3C drivers and is expected to be the first element in the driver's s...
Definition: i3c.h:1186
struct i3c_config_controller ctrl_config
Controller Configuration.
Definition: i3c.h:1188
struct i3c_dev_attached_list attached_dev
Attached I3C/I2C devices and addresses.
Definition: i3c.h:1191
Structure describing a I2C device on I3C bus.
Definition: i3c.h:1072
const struct device * bus
Used to attach this node onto a linked list.
Definition: i3c.h:1082
const uint16_t addr
Static address for this I2C device.
Definition: i3c.h:1085
const uint8_t lvr
Legacy Virtual Register (LVR)
Definition: i3c.h:1101
Struct for IBI request.
Definition: ibi.h:57
One I3C Message.
Definition: i3c.h:475
uint8_t flags
Flags for this message.
Definition: i3c.h:492
uint8_t hdr_mode
HDR mode (I3C_MSG_HDR_MODE*) for transfer if any I3C_MSG_HDR_* is set in flags.
Definition: i3c.h:500
uint32_t num_xfer
Total number of bytes transferred.
Definition: i3c.h:489
uint8_t * buf
Data buffer in bytes.
Definition: i3c.h:477
uint32_t len
Length of buffer in bytes.
Definition: i3c.h:480
Structure describing a device that supports the I3C target API.
Definition: target_device.h:92