Zephyr Project API 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ccc.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_CCC_H_
9#define ZEPHYR_INCLUDE_DRIVERS_I3C_CCC_H_
10
18#include <stdint.h>
19
20#include <zephyr/device.h>
21#include <zephyr/toolchain.h>
22#include <zephyr/sys/util.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
29#define I3C_CCC_BROADCAST_MAX_ID 0x7FU
30
36#define I3C_CCC_ENEC(broadcast) ((broadcast) ? 0x00U : 0x80U)
37
43#define I3C_CCC_DISEC(broadcast) ((broadcast) ? 0x01U : 0x81U)
44
51#define I3C_CCC_ENTAS(as, broadcast) (((broadcast) ? 0x02U : 0x82U) + (as))
52
58#define I3C_CCC_ENTAS0(broadcast) I3C_CCC_ENTAS(0, broadcast)
59
65#define I3C_CCC_ENTAS1(broadcast) I3C_CCC_ENTAS(1, broadcast)
66
72#define I3C_CCC_ENTAS2(broadcast) I3C_CCC_ENTAS(2, broadcast)
73
79#define I3C_CCC_ENTAS3(broadcast) I3C_CCC_ENTAS(3, broadcast)
80
82#define I3C_CCC_RSTDAA 0x06U
83
85#define I3C_CCC_ENTDAA 0x07U
86
88#define I3C_CCC_DEFTGTS 0x08U
89
95#define I3C_CCC_SETMWL(broadcast) ((broadcast) ? 0x09U : 0x89U)
96
102#define I3C_CCC_SETMRL(broadcast) ((broadcast) ? 0x0AU : 0x8AU)
103
105#define I3C_CCC_ENTTM 0x0BU
106
108#define I3C_CCC_SETBUSCON 0x0CU
109
115#define I3C_CCC_ENDXFER(broadcast) ((broadcast) ? 0x12U : 0x92U)
116
118#define I3C_CCC_ENTHDR(x) (0x20U + (x))
119
121#define I3C_CCC_ENTHDR0 0x20U
122
124#define I3C_CCC_ENTHDR1 0x21U
125
127#define I3C_CCC_ENTHDR2 0x22U
128
130#define I3C_CCC_ENTHDR3 0x23U
131
133#define I3C_CCC_ENTHDR4 0x24U
134
136#define I3C_CCC_ENTHDR5 0x25U
137
139#define I3C_CCC_ENTHDR6 0x26U
140
142#define I3C_CCC_ENTHDR7 0x27U
143
149#define I3C_CCC_SETXTIME(broadcast) ((broadcast) ? 0x28U : 0x98U)
150
152#define I3C_CCC_SETAASA 0x29U
153
159#define I3C_CCC_RSTACT(broadcast) ((broadcast) ? 0x2AU : 0x9AU)
160
162#define I3C_CCC_DEFGRPA 0x2BU
163
169#define I3C_CCC_RSTGRPA(broadcast) ((broadcast) ? 0x2CU : 0x9CU)
170
172#define I3C_CCC_MLANE(broadcast) ((broadcast) ? 0x2DU : 0x9DU)
173
180#define I3C_CCC_VENDOR(broadcast, id) ((id) + ((broadcast) ? 0x61U : 0xE0U))
181
183#define I3C_CCC_SETDASA 0x87U
184
186#define I3C_CCC_SETNEWDA 0x88U
187
189#define I3C_CCC_GETMWL 0x8BU
190
192#define I3C_CCC_GETMRL 0x8CU
193
195#define I3C_CCC_GETPID 0x8DU
196
198#define I3C_CCC_GETBCR 0x8EU
199
201#define I3C_CCC_GETDCR 0x8FU
202
204#define I3C_CCC_GETSTATUS 0x90U
205
207#define I3C_CCC_GETACCCR 0x91U
208
210#define I3C_CCC_SETBRGTGT 0x93U
211
213#define I3C_CCC_GETMXDS 0x94U
214
216#define I3C_CCC_GETCAPS 0x95U
217
219#define I3C_CCC_SETROUTE 0x96U
220
222#define I3C_CCC_D2DXFER 0x97U
223
225#define I3C_CCC_GETXTIME 0x99U
226
228#define I3C_CCC_SETGRPA 0x9BU
229
230struct i3c_device_desc;
231
271
276 struct {
281
289
291 size_t data_len;
292
299 size_t num_xfer;
300
309
310 struct {
320
324};
325
340} __packed;
341
343#define I3C_CCC_ENEC_EVT_ENINTR BIT(0)
344
346#define I3C_CCC_ENEC_EVT_ENCR BIT(1)
347
349#define I3C_CCC_ENEC_EVT_ENHJ BIT(3)
350
351#define I3C_CCC_ENEC_EVT_ALL \
352 (I3C_CCC_ENEC_EVT_ENINTR | I3C_CCC_ENEC_EVT_ENCR | I3C_CCC_ENEC_EVT_ENHJ)
353
355#define I3C_CCC_DISEC_EVT_DISINTR BIT(0)
356
358#define I3C_CCC_DISEC_EVT_DISCR BIT(1)
359
361#define I3C_CCC_DISEC_EVT_DISHJ BIT(3)
362
363#define I3C_CCC_DISEC_EVT_ALL \
364 (I3C_CCC_DISEC_EVT_DISINTR | I3C_CCC_DISEC_EVT_DISCR | I3C_CCC_DISEC_EVT_DISHJ)
365
366/*
367 * Events for both enabling and disabling since
368 * they have the same bits.
369 */
370
372#define I3C_CCC_EVT_INTR BIT(0)
373
375#define I3C_CCC_EVT_CR BIT(1)
376
378#define I3C_CCC_EVT_HJ BIT(3)
379
381#define I3C_CCC_EVT_ALL \
382 (I3C_CCC_EVT_INTR | I3C_CCC_EVT_CR | I3C_CCC_EVT_HJ)
383
395} __packed;
396
408
411} __packed;
412
432
460
479
492
522} __packed;
523
534} __packed;
535
542} __packed;
543
550} __packed;
551
552
563
577
582 struct {
598
599 union {
606
620
623} __packed;
624
626#define I3C_CCC_GETSTATUS_PROTOCOL_ERR BIT(5)
627
629#define I3C_CCC_GETSTATUS_ACTIVITY_MODE_MASK GENMASK(7U, 6U)
630
639#define I3C_CCC_GETSTATUS_ACTIVITY_MODE(status) \
640 FIELD_GET(I3C_CCC_GETSTATUS_ACTIVITY_MODE_MASK, (status))
641
643#define I3C_CCC_GETSTATUS_NUM_INT_MASK GENMASK(3U, 0U)
644
653#define I3C_CCC_GETSTATUS_NUM_INT(status) \
654 FIELD_GET(I3C_CCC_GETSTATUS_NUM_INT_MASK, (status))
655
657#define I3C_CCC_GETSTATUS_PRECR_DEEP_SLEEP_DETECTED BIT(0)
658
660#define I3C_CCC_GETSTATUS_PRECR_HANDOFF_DELAY_NACK BIT(1)
661
684
699
713
730
731
736 struct {
739
743
744 struct {
747
750
758
759 struct {
766
774} __packed;
775
777#define I3C_CCC_GETMXDS_MAX_SDR_FSCL_MAX 0
778
780#define I3C_CCC_GETMXDS_MAX_SDR_FSCL_8MHZ 1
781
783#define I3C_CCC_GETMXDS_MAX_SDR_FSCL_6MHZ 2
784
786#define I3C_CCC_GETMXDS_MAX_SDR_FSCL_4MHZ 3
787
789#define I3C_CCC_GETMXDS_MAX_SDR_FSCL_2MHZ 4
790
792#define I3C_CCC_GETMXDS_TSCO_8NS 0
793
795#define I3C_CCC_GETMXDS_TSCO_9NS 1
796
798#define I3C_CCC_GETMXDS_TSCO_10NS 2
799
801#define I3C_CCC_GETMXDS_TSCO_11NS 3
802
804#define I3C_CCC_GETMXDS_TSCO_12NS 4
805
807#define I3C_CCC_GETMXDS_TSCO_GT_12NS 7
808
810#define I3C_CCC_GETMXDS_MAXWR_DEFINING_BYTE_SUPPORT BIT(3)
811
813#define I3C_CCC_GETMXDS_MAXWR_MAX_SDR_FSCL_MASK GENMASK(2U, 0U)
814
823#define I3C_CCC_GETMXDS_MAXWR_MAX_SDR_FSCL(maxwr) \
824 FIELD_GET(I3C_CCC_GETMXDS_MAXWR_MAX_SDR_FSCL_MASK, (maxwr))
825
827#define I3C_CCC_GETMXDS_MAXRD_W2R_PERMITS_STOP_BETWEEN BIT(6)
828
830#define I3C_CCC_GETMXDS_MAXRD_TSCO_MASK GENMASK(5U, 3U)
831
840#define I3C_CCC_GETMXDS_MAXRD_TSCO(maxrd) \
841 FIELD_GET(I3C_CCC_GETMXDS_MAXRD_TSCO_MASK, (maxrd))
842
844#define I3C_CCC_GETMXDS_MAXRD_MAX_SDR_FSCL_MASK GENMASK(2U, 0U)
845
854#define I3C_CCC_GETMXDS_MAXRD_MAX_SDR_FSCL(maxrd) \
855 FIELD_GET(I3C_CCC_GETMXDS_MAXRD_MAX_SDR_FSCL_MASK, (maxrd))
856
858#define I3C_CCC_GETMXDS_CRDHLY1_SET_BUS_ACT_STATE BIT(2)
859
861#define I3C_CCC_GETMXDS_CRDHLY1_CTRL_HANDOFF_ACT_STATE_MASK GENMASK(1U, 0U)
862
871#define I3C_CCC_GETMXDS_CRDHLY1_CTRL_HANDOFF_ACT_STATE(crhdly1) \
872 FIELD_GET(I3C_CCC_GETMXDS_CRDHLY1_CTRL_HANDOFF_ACT_STATE_MASK, (chrdly1))
873
884
907
916 union {
925
953
954 union {
961
968
982
996} __packed;
997
999#define I3C_CCC_GETCAPS1_HDR_DDR BIT(0)
1000
1002#define I3C_CCC_GETCAPS1_HDR_TSP BIT(1)
1003
1005#define I3C_CCC_GETCAPS1_HDR_TSL BIT(2)
1006
1008#define I3C_CCC_GETCAPS1_HDR_BT BIT(3)
1009
1017#define I3C_CCC_GETCAPS1_HDR_MODE(x) BIT(x)
1018
1020#define I3C_CCC_GETCAPS1_HDR_MODE0 BIT(0)
1021
1023#define I3C_CCC_GETCAPS1_HDR_MODE1 BIT(1)
1024
1026#define I3C_CCC_GETCAPS1_HDR_MODE2 BIT(2)
1027
1029#define I3C_CCC_GETCAPS1_HDR_MODE3 BIT(3)
1030
1032#define I3C_CCC_GETCAPS1_HDR_MODE4 BIT(4)
1033
1035#define I3C_CCC_GETCAPS1_HDR_MODE5 BIT(5)
1036
1038#define I3C_CCC_GETCAPS1_HDR_MODE6 BIT(6)
1039
1041#define I3C_CCC_GETCAPS1_HDR_MODE7 BIT(7)
1042
1044#define I3C_CCC_GETCAPS2_HDRDDR_WRITE_ABORT BIT(6)
1045
1047#define I3C_CCC_GETCAPS2_HDRDDR_ABORT_CRC BIT(7)
1048
1053#define I3C_CCC_GETCAPS2_GRPADDR_CAP_MASK GENMASK(5U, 4U)
1054
1063#define I3C_CCC_GETCAPS2_GRPADDR_CAP(getcaps2) \
1064 FIELD_GET(I3C_CCC_GETCAPS2_GRPADDR_CAP_MASK, (getcaps2))
1065
1070#define I3C_CCC_GETCAPS2_SPEC_VER_MASK GENMASK(3U, 0U)
1071
1081#define I3C_CCC_GETCAPS2_SPEC_VER(getcaps2) \
1082 FIELD_GET(I3C_CCC_GETCAPS2_SPEC_VER_MASK, (getcaps2))
1083
1088#define I3C_CCC_GETCAPS3_MLANE_SUPPORT BIT(0)
1089
1094#define I3C_CCC_GETCAPS3_D2DXFER_SUPPORT BIT(1)
1095
1100#define I3C_CCC_GETCAPS3_D2DXFER_IBI_CAPABLE BIT(2)
1101
1106#define I3C_CCC_GETCAPS3_GETCAPS_DEFINING_BYTE_SUPPORT BIT(3)
1107
1112#define I3C_CCC_GETCAPS3_GETSTATUS_DEFINING_BYTE_SUPPORT BIT(4)
1113
1118#define I3C_CCC_GETCAPS3_HDRBT_CRC32_SUPPORT BIT(5)
1119
1124#define I3C_CCC_GETCAPS3_IBI_MDR_PENDING_READ_NOTIFICATION BIT(6)
1125
1130#define I3C_CCC_GETCAPS_TESTPAT1 0xA5
1131
1136#define I3C_CCC_GETCAPS_TESTPAT2 0x5A
1137
1142#define I3C_CCC_GETCAPS_TESTPAT3 0xA5
1143
1148#define I3C_CCC_GETCAPS_TESTPAT4 0x5A
1149
1154#define I3C_CCC_GETCAPS_TESTPAT 0xA55AA55A
1155
1160#define I3C_CCC_GETCAPS_CRCAPS1_HJ_SUPPORT BIT(0)
1161
1166#define I3C_CCC_GETCAPS_CRCAPS1_GRP_MANAGEMENT_SUPPORT BIT(1)
1167
1172#define I3C_CCC_GETCAPS_CRCAPS1_ML_SUPPORT BIT(2)
1173
1178#define I3C_CCC_GETCAPS_CRCAPS2_IBI_TIR_SUPPORT BIT(0)
1179
1184#define I3C_CCC_GETCAPS_CRCAPS2_CONTROLLER_PASSBACK BIT(1)
1185
1190#define I3C_CCC_GETCAPS_CRCAPS2_DEEP_SLEEP_CAPABLE BIT(2)
1191
1196#define I3C_CCC_GETCAPS_CRCAPS2_DELAYED_CONTROLLER_HANDOFF BIT(3)
1197
1199#define I3C_CCC_GETCAPS_VTCAP1_VITRUAL_TARGET_TYPE_MASK GENMASK(2U, 0U)
1200
1209#define I3C_CCC_GETCAPS_VTCAP1_VITRUAL_TARGET_TYPE(vtcap1) \
1210 FIELD_GET(I3C_CCC_GETCAPS_VTCAP1_VITRUAL_TARGET_TYPE_MASK, (vtcap1))
1211
1216#define I3C_CCC_GETCAPS_VTCAP1_SIDE_EFFECTS BIT(4)
1217
1222#define I3C_CCC_GETCAPS_VTCAP1_SHARED_PERIPH_DETECT BIT(5)
1223
1225#define I3C_CCC_GETCAPS_VTCAP2_INTERRUPT_REQUESTS_MASK GENMASK(1U, 0U)
1226
1235#define I3C_CCC_GETCAPS_VTCAP2_INTERRUPT_REQUESTS(vtcap2) \
1236 FIELD_GET(I3C_CCC_GETCAPS_VTCAP2_INTERRUPT_REQUESTS_MASK, (vtcap2))
1237
1242#define I3C_CCC_GETCAPS_VTCAP2_ADDRESS_REMAPPING BIT(2)
1243
1245#define I3C_CCC_GETCAPS_VTCAP2_BUS_CONTEXT_AND_COND_MASK GENMASK(4U, 3U)
1246
1255#define I3C_CCC_GETCAPS_VTCAP2_BUS_CONTEXT_AND_COND(vtcap2) \
1256 FIELD_GET(I3C_CCC_GETCAPS_VTCAP2_BUS_CONTEXT_AND_COND_MASK, (vtcap2))
1257
1289
1318#define I3C_CCC_SETBUSCON_I3C_SPEC_MINOR_VER_MASK GENMASK(3U, 0U)
1319
1327#define I3C_CCC_SETBUSCON_I3C_SPEC_MINOR_VER(y) \
1328 FIELD_PREP(I3C_CCC_SETBUSCON_I3C_SPEC_MINOR_VER_MASK, (y))
1329
1331#define I3C_CCC_SETBUSCON_I3C_SPEC_I3C_SPEC 0
1332
1334#define I3C_CCC_SETBUSCON_I3C_SPEC_I3C_BASIC_SPEC BIT(4)
1335
1337#define I3C_CCC_SETBUSCON_I3C_SPEC_I3C_SPEC_EDITORIAL_1_Y_0 0
1338
1340#define I3C_CCC_SETBUSCON_I3C_SPEC_I3C_SPEC_EDITORIAL_1_Y_1 BIT(5)
1341
1356#define I3C_CCC_SETBUSCON_OTHER_STANDARDS_JEDEC_SIDEBAND 128
1357
1365#define I3C_CCC_SETBUSCON_OTHER_STANDARDS_MCTP 129
1366
1373#define I3C_CCC_SETBUSCON_OTHER_STANDARDS_ETSI 130
1374
1387static inline bool i3c_ccc_is_payload_broadcast(const struct i3c_ccc_payload *payload)
1388{
1389 return (payload->ccc.id <= I3C_CCC_BROADCAST_MAX_ID);
1390}
1391
1404 struct i3c_ccc_getbcr *bcr);
1405
1418 struct i3c_ccc_getdcr *dcr);
1419
1432 struct i3c_ccc_getpid *pid);
1433
1445int i3c_ccc_do_rstact_all(const struct device *controller,
1446 enum i3c_ccc_rstact_defining_byte action);
1447
1461int i3c_ccc_do_rstact(const struct i3c_device_desc *target,
1462 enum i3c_ccc_rstact_defining_byte action,
1463 bool get,
1464 uint8_t *data);
1465
1477static inline int i3c_ccc_do_rstact_fmt2(const struct i3c_device_desc *target,
1478 enum i3c_ccc_rstact_defining_byte action)
1479{
1480 return i3c_ccc_do_rstact(target, action, false, NULL);
1481}
1482
1495static inline int i3c_ccc_do_rstact_fmt3(const struct i3c_device_desc *target,
1496 enum i3c_ccc_rstact_defining_byte action,
1497 uint8_t *data)
1498{
1499 return i3c_ccc_do_rstact(target, action, true, data);
1500}
1501
1511int i3c_ccc_do_rstdaa_all(const struct device *controller);
1512
1527int i3c_ccc_do_setdasa(const struct i3c_device_desc *target,
1528 struct i3c_ccc_address da);
1529
1543int i3c_ccc_do_setnewda(const struct i3c_device_desc *target,
1544 struct i3c_ccc_address new_da);
1545
1558int i3c_ccc_do_events_all_set(const struct device *controller,
1559 bool enable, struct i3c_ccc_events *events);
1560
1574 bool enable, struct i3c_ccc_events *events);
1575
1587int i3c_ccc_do_entas(const struct i3c_device_desc *target, uint8_t as);
1588
1599static inline int i3c_ccc_do_entas0(const struct i3c_device_desc *target)
1600{
1601 return i3c_ccc_do_entas(target, 0);
1602}
1603
1614static inline int i3c_ccc_do_entas1(const struct i3c_device_desc *target)
1615{
1616 return i3c_ccc_do_entas(target, 1);
1617}
1618
1629static inline int i3c_ccc_do_entas2(const struct i3c_device_desc *target)
1630{
1631 return i3c_ccc_do_entas(target, 2);
1632}
1633
1644static inline int i3c_ccc_do_entas3(const struct i3c_device_desc *target)
1645{
1646 return i3c_ccc_do_entas(target, 3);
1647}
1648
1659int i3c_ccc_do_entas_all(const struct device *controller, uint8_t as);
1660
1670static inline int i3c_ccc_do_entas0_all(const struct device *controller)
1671{
1672 return i3c_ccc_do_entas_all(controller, 0);
1673}
1674
1684static inline int i3c_ccc_do_entas1_all(const struct device *controller)
1685{
1686 return i3c_ccc_do_entas_all(controller, 1);
1687}
1688
1698static inline int i3c_ccc_do_entas2_all(const struct device *controller)
1699{
1700 return i3c_ccc_do_entas_all(controller, 2);
1701}
1702
1712static inline int i3c_ccc_do_entas3_all(const struct device *controller)
1713{
1714 return i3c_ccc_do_entas_all(controller, 3);
1715}
1716
1728int i3c_ccc_do_setmwl_all(const struct device *controller,
1729 const struct i3c_ccc_mwl *mwl);
1730
1742int i3c_ccc_do_setmwl(const struct i3c_device_desc *target,
1743 const struct i3c_ccc_mwl *mwl);
1744
1756int i3c_ccc_do_getmwl(const struct i3c_device_desc *target,
1757 struct i3c_ccc_mwl *mwl);
1758
1772int i3c_ccc_do_setmrl_all(const struct device *controller,
1773 const struct i3c_ccc_mrl *mrl,
1774 bool has_ibi_size);
1775
1790int i3c_ccc_do_setmrl(const struct i3c_device_desc *target,
1791 const struct i3c_ccc_mrl *mrl);
1792
1807int i3c_ccc_do_getmrl(const struct i3c_device_desc *target,
1808 struct i3c_ccc_mrl *mrl);
1809
1820int i3c_ccc_do_enttm(const struct device *controller,
1821 enum i3c_ccc_enttm_defbyte defbyte);
1822
1839int i3c_ccc_do_getstatus(const struct i3c_device_desc *target,
1840 union i3c_ccc_getstatus *status,
1841 enum i3c_ccc_getstatus_fmt fmt,
1842 enum i3c_ccc_getstatus_defbyte defbyte);
1843
1855static inline int i3c_ccc_do_getstatus_fmt1(const struct i3c_device_desc *target,
1856 union i3c_ccc_getstatus *status)
1857{
1858 return i3c_ccc_do_getstatus(target, status,
1861}
1862
1875static inline int i3c_ccc_do_getstatus_fmt2(const struct i3c_device_desc *target,
1876 union i3c_ccc_getstatus *status,
1877 enum i3c_ccc_getstatus_defbyte defbyte)
1878{
1879 return i3c_ccc_do_getstatus(target, status,
1880 GETSTATUS_FORMAT_2, defbyte);
1881}
1882
1899int i3c_ccc_do_getcaps(const struct i3c_device_desc *target,
1900 union i3c_ccc_getcaps *caps,
1901 enum i3c_ccc_getcaps_fmt fmt,
1902 enum i3c_ccc_getcaps_defbyte defbyte);
1903
1915static inline int i3c_ccc_do_getcaps_fmt1(const struct i3c_device_desc *target,
1916 union i3c_ccc_getcaps *caps)
1917{
1918 return i3c_ccc_do_getcaps(target, caps,
1921}
1922
1935static inline int i3c_ccc_do_getcaps_fmt2(const struct i3c_device_desc *target,
1936 union i3c_ccc_getcaps *caps,
1937 enum i3c_ccc_getcaps_defbyte defbyte)
1938{
1939 return i3c_ccc_do_getcaps(target, caps,
1940 GETCAPS_FORMAT_2, defbyte);
1941}
1942
1956int i3c_ccc_do_setvendor(const struct i3c_device_desc *target,
1957 uint8_t id,
1958 uint8_t *payload,
1959 size_t len);
1960
1975int i3c_ccc_do_getvendor(const struct i3c_device_desc *target,
1976 uint8_t id,
1977 uint8_t *payload,
1978 size_t len,
1979 size_t *num_xfer);
1980
1998 uint8_t id,
1999 uint8_t defbyte,
2000 uint8_t *payload,
2001 size_t len,
2002 size_t *num_xfer);
2003
2016int i3c_ccc_do_setvendor_all(const struct device *controller,
2017 uint8_t id,
2018 uint8_t *payload,
2019 size_t len);
2020
2032int i3c_ccc_do_setaasa_all(const struct device *controller);
2033
2050int i3c_ccc_do_getmxds(const struct i3c_device_desc *target,
2051 union i3c_ccc_getmxds *caps,
2052 enum i3c_ccc_getmxds_fmt fmt,
2053 enum i3c_ccc_getmxds_defbyte defbyte);
2054
2066static inline int i3c_ccc_do_getmxds_fmt1(const struct i3c_device_desc *target,
2067 union i3c_ccc_getmxds *caps)
2068{
2069 return i3c_ccc_do_getmxds(target, caps,
2072}
2073
2085static inline int i3c_ccc_do_getmxds_fmt2(const struct i3c_device_desc *target,
2086 union i3c_ccc_getmxds *caps)
2087{
2088 return i3c_ccc_do_getmxds(target, caps,
2091}
2092
2105static inline int i3c_ccc_do_getmxds_fmt3(const struct i3c_device_desc *target,
2106 union i3c_ccc_getmxds *caps,
2107 enum i3c_ccc_getmxds_defbyte defbyte)
2108{
2109 return i3c_ccc_do_getmxds(target, caps,
2110 GETMXDS_FORMAT_3, defbyte);
2111}
2112
2121int i3c_ccc_do_deftgts_all(const struct device *controller,
2122 struct i3c_ccc_deftgts *deftgts);
2123
2135int i3c_ccc_do_setbuscon(const struct device *controller,
2136 uint8_t *context, uint16_t length);
2137
2138#ifdef __cplusplus
2139}
2140#endif
2141
2146#endif /* ZEPHYR_INCLUDE_DRIVERS_I3C_CCC_H_ */
irp nz macro MOVR cc s mov cc s endm endr irp as
Definition asm-macro-32-bit-gnu.h:16
i3c_sdr_controller_error_types
I3C SDR Controller Error Types.
Definition error_types.h:24
static int i3c_ccc_do_entas0_all(const struct device *controller)
Broadcast ENTAS0.
Definition ccc.h:1670
int i3c_ccc_do_deftgts_all(const struct device *controller, struct i3c_ccc_deftgts *deftgts)
Broadcast DEFTGTS.
i3c_ccc_getstatus_defbyte
Defining byte values for GETSTATUS Format 2.
Definition ccc.h:567
i3c_ccc_getmxds_fmt
Indicate which format of getmxds to use.
Definition ccc.h:703
static int i3c_ccc_do_getstatus_fmt1(const struct i3c_device_desc *target, union i3c_ccc_getstatus *status)
Single target GETSTATUS to Get Target Status (Format 1).
Definition ccc.h:1855
int i3c_ccc_do_setmrl_all(const struct device *controller, const struct i3c_ccc_mrl *mrl, bool has_ibi_size)
Broadcast SETMRL to Set Maximum Read Length.
int i3c_ccc_do_getvendor(const struct i3c_device_desc *target, uint8_t id, uint8_t *payload, size_t len, size_t *num_xfer)
Single target to Get Vendor / Standard Extension CCC.
static int i3c_ccc_do_entas3(const struct i3c_device_desc *target)
Direct ENTAS3.
Definition ccc.h:1644
i3c_ccc_enttm_defbyte
Defining byte values for ENTTM.
Definition ccc.h:483
int i3c_ccc_do_rstact_all(const struct device *controller, enum i3c_ccc_rstact_defining_byte action)
Broadcast RSTACT to reset I3C Peripheral (Format 1).
int i3c_ccc_do_getvendor_defbyte(const struct i3c_device_desc *target, uint8_t id, uint8_t defbyte, uint8_t *payload, size_t len, size_t *num_xfer)
Single target to Get Vendor / Standard Extension CCC with a defining byte.
static int i3c_ccc_do_getstatus_fmt2(const struct i3c_device_desc *target, union i3c_ccc_getstatus *status, enum i3c_ccc_getstatus_defbyte defbyte)
Single target GETSTATUS to Get Target Status (Format 2).
Definition ccc.h:1875
int i3c_ccc_do_getstatus(const struct i3c_device_desc *target, union i3c_ccc_getstatus *status, enum i3c_ccc_getstatus_fmt fmt, enum i3c_ccc_getstatus_defbyte defbyte)
Single target GETSTATUS to Get Target Status.
static int i3c_ccc_do_getmxds_fmt3(const struct i3c_device_desc *target, union i3c_ccc_getmxds *caps, enum i3c_ccc_getmxds_defbyte defbyte)
Single target GETMXDS to Get Max Data Speed (Format 3).
Definition ccc.h:2105
static int i3c_ccc_do_getmxds_fmt2(const struct i3c_device_desc *target, union i3c_ccc_getmxds *caps)
Single target GETMXDS to Get Max Data Speed (Format 2).
Definition ccc.h:2085
int i3c_ccc_do_enttm(const struct device *controller, enum i3c_ccc_enttm_defbyte defbyte)
Broadcast ENTTM.
static int i3c_ccc_do_entas1(const struct i3c_device_desc *target)
Direct ENTAS1.
Definition ccc.h:1614
i3c_ccc_getmxds_defbyte
Enum for I3C Get Max Data Speed (GETMXDS) Format 3 Defining Byte Values.
Definition ccc.h:717
i3c_ccc_rstact_defining_byte
Enum for I3C Reset Action (RSTACT) Defining Byte Values.
Definition ccc.h:1261
int i3c_ccc_do_setmwl_all(const struct device *controller, const struct i3c_ccc_mwl *mwl)
Broadcast SETMWL to Set Maximum Write Length.
int i3c_ccc_do_entas(const struct i3c_device_desc *target, uint8_t as)
Direct ENTAS to set the Activity State.
int i3c_ccc_do_getmxds(const struct i3c_device_desc *target, union i3c_ccc_getmxds *caps, enum i3c_ccc_getmxds_fmt fmt, enum i3c_ccc_getmxds_defbyte defbyte)
Single target GETMXDS to Get Max Data Speed.
int i3c_ccc_do_setnewda(const struct i3c_device_desc *target, struct i3c_ccc_address new_da)
Set New Dynamic Address for a target.
int i3c_ccc_do_setmrl(const struct i3c_device_desc *target, const struct i3c_ccc_mrl *mrl)
Single target SETMRL to Set Maximum Read Length.
int i3c_ccc_do_setbuscon(const struct device *controller, uint8_t *context, uint16_t length)
Broadcast SETBUSCON to set the bus context.
int i3c_ccc_do_setvendor(const struct i3c_device_desc *target, uint8_t id, uint8_t *payload, size_t len)
Single target to Set Vendor / Standard Extension CCC.
i3c_ccc_getstatus_fmt
Indicate which format of GETSTATUS to use.
Definition ccc.h:556
int i3c_ccc_do_setvendor_all(const struct device *controller, uint8_t id, uint8_t *payload, size_t len)
Broadcast Set Vendor / Standard Extension CCC.
int i3c_ccc_do_getbcr(struct i3c_device_desc *target, struct i3c_ccc_getbcr *bcr)
Get BCR from a target.
int i3c_ccc_do_getdcr(struct i3c_device_desc *target, struct i3c_ccc_getdcr *dcr)
Get DCR from a target.
int i3c_ccc_do_rstact(const struct i3c_device_desc *target, enum i3c_ccc_rstact_defining_byte action, bool get, uint8_t *data)
Single target RSTACT to reset I3C Peripheral.
static int i3c_ccc_do_entas1_all(const struct device *controller)
Broadcast ENTAS1.
Definition ccc.h:1684
int i3c_ccc_do_getpid(struct i3c_device_desc *target, struct i3c_ccc_getpid *pid)
Get PID from a target.
int i3c_ccc_do_getcaps(const struct i3c_device_desc *target, union i3c_ccc_getcaps *caps, enum i3c_ccc_getcaps_fmt fmt, enum i3c_ccc_getcaps_defbyte defbyte)
Single target GETCAPS to Get Target Status.
int i3c_ccc_do_entas_all(const struct device *controller, uint8_t as)
Broadcast ENTAS to set the Activity State.
i3c_ccc_getcaps_fmt
Indicate which format of GETCAPS to use.
Definition ccc.h:877
static int i3c_ccc_do_getmxds_fmt1(const struct i3c_device_desc *target, union i3c_ccc_getmxds *caps)
Single target GETMXDS to Get Max Data Speed (Format 1).
Definition ccc.h:2066
static int i3c_ccc_do_getcaps_fmt2(const struct i3c_device_desc *target, union i3c_ccc_getcaps *caps, enum i3c_ccc_getcaps_defbyte defbyte)
Single target GETCAPS to Get Capabilities (Format 2).
Definition ccc.h:1935
static bool i3c_ccc_is_payload_broadcast(const struct i3c_ccc_payload *payload)
Test if I3C CCC payload is for broadcast.
Definition ccc.h:1387
int i3c_ccc_do_rstdaa_all(const struct device *controller)
Broadcast RSTDAA to reset dynamic addresses for all targets.
int i3c_ccc_do_setaasa_all(const struct device *controller)
Broadcast SETAASA to set all target's dynamic address to their static address.
int i3c_ccc_do_setmwl(const struct i3c_device_desc *target, const struct i3c_ccc_mwl *mwl)
Single target SETMWL to Set Maximum Write Length.
static int i3c_ccc_do_entas0(const struct i3c_device_desc *target)
Direct ENTAS0.
Definition ccc.h:1599
int i3c_ccc_do_getmrl(const struct i3c_device_desc *target, struct i3c_ccc_mrl *mrl)
Single target GETMRL to Get Maximum Read Length.
static int i3c_ccc_do_entas2_all(const struct device *controller)
Broadcast ENTAS2.
Definition ccc.h:1698
static int i3c_ccc_do_rstact_fmt2(const struct i3c_device_desc *target, enum i3c_ccc_rstact_defining_byte action)
Single target RSTACT to reset I3C Peripheral (Format 2).
Definition ccc.h:1477
i3c_ccc_getcaps_defbyte
Enum for I3C Get Capabilities (GETCAPS) Format 2 Defining Byte Values.
Definition ccc.h:888
static int i3c_ccc_do_entas2(const struct i3c_device_desc *target)
Direct ENTAS2.
Definition ccc.h:1629
static int i3c_ccc_do_getcaps_fmt1(const struct i3c_device_desc *target, union i3c_ccc_getcaps *caps)
Single target GETCAPS to Get Capabilities (Format 1).
Definition ccc.h:1915
static int i3c_ccc_do_entas3_all(const struct device *controller)
Broadcast ENTAS3.
Definition ccc.h:1712
int i3c_ccc_do_getmwl(const struct i3c_device_desc *target, struct i3c_ccc_mwl *mwl)
Single target GETMWL to Get Maximum Write Length.
static int i3c_ccc_do_rstact_fmt3(const struct i3c_device_desc *target, enum i3c_ccc_rstact_defining_byte action, uint8_t *data)
Single target RSTACT to reset I3C Peripheral (Format 3).
Definition ccc.h:1495
int i3c_ccc_do_setdasa(const struct i3c_device_desc *target, struct i3c_ccc_address da)
Set Dynamic Address from Static Address for a target.
int i3c_ccc_do_events_all_set(const struct device *controller, bool enable, struct i3c_ccc_events *events)
Broadcast ENEC/DISEC to enable/disable target events.
int i3c_ccc_do_events_set(struct i3c_device_desc *target, bool enable, struct i3c_ccc_events *events)
Direct CCC ENEC/DISEC to enable/disable target events.
#define I3C_CCC_BROADCAST_MAX_ID
Maximum CCC ID for broadcast.
Definition ccc.h:29
@ GETSTATUS_FORMAT_2_PRECR
PRECR - Alternate status format describing Controller-capable device.
Definition ccc.h:572
@ GETSTATUS_FORMAT_2_INVALID
Invalid defining byte.
Definition ccc.h:575
@ GETSTATUS_FORMAT_2_TGTSTAT
Target status.
Definition ccc.h:569
@ GETMXDS_FORMAT_2
GETMXDS Format 2.
Definition ccc.h:708
@ GETMXDS_FORMAT_1
GETMXDS Format 1.
Definition ccc.h:705
@ GETMXDS_FORMAT_3
GETMXDS Format 3.
Definition ccc.h:711
@ ENTTM_EXIT_TEST_MODE
Remove all I3C Devices from Test Mode.
Definition ccc.h:485
@ ENTTM_VENDOR_TEST_MODE
Indicates that I3C Devices shall return a random 32-bit value in the PID during the Dynamic Address A...
Definition ccc.h:490
@ GETMXDS_FORMAT_3_INVALID
Invalid defining byte.
Definition ccc.h:728
@ GETMXDS_FORMAT_3_CRHDLY
Delay parameters for a Controller-capable Device, and it's expected Activity State during a Controlle...
Definition ccc.h:725
@ GETMXDS_FORMAT_3_WRRDTURN
Standard Target Write/Read speed parameters, and optional Maximum Read Turnaround Time.
Definition ccc.h:720
@ I3C_CCC_RSTACT_RETURN_VIRTUAL_TARGET_INDICATION
Return Virtual Target Indication.
Definition ccc.h:1287
@ I3C_CCC_RSTACT_RETURN_TIME_TO_RESET_PERIPHERAL
Return Time to Reset Peripheral.
Definition ccc.h:1278
@ I3C_CCC_RSTACT_RETURN_TIME_TO_WHOLE_TARGET
Return Time to Reset Whole Target.
Definition ccc.h:1281
@ I3C_CCC_RSTACT_PERIPHERAL_ONLY
Reset the I3C Peripheral Only.
Definition ccc.h:1266
@ I3C_CCC_RSTACT_DEBUG_NETWORK_ADAPTER
Debug Network Adapter Reset.
Definition ccc.h:1272
@ I3C_CCC_RSTACT_NO_RESET
No Reset on Target Reset Pattern.
Definition ccc.h:1263
@ I3C_CCC_RSTACT_VIRTUAL_TARGET_DETECT
Virtual Target Detect.
Definition ccc.h:1275
@ I3C_CCC_RSTACT_RETURN_TIME_FOR_DEBUG_NETWORK_ADAPTER_RESET
Return Time for Debug Network Adapter Reset.
Definition ccc.h:1284
@ I3C_CCC_RSTACT_RESET_WHOLE_TARGET
Reset the Whole Target.
Definition ccc.h:1269
@ GETSTATUS_FORMAT_2
GETSTATUS Format 2.
Definition ccc.h:561
@ GETSTATUS_FORMAT_1
GETSTATUS Format 1.
Definition ccc.h:558
@ GETCAPS_FORMAT_1
GETCAPS Format 1.
Definition ccc.h:879
@ GETCAPS_FORMAT_2
GETCAPS Format 2.
Definition ccc.h:882
@ GETCAPS_FORMAT_2_CRCAPS
Controller handoff capabilities and features.
Definition ccc.h:896
@ GETCAPS_FORMAT_2_INVALID
Invalid defining byte.
Definition ccc.h:905
@ GETCAPS_FORMAT_2_TGTCAPS
Standard Target capabilities and features.
Definition ccc.h:890
@ GETCAPS_FORMAT_2_DBGCAPS
Debug-capable Device capabilities and features.
Definition ccc.h:902
@ GETCAPS_FORMAT_2_VTCAPS
Virtual Target capabilities and features.
Definition ccc.h:899
@ GETCAPS_FORMAT_2_TESTPAT
Fixed 32b test pattern.
Definition ccc.h:893
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:453
Payload for a single device address.
Definition ccc.h:506
uint8_t addr
Definition ccc.h:521
The active controller part of payload for DEFTGTS CCC.
Definition ccc.h:419
uint8_t addr
Dynamic Address of Active Controller.
Definition ccc.h:421
uint8_t dcr
Device Characteristic Register of Active Controller.
Definition ccc.h:424
uint8_t static_addr
Static Address of Active Controller.
Definition ccc.h:430
uint8_t bcr
Bus Characteristic Register of Active Controller.
Definition ccc.h:427
The target device part of payload for DEFTGTS CCC.
Definition ccc.h:439
uint8_t dcr
Device Characteristic Register of a I3C target device or a group.
Definition ccc.h:448
uint8_t addr
Dynamic Address of a target device, or a group address.
Definition ccc.h:441
uint8_t static_addr
Static Address of a target device or a group.
Definition ccc.h:458
uint8_t bcr
Bus Characteristic Register of a target device or a group.
Definition ccc.h:455
uint8_t lvr
Legacy Virtual Register for legacy I2C device.
Definition ccc.h:451
Payload for DEFTGTS CCC (Define List of Targets).
Definition ccc.h:469
struct i3c_ccc_deftgts_active_controller active_controller
Data describing the active controller.
Definition ccc.h:474
struct i3c_ccc_deftgts_target targets[]
Data describing the target(s) on the bus.
Definition ccc.h:477
uint8_t count
Number of Targets (and Groups) present on the I3C Bus.
Definition ccc.h:471
Payload for ENEC/DISEC CCC (Target Events Command).
Definition ccc.h:329
uint8_t events
Event byte:
Definition ccc.h:339
Payload for GETBCR CCC (Get Bus Characteristics Register).
Definition ccc.h:539
uint8_t bcr
Bus Characteristics Register.
Definition ccc.h:541
Payload for GETDCR CCC (Get Device Characteristics Register).
Definition ccc.h:547
uint8_t dcr
Device Characteristics Register.
Definition ccc.h:549
Payload for GETPID CCC (Get Provisioned ID).
Definition ccc.h:527
uint8_t pid[6]
48-bit Provisioned ID.
Definition ccc.h:533
Payload for SETMRL/GETMRL CCC (Set/Get Maximum Read Length).
Definition ccc.h:405
uint16_t len
Maximum Read Length.
Definition ccc.h:407
uint8_t ibi_len
Optional IBI Payload Size.
Definition ccc.h:410
Payload for SETMWL/GETMWL CCC (Set/Get Maximum Write Length).
Definition ccc.h:392
uint16_t len
Maximum Write Length.
Definition ccc.h:394
Payload structure for one CCC transaction.
Definition ccc.h:275
struct i3c_ccc_payload::@231 ccc
enum i3c_sdr_controller_error_types err
SDR Error Type.
Definition ccc.h:307
struct i3c_ccc_target_payload * payloads
Array of struct i3c_ccc_target_payload.
Definition ccc.h:319
size_t num_xfer
Total number of bytes transferred.
Definition ccc.h:299
uint8_t * data
Pointer to byte array of data for this CCC.
Definition ccc.h:288
uint8_t id
The CCC ID (I3C_CCC_*).
Definition ccc.h:280
struct i3c_ccc_payload::@232 targets
size_t num_targets
Number of targets.
Definition ccc.h:322
size_t data_len
Length in bytes for optional data array.
Definition ccc.h:291
One Bridged Target for SETBRGTGT payload.
Definition ccc.h:665
uint16_t id
16-bit ID for the bridged target.
Definition ccc.h:682
uint8_t addr
Dynamic address of the bridged target.
Definition ccc.h:672
Payload for SETBRGTGT CCC (Set Bridge Targets).
Definition ccc.h:692
uint8_t count
Number of bridged targets.
Definition ccc.h:694
struct i3c_ccc_setbrgtgt_tgt targets[]
Array of bridged targets.
Definition ccc.h:697
Payload structure for Direct CCC to one target.
Definition ccc.h:235
uint8_t addr
Target address.
Definition ccc.h:237
size_t data_len
Length in bytes for data.
Definition ccc.h:252
uint8_t rnw
0 for Write, 1 for Read
Definition ccc.h:240
uint8_t * data
Definition ccc.h:249
size_t num_xfer
Total number of bytes transferred.
Definition ccc.h:261
enum i3c_sdr_controller_error_types err
SDR Error Type.
Definition ccc.h:269
Structure describing a I3C target device.
Definition i3c.h:870
Misc utilities.
Macros to abstract toolchain specific capabilities.
Payload for GETCAPS CCC (Get Optional Feature Capabilities).
Definition ccc.h:915
union i3c_ccc_getcaps::@241 fmt2
uint8_t crcaps[2]
Defining Byte 0x91: CRCAPS Byte 1 CRCAPS1.
Definition ccc.h:981
union i3c_ccc_getcaps::@240 fmt1
uint8_t tgtcaps[4]
Defining Byte 0x00: TGTCAPS.
Definition ccc.h:960
uint8_t getcaps[4]
I3C v1.1+ Device Capabilities Byte 1 GETCAPS1.
Definition ccc.h:951
uint8_t gethdrcap
I3C v1.0 HDR Capabilities.
Definition ccc.h:924
uint8_t vtcaps[2]
Defining Byte 0x93: VTCAPS Byte 1 VTCAPS1.
Definition ccc.h:994
uint32_t testpat
Defining Byte 0x5A: TESTPAT.
Definition ccc.h:967
Payload for GETMXDS CCC (Get Max Data Speed).
Definition ccc.h:735
uint8_t maxrdturn[3]
Maximum Read Turnaround Time in microsecond.
Definition ccc.h:756
uint8_t maxrd
maxRd
Definition ccc.h:741
uint8_t maxwr
maxWr
Definition ccc.h:738
struct i3c_ccc_getmxds::@238 fmt2
struct i3c_ccc_getmxds::@237 fmt1
uint8_t wrrdturn[5]
Defining Byte 0x00: WRRDTURN.
Definition ccc.h:765
uint8_t crhdly1
Defining Byte 0x91: CRHDLY.
Definition ccc.h:772
struct i3c_ccc_getmxds::@239 fmt3
Payload for GETSTATUS CCC (Get Device Status).
Definition ccc.h:581
uint16_t precr
Defining Byte 0x91: PRECR.
Definition ccc.h:619
uint16_t tgtstat
Defining Byte 0x00: TGTSTAT.
Definition ccc.h:605
uint16_t status
Device Status.
Definition ccc.h:596
union i3c_ccc_getstatus::@236 fmt2
uint16_t raw_u16
Definition ccc.h:621
struct i3c_ccc_getstatus::@235 fmt1