Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
i3c.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DRIVERS_I3C_H_
8#define ZEPHYR_INCLUDE_DRIVERS_I3C_H_
9
17#include <zephyr/types.h>
18#include <zephyr/device.h>
19
24#include <zephyr/drivers/i2c.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
69#define I3C_BCR_MAX_DATA_SPEED_LIMIT BIT(0)
70
72#define I3C_BCR_IBI_REQUEST_CAPABLE BIT(1)
73
81#define I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE BIT(2)
82
89#define I3C_BCR_OFFLINE_CAPABLE BIT(3)
90
97#define I3C_BCR_VIRTUAL_TARGET BIT(4)
98
106#define I3C_BCR_ADV_CAPABILITIES BIT(5)
107
109#define I3C_BCR_DEVICE_ROLE_I3C_TARGET 0U
110
112#define I3C_BCR_DEVICE_ROLE_I3C_CONTROLLER_CAPABLE 1U
113
115#define I3C_BCR_DEVICE_ROLE_SHIFT 6U
116
118#define I3C_BCR_DEVICE_ROLE_MASK (0x03U << I3C_BCR_DEVICE_ROLE_SHIFT)
119
127#define I3C_BCR_DEVICE_ROLE(bcr) \
128 (((bcr) & I3C_BCR_DEVICE_ROLE_MASK) >> I3C_BCR_DEVICE_ROLE_SHIFT)
129
152#define I3C_DCR_I2C_FM_PLUS_MODE 0
153
155#define I3C_DCR_I2C_FM_MODE 1
156
158#define I3C_DCR_I2C_MODE_SHIFT 4
159
161#define I3C_DCR_I2C_MODE_MASK BIT(4)
162
170#define I3C_DCR_I2C_MODE(dcr) \
171 (((mode) & I3C_DCR_I2C_MODE_MASK) >> I3C_DCR_I2C_MODE_SHIFT)
172
179#define I3C_DCR_I2C_DEV_IDX_0 0
180
187#define I3C_DCR_I2C_DEV_IDX_1 1
188
195#define I3C_DCR_I2C_DEV_IDX_2 2
196
198#define I3C_DCR_I2C_DEV_IDX_SHIFT 5
199
201#define I3C_DCR_I2C_DEV_IDX_MASK (0x07U << I3C_DCR_I2C_DEV_IDX_SHIFT)
202
210#define I3C_DCR_I2C_DEV_IDX(dcr) \
211 (((dcr) & I3C_DCR_I2C_DEV_IDX_MASK) >> I3C_DCR_I2C_DEV_IDX_SHIFT)
212
221
227
234
241
244};
245
254
257
260};
261
270
273
276
279
282
285};
286
300
303
306
309
312
315
318};
319
336
339
342
345
348
351
354
357
360
363
366};
367
374/*
375 * I3C_MSG_* are I3C Message flags.
376 */
377
379#define I3C_MSG_WRITE (0U << 0U)
380
382#define I3C_MSG_READ BIT(0)
383
385#define I3C_MSG_RW_MASK BIT(0)
389#define I3C_MSG_STOP BIT(1)
390
400#define I3C_MSG_RESTART BIT(2)
401
403#define I3C_MSG_HDR BIT(3)
404
406#define I3C_MSG_NBCH BIT(4)
407
409#define I3C_MSG_HDR_MODE0 BIT(0)
410
412#define I3C_MSG_HDR_MODE1 BIT(1)
413
415#define I3C_MSG_HDR_MODE2 BIT(2)
416
418#define I3C_MSG_HDR_MODE3 BIT(3)
419
421#define I3C_MSG_HDR_MODE4 BIT(4)
422
424#define I3C_MSG_HDR_MODE5 BIT(5)
425
427#define I3C_MSG_HDR_MODE6 BIT(6)
428
430#define I3C_MSG_HDR_MODE7 BIT(7)
431
433#define I3C_MSG_HDR_DDR I3C_MSG_HDR_MODE0
434
436#define I3C_MSG_HDR_TSP I3C_MSG_HDR_MODE1
437
439#define I3C_MSG_HDR_TSL I3C_MSG_HDR_MODE2
440
442#define I3C_MSG_HDR_BT I3C_MSG_HDR_MODE3
443
465struct i3c_msg {
468
471
474
482};
483
493};
494
504
505 struct {
508
512
520};
521
533
534 union {
537
544 void *ptr;
545 };
546};
547
554struct i3c_device_desc;
555struct i3c_device_id;
557struct i3c_target_config;
558
559__subsystem struct i3c_driver_api {
567 struct i2c_driver_api i2c_api;
568
581 int (*configure)(const struct device *dev,
582 enum i3c_config_type type, void *config);
583
596 int (*config_get)(const struct device *dev,
597 enum i3c_config_type type, void *config);
598
610 int (*recover_bus)(const struct device *dev);
611
625 int (*attach_i3c_device)(const struct device *dev,
626 struct i3c_device_desc *target,
627 uint8_t addr);
628
642 int (*reattach_i3c_device)(const struct device *dev,
643 struct i3c_device_desc *target,
644 uint8_t old_dyn_addr);
645
658 int (*detach_i3c_device)(const struct device *dev,
659 struct i3c_device_desc *target);
660
673 int (*attach_i2c_device)(const struct device *dev,
674 struct i3c_i2c_device_desc *target);
675
688 int (*detach_i2c_device)(const struct device *dev,
689 struct i3c_i2c_device_desc *target);
690
702 int (*do_daa)(const struct device *dev);
703
716 int (*do_ccc)(const struct device *dev,
717 struct i3c_ccc_payload *payload);
718
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
749 struct i3c_device_desc *(*i3c_device_find)(const struct device *dev,
750 const struct i3c_device_id *id);
751
764 int (*ibi_raise)(const struct device *dev,
765 struct i3c_ibi *request);
766
779 int (*ibi_enable)(const struct device *dev,
780 struct i3c_device_desc *target);
781
794 int (*ibi_disable)(const struct device *dev,
795 struct i3c_device_desc *target);
796
812 int (*target_register)(const struct device *dev,
813 struct i3c_target_config *cfg);
814
830 int (*target_unregister)(const struct device *dev,
831 struct i3c_target_config *cfg);
832
848 int (*target_tx_write)(const struct device *dev,
849 uint8_t *buf, uint16_t len);
850};
851
861 const uint64_t pid:48;
862};
863
872#define I3C_DEVICE_ID(pid) \
873 { \
874 .pid = pid \
875 }
876
900 sys_snode_t node;
904 const struct device * const bus;
905
907 const struct device * const dev;
908
910 const uint64_t pid:48;
911
925
936
951
952#if defined(CONFIG_I3C_USE_GROUP_ADDR) || defined(__DOXYGEN__)
961#endif /* CONFIG_I3C_USE_GROUP_ADDR */
962
993
1001
1002 struct {
1005
1008
1012
1013 struct {
1016
1019
1023
1029 void *controller_priv;
1032#if defined(CONFIG_I3C_USE_IBI) || defined(__DOXYGEN__)
1037#endif /* CONFIG_I3C_USE_IBI */
1038};
1039
1059 sys_snode_t node;
1063 const struct device *bus;
1064
1067
1083
1089 void *controller_priv;
1091};
1092
1109
1110 struct {
1115
1121};
1122
1135 struct i3c_device_desc * const i3c;
1136
1140 struct i3c_i2c_device_desc * const i2c;
1141
1146
1151};
1152
1161};
1162
1170
1173};
1174
1187struct i3c_device_desc *i3c_dev_list_find(const struct i3c_dev_list *dev_list,
1188 const struct i3c_device_id *id);
1189
1203 uint8_t addr);
1204
1218 uint16_t addr);
1219
1234
1287 const struct i3c_dev_list *dev_list,
1288 uint64_t pid, bool must_match,
1289 bool assigned_okay,
1290 struct i3c_device_desc **target,
1291 uint8_t *addr);
1292
1306static inline int i3c_configure(const struct device *dev,
1307 enum i3c_config_type type, void *config)
1308{
1309 const struct i3c_driver_api *api =
1310 (const struct i3c_driver_api *)dev->api;
1311
1312 if (api->configure == NULL) {
1313 return -ENOSYS;
1314 }
1315
1316 return api->configure(dev, type, config);
1317}
1318
1339static inline int i3c_config_get(const struct device *dev,
1340 enum i3c_config_type type, void *config)
1341{
1342 const struct i3c_driver_api *api =
1343 (const struct i3c_driver_api *)dev->api;
1344
1345 if (api->config_get == NULL) {
1346 return -ENOSYS;
1347 }
1348
1349 return api->config_get(dev, type, config);
1350}
1351
1362static inline int i3c_recover_bus(const struct device *dev)
1363{
1364 const struct i3c_driver_api *api =
1365 (const struct i3c_driver_api *)dev->api;
1366
1367 if (api->recover_bus == NULL) {
1368 return -ENOSYS;
1369 }
1370
1371 return api->recover_bus(dev);
1372}
1373
1394
1419int i3c_reattach_i3c_device(struct i3c_device_desc *target, uint8_t old_dyn_addr);
1420
1441
1461
1480
1504static inline int i3c_do_daa(const struct device *dev)
1505{
1506 const struct i3c_driver_api *api =
1507 (const struct i3c_driver_api *)dev->api;
1508
1509 if (api->do_daa == NULL) {
1510 return -ENOSYS;
1511 }
1512
1513 return api->do_daa(dev);
1514}
1515
1529__syscall int i3c_do_ccc(const struct device *dev,
1530 struct i3c_ccc_payload *payload);
1531
1532static inline int z_impl_i3c_do_ccc(const struct device *dev,
1533 struct i3c_ccc_payload *payload)
1534{
1535 const struct i3c_driver_api *api =
1536 (const struct i3c_driver_api *)dev->api;
1537
1538 if (api->do_ccc == NULL) {
1539 return -ENOSYS;
1540 }
1541
1542 return api->do_ccc(dev, payload);
1543}
1544
1576__syscall int i3c_transfer(struct i3c_device_desc *target,
1577 struct i3c_msg *msgs, uint8_t num_msgs);
1578
1579static inline int z_impl_i3c_transfer(struct i3c_device_desc *target,
1580 struct i3c_msg *msgs, uint8_t num_msgs)
1581{
1582 const struct i3c_driver_api *api =
1583 (const struct i3c_driver_api *)target->bus->api;
1584
1585 return api->i3c_xfers(target->bus, target, msgs, num_msgs);
1586}
1587
1604static inline
1606 const struct i3c_device_id *id)
1607{
1608 const struct i3c_driver_api *api =
1609 (const struct i3c_driver_api *)dev->api;
1610
1611 if (api->i3c_device_find == NULL) {
1612 return NULL;
1613 }
1614
1615 return api->i3c_device_find(dev, id);
1616}
1617
1634static inline int i3c_ibi_raise(const struct device *dev,
1635 struct i3c_ibi *request)
1636{
1637 const struct i3c_driver_api *api =
1638 (const struct i3c_driver_api *)dev->api;
1639
1640 if (api->ibi_raise == NULL) {
1641 return -ENOSYS;
1642 }
1643
1644 return api->ibi_raise(dev, request);
1645}
1646
1661static inline int i3c_ibi_enable(struct i3c_device_desc *target)
1662{
1663 const struct i3c_driver_api *api =
1664 (const struct i3c_driver_api *)target->bus->api;
1665
1666 if (api->ibi_enable == NULL) {
1667 return -ENOSYS;
1668 }
1669
1670 return api->ibi_enable(target->bus, target);
1671}
1672
1685static inline int i3c_ibi_disable(struct i3c_device_desc *target)
1686{
1687 const struct i3c_driver_api *api =
1688 (const struct i3c_driver_api *)target->bus->api;
1689
1690 if (api->ibi_disable == NULL) {
1691 return -ENOSYS;
1692 }
1693
1694 return api->ibi_disable(target->bus, target);
1695}
1696
1708static inline int i3c_ibi_has_payload(struct i3c_device_desc *target)
1709{
1710 return (target->bcr & I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE)
1712}
1713
1725static inline int i3c_device_is_ibi_capable(struct i3c_device_desc *target)
1726{
1727 return (target->bcr & I3C_BCR_IBI_REQUEST_CAPABLE)
1729}
1730
1751static inline int i3c_write(struct i3c_device_desc *target,
1752 const uint8_t *buf, uint32_t num_bytes)
1753{
1754 struct i3c_msg msg;
1755
1756 msg.buf = (uint8_t *)buf;
1757 msg.len = num_bytes;
1759
1760 return i3c_transfer(target, &msg, 1);
1761}
1762
1776static inline int i3c_read(struct i3c_device_desc *target,
1777 uint8_t *buf, uint32_t num_bytes)
1778{
1779 struct i3c_msg msg;
1780
1781 msg.buf = buf;
1782 msg.len = num_bytes;
1784
1785 return i3c_transfer(target, &msg, 1);
1786}
1787
1805static inline int i3c_write_read(struct i3c_device_desc *target,
1806 const void *write_buf, size_t num_write,
1807 void *read_buf, size_t num_read)
1808{
1809 struct i3c_msg msg[2];
1810
1811 msg[0].buf = (uint8_t *)write_buf;
1812 msg[0].len = num_write;
1813 msg[0].flags = I3C_MSG_WRITE;
1814
1815 msg[1].buf = (uint8_t *)read_buf;
1816 msg[1].len = num_read;
1818
1819 return i3c_transfer(target, msg, 2);
1820}
1821
1839static inline int i3c_burst_read(struct i3c_device_desc *target,
1840 uint8_t start_addr,
1841 uint8_t *buf,
1842 uint32_t num_bytes)
1843{
1844 return i3c_write_read(target,
1845 &start_addr, sizeof(start_addr),
1846 buf, num_bytes);
1847}
1848
1869static inline int i3c_burst_write(struct i3c_device_desc *target,
1870 uint8_t start_addr,
1871 const uint8_t *buf,
1872 uint32_t num_bytes)
1873{
1874 struct i3c_msg msg[2];
1875
1876 msg[0].buf = &start_addr;
1877 msg[0].len = 1U;
1878 msg[0].flags = I3C_MSG_WRITE;
1879
1880 msg[1].buf = (uint8_t *)buf;
1881 msg[1].len = num_bytes;
1882 msg[1].flags = I3C_MSG_WRITE | I3C_MSG_STOP;
1883
1884 return i3c_transfer(target, msg, 2);
1885}
1886
1901static inline int i3c_reg_read_byte(struct i3c_device_desc *target,
1902 uint8_t reg_addr, uint8_t *value)
1903{
1904 return i3c_write_read(target,
1905 &reg_addr, sizeof(reg_addr),
1906 value, sizeof(*value));
1907}
1908
1926static inline int i3c_reg_write_byte(struct i3c_device_desc *target,
1927 uint8_t reg_addr, uint8_t value)
1928{
1929 uint8_t tx_buf[2] = {reg_addr, value};
1930
1931 return i3c_write(target, tx_buf, 2);
1932}
1933
1952static inline int i3c_reg_update_byte(struct i3c_device_desc *target,
1953 uint8_t reg_addr, uint8_t mask,
1954 uint8_t value)
1955{
1956 uint8_t old_value, new_value;
1957 int rc;
1958
1959 rc = i3c_reg_read_byte(target, reg_addr, &old_value);
1960 if (rc != 0) {
1961 return rc;
1962 }
1963
1964 new_value = (old_value & ~mask) | (value & mask);
1965 if (new_value == old_value) {
1966 return 0;
1967 }
1968
1969 return i3c_reg_write_byte(target, reg_addr, new_value);
1970}
1971
1996void i3c_dump_msgs(const char *name, const struct i3c_msg *msgs,
1997 uint8_t num_msgs, struct i3c_device_desc *target);
1998
2016int i3c_bus_init(const struct device *dev,
2017 const struct i3c_dev_list *i3c_dev_list);
2018
2039
2040/*
2041 * This needs to be after declaration of struct i3c_driver_api,
2042 * or else compiler complains about undefined type inside
2043 * the static inline API wrappers.
2044 */
2046
2047#ifdef __cplusplus
2048}
2049#endif
2050
2055#include <syscalls/i3c.h>
2056
2057#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:1685
static int i3c_ibi_has_payload(struct i3c_device_desc *target)
Check if target's IBI has payload.
Definition: i3c.h:1708
static int i3c_ibi_raise(const struct device *dev, struct i3c_ibi *request)
Raise an In-Band Interrupt (IBI).
Definition: i3c.h:1634
static int i3c_device_is_ibi_capable(struct i3c_device_desc *target)
Check if device is IBI capable.
Definition: i3c.h:1725
static int i3c_ibi_enable(struct i3c_device_desc *target)
Enable IBI of a target device.
Definition: i3c.h:1661
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:72
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:1605
i3c_sdr_target_error_codes
I3C SDR Target Error Codes.
Definition: i3c.h:330
static int i3c_configure(const struct device *dev, enum i3c_config_type type, void *config)
Configure the I3C hardware.
Definition: i3c.h:1306
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:489
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:251
int i3c_detach_i3c_device(struct i3c_device_desc *target)
Detach I3C Device.
i3c_bus_mode
I3C bus mode.
Definition: i3c.h:218
static int i3c_recover_bus(const struct device *dev)
Attempt bus recovery on the I3C bus.
Definition: i3c.h:1362
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:1339
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:297
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:1504
#define I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE
IBI Payload bit.
Definition: i3c.h:81
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:267
@ I3C_ERROR_TE_UNKNOWN
Unknown error (not official error code)
Definition: i3c.h:359
@ I3C_ERROR_TE6
Monitoring Error.
Definition: i3c.h:353
@ I3C_ERROR_TE4
0x7E/R missing after RESTART during Dynamic Address Arbitration
Definition: i3c.h:347
@ I3C_ERROR_TE3
Assigned Address during Dynamic Address Arbitration.
Definition: i3c.h:344
@ I3C_ERROR_TE_NONE
No error (not official error code)
Definition: i3c.h:362
@ I3C_ERROR_TE_MAX
Definition: i3c.h:364
@ I3C_ERROR_TE1
CCC Code.
Definition: i3c.h:338
@ I3C_ERROR_TE5
Transaction after detecting CCC.
Definition: i3c.h:350
@ I3C_ERROR_DBR
Dead Bus Recovery.
Definition: i3c.h:356
@ I3C_ERROR_TE2
Write Data.
Definition: i3c.h:341
@ I3C_ERROR_TE_INVALID
Definition: i3c.h:365
@ I3C_ERROR_TE0
Invalid Broadcast Address or Dynamic Address after DA assignment.
Definition: i3c.h:335
@ I3C_CONFIG_TARGET
Definition: i3c.h:491
@ I3C_CONFIG_CUSTOM
Definition: i3c.h:492
@ I3C_CONFIG_CONTROLLER
Definition: i3c.h:490
@ I3C_I2C_SPEED_INVALID
Definition: i3c.h:259
@ I3C_I2C_SPEED_MAX
Definition: i3c.h:258
@ I3C_I2C_SPEED_FMPLUS
I2C FM+ mode.
Definition: i3c.h:256
@ I3C_I2C_SPEED_FM
I2C FM mode.
Definition: i3c.h:253
@ I3C_BUS_MODE_INVALID
Definition: i3c.h:243
@ I3C_BUS_MODE_PURE
Only I3C devices are on the bus.
Definition: i3c.h:220
@ I3C_BUS_MODE_MIXED_FAST
Both I3C and legacy I2C devices are on the bus.
Definition: i3c.h:226
@ I3C_BUS_MODE_MAX
Definition: i3c.h:242
@ I3C_BUS_MODE_MIXED_LIMITED
Both I3C and legacy I2C devices are on the bus.
Definition: i3c.h:233
@ I3C_BUS_MODE_MIXED_SLOW
Both I3C and legacy I2C devices are on the bus.
Definition: i3c.h:240
@ I3C_ERROR_CE0
Transaction after sending CCC.
Definition: i3c.h:299
@ I3C_ERROR_CE2
No response to broadcast address (0x7E)
Definition: i3c.h:305
@ I3C_ERROR_CE_INVALID
Definition: i3c.h:317
@ I3C_ERROR_CE_MAX
Definition: i3c.h:316
@ I3C_ERROR_CE_UNKNOWN
Unknown error (not official error code)
Definition: i3c.h:311
@ I3C_ERROR_CE3
Failed Controller Handoff.
Definition: i3c.h:308
@ I3C_ERROR_CE1
Monitoring Error.
Definition: i3c.h:302
@ I3C_ERROR_CE_NONE
No error (not official error code)
Definition: i3c.h:314
@ I3C_DATA_RATE_MAX
Definition: i3c.h:283
@ I3C_DATA_RATE_INVALID
Definition: i3c.h:284
@ I3C_DATA_RATE_HDR_TSP
High Data Rate - Ternary Symbol for Pure Bus.
Definition: i3c.h:278
@ I3C_DATA_RATE_HDR_DDR
High Data Rate - Double Data Rate messaging.
Definition: i3c.h:272
@ I3C_DATA_RATE_SDR
Single Data Rate messaging.
Definition: i3c.h:269
@ I3C_DATA_RATE_HDR_TSL
High Data Rate - Ternary Symbol Legacy-inclusive-Bus.
Definition: i3c.h:275
@ I3C_DATA_RATE_HDR_BT
High Data Rate - Bulk Transport.
Definition: i3c.h:281
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:389
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:1805
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:1839
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:1952
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:382
#define I3C_MSG_WRITE
Write message to I3C bus.
Definition: i3c.h:379
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:1901
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:1751
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:1776
#define I3C_MSG_RESTART
RESTART I3C transaction for this message.
Definition: i3c.h:400
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:1869
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:1926
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:381
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:387
Structure to keep track of addresses on I3C bus.
Definition: addresses.h:57
Payload structure for one CCC transaction.
Definition: ccc.h:256
Configuration parameters for I3C hardware to act as controller.
Definition: i3c.h:498
uint32_t i3c
SCL frequency (in Hz) for I3C transfers.
Definition: i3c.h:507
uint8_t supported_hdr
Bit mask of supported HDR modes (0 - 7).
Definition: i3c.h:519
struct i3c_config_controller::@155 scl
bool is_secondary
True if the controller is to be the secondary controller of the bus.
Definition: i3c.h:503
uint32_t i2c
SCL frequency (in Hz) for I2C transfers.
Definition: i3c.h:510
Custom I3C configuration parameters.
Definition: i3c.h:530
void * ptr
Pointer to configuration parameter.
Definition: i3c.h:544
uint32_t id
ID of the configuration parameter.
Definition: i3c.h:532
uintptr_t val
Value of configuration parameter.
Definition: i3c.h:536
Structure for describing attached devices for a controller.
Definition: i3c.h:1101
sys_slist_t i3c
Linked list of attached I3C devices.
Definition: i3c.h:1114
struct i3c_dev_attached_list::@160 devices
sys_slist_t i2c
Linked list of attached I2C devices.
Definition: i3c.h:1119
struct i3c_addr_slots addr_slots
Address slots:
Definition: i3c.h:1108
Structure for describing known devices for a controller.
Definition: i3c.h:1131
struct i3c_i2c_device_desc *const i2c
Pointer to array of known I2C devices.
Definition: i3c.h:1140
const uint8_t num_i3c
Number of I3C devices in array.
Definition: i3c.h:1145
struct i3c_device_desc *const i3c
Pointer to array of known I3C devices.
Definition: i3c.h:1135
const uint8_t num_i2c
Number of I2C devices in array.
Definition: i3c.h:1150
Structure describing a I3C target device.
Definition: i3c.h:894
uint8_t maxwr
Maximum Write Speed.
Definition: i3c.h:1007
const uint8_t init_dynamic_addr
Initial dynamic address.
Definition: i3c.h:935
uint32_t max_read_turnaround
Maximum Read turnaround time in microseconds.
Definition: i3c.h:1010
const uint8_t static_addr
Static address for this target device.
Definition: i3c.h:924
uint8_t max_ibi
Maximum IBI Payload Size.
Definition: i3c.h:1021
i3c_target_ibi_cb_t ibi_cb
Private data by the controller to aid in transactions.
Definition: i3c.h:1036
uint8_t group_addr
Group address for this target device.
Definition: i3c.h:960
uint16_t mwl
Maximum Write Length.
Definition: i3c.h:1018
struct i3c_device_desc::@158 data_speed
uint8_t dynamic_addr
Dynamic Address for this target device used for communication.
Definition: i3c.h:950
const struct device *const dev
Device driver instance of the I3C device.
Definition: i3c.h:907
struct i3c_device_desc::@159 data_length
uint16_t mrl
Maximum Read Length.
Definition: i3c.h:1015
const uint64_t pid
Device Provisioned ID.
Definition: i3c.h:910
uint8_t maxrd
Maximum Read Speed.
Definition: i3c.h:1004
uint8_t bcr
Bus Characteristic Register (BCR)
Definition: i3c.h:992
uint8_t dcr
Device Characteristic Register (DCR)
Definition: i3c.h:1000
const struct device *const bus
Used to attach this node onto a linked list.
Definition: i3c.h:904
Structure used for matching I3C devices.
Definition: i3c.h:859
const uint64_t pid
Device Provisioned ID.
Definition: i3c.h:861
This structure is common to all I3C drivers and is expected to be the first element in the object poi...
Definition: i3c.h:1158
struct i3c_dev_list dev_list
I3C/I2C device list struct.
Definition: i3c.h:1160
This structure is common to all I3C drivers and is expected to be the first element in the driver's s...
Definition: i3c.h:1167
struct i3c_config_controller ctrl_config
Controller Configuration.
Definition: i3c.h:1169
struct i3c_dev_attached_list attached_dev
Attached I3C/I2C devices and addresses.
Definition: i3c.h:1172
Structure describing a I2C device on I3C bus.
Definition: i3c.h:1053
const struct device * bus
Used to attach this node onto a linked list.
Definition: i3c.h:1063
const uint16_t addr
Static address for this I2C device.
Definition: i3c.h:1066
const uint8_t lvr
Legacy Virtual Register (LVR)
Definition: i3c.h:1082
Struct for IBI request.
Definition: ibi.h:57
One I3C Message.
Definition: i3c.h:465
uint8_t flags
Flags for this message.
Definition: i3c.h:473
uint8_t hdr_mode
HDR mode (I3C_MSG_HDR_MODE*) for transfer if any I3C_MSG_HDR_* is set in flags.
Definition: i3c.h:481
uint8_t * buf
Data buffer in bytes.
Definition: i3c.h:467
uint32_t len
Length of buffer in bytes.
Definition: i3c.h:470
Structure describing a device that supports the I3C target API.
Definition: target_device.h:92