Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mctp_i3c_controller.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 */
7
13
14#ifndef ZEPHYR_INCLUDE_PMCI_MCTP_MCTP_I3C_CONTROLLER_H_
15#define ZEPHYR_INCLUDE_PMCI_MCTP_MCTP_I3C_CONTROLLER_H_
16
17#include <stdint.h>
18#include <zephyr/kernel.h>
19#include <zephyr/device.h>
20#include <zephyr/drivers/i3c.h>
22#include <libmctp.h>
23
29 struct mctp_binding binding;
30 size_t num_endpoints;
31 const struct device **devices;
32 uint8_t *endpoint_ids;
33 struct i3c_device_desc **endpoint_i3c_devs;
34 enum mctp_i3c_endpoint_state *endpoint_states;
35 size_t rx_buf_len;
36 uint8_t *rx_buf;
37 uint8_t tx_storage[MCTP_PKTBUF_SIZE(MCTP_I3C_MAX_PKT_SIZE)] PKTBUF_STORAGE_ALIGN;
39};
40
42int mctp_i3c_controller_start(struct mctp_binding *binding);
43int mctp_i3c_controller_tx(struct mctp_binding *binding, struct mctp_pktbuf *pkt);
44
45#define MCTP_I3C_ENDPOINT_IDS(_node_id, _name) \
46 static uint8_t _name##_endpoint_ids[DT_PROP_LEN(_node_id, endpoints)] \
47 = DT_PROP(_node_id, endpoint_ids)
48
49#define MCTP_I3C_ENDPOINT_DEVICE(_idx, _node_id, ...) \
50 DEVICE_DT_GET_BY_IDX(_node_id, endpoints, _idx)
51
52#define MCTP_I3C_CONTROLLER_DEFINE_DEVICES(_node_id, _name) \
53 const struct device *_name##_endpoints[] = { \
54 LISTIFY(DT_PROP_LEN(_node_id, endpoints), \
55 MCTP_I3C_ENDPOINT_DEVICE, (,), _node_id) \
56 }
57
59
70#define MCTP_I3C_CONTROLLER_DT_DEFINE(_name, _node_id) \
71 MCTP_I3C_CONTROLLER_DEFINE_DEVICES(_node_id, _name); \
72 MCTP_I3C_ENDPOINT_IDS(_node_id, _name); \
73 static struct i3c_device_desc \
74 *_name##_endpoint_i3c_devs[DT_PROP_LEN(_node_id, endpoints)]; \
75 static struct mctp_binding_i3c_controller _name = { \
76 .binding = { \
77 .name = STRINGIFY(_name), .version = 1, \
78 .start = mctp_i3c_controller_start, \
79 .tx = mctp_i3c_controller_tx, \
80 .pkt_size = MCTP_I3C_MAX_PKT_SIZE, \
81 .tx_storage = _name.tx_storage, \
82 }, \
83 .num_endpoints = DT_PROP_LEN(_node_id, endpoints), \
84 .devices = _name##_endpoints, \
85 .endpoint_ids = _name##_endpoint_ids, \
86 .endpoint_i3c_devs = _name##_endpoint_i3c_devs, \
87 };
88
89#endif /* ZEPHYR_INCLUDE_PMCI_MCTP_MCTP_I3C_CONTROLLER_H_ */
Main header file for I3C (Inter-Integrated Circuit) driver API.
Public kernel APIs.
Internal definitions shared by the MCTP I3C controller and target bindings.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
Structure describing a I3C target device.
Definition i3c.h:1011
An MCTP binding for Zephyr's I3C interface using IBI interrupts for signaling.
Definition mctp_i3c_controller.h:27