Zephyr API Documentation 4.4.0-rc2
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
8#ifndef ZEPHYR_MCTP_I3C_CONTROLLER_H_
9#define ZEPHYR_MCTP_I3C_CONTROLLER_H_
10
11#include <stdint.h>
12#include <zephyr/kernel.h>
13#include <zephyr/device.h>
14#include <zephyr/drivers/i3c.h>
16#include <libmctp.h>
17
23 struct mctp_binding binding;
24 size_t num_endpoints;
25 const struct device **devices;
26 uint8_t *endpoint_ids;
27 struct i3c_device_desc **endpoint_i3c_devs;
28 enum mctp_i3c_endpoint_state *endpoint_states;
29 size_t rx_buf_len;
30 uint8_t *rx_buf;
32};
33
35int mctp_i3c_controller_start(struct mctp_binding *binding);
36int mctp_i3c_controller_tx(struct mctp_binding *binding, struct mctp_pktbuf *pkt);
37
38#define MCTP_I3C_ENDPOINT_IDS(_node_id, _name) \
39 static uint8_t _name##_endpoint_ids[DT_PROP_LEN(_node_id, endpoints)] \
40 = DT_PROP(_node_id, endpoint_ids)
41
42#define MCTP_I3C_ENDPOINT_DEVICE(_idx, _node_id, ...) \
43 DEVICE_DT_GET_BY_IDX(_node_id, endpoints, _idx)
44
45#define MCTP_I3C_CONTROLLER_DEFINE_DEVICES(_node_id, _name) \
46 const struct device *_name##_endpoints[] = { \
47 LISTIFY(DT_PROP_LEN(_node_id, endpoints), \
48 MCTP_I3C_ENDPOINT_DEVICE, (,), _node_id) \
49 }
50
52
63#define MCTP_I3C_CONTROLLER_DT_DEFINE(_name, _node_id) \
64 MCTP_I3C_CONTROLLER_DEFINE_DEVICES(_node_id, _name); \
65 MCTP_I3C_ENDPOINT_IDS(_node_id, _name); \
66 static struct i3c_device_desc \
67 *_name##_endpoint_i3c_devs[DT_PROP_LEN(_node_id, endpoints)]; \
68 static struct mctp_binding_i3c_controller _name = { \
69 .binding = { \
70 .name = STRINGIFY(_name), .version = 1, \
71 .start = mctp_i3c_controller_start, \
72 .tx = mctp_i3c_controller_tx, \
73 .pkt_size = MCTP_I3C_MAX_PKT_SIZE, \
74 }, \
75 .num_endpoints = DT_PROP_LEN(_node_id, endpoints), \
76 .devices = _name##_endpoints, \
77 .endpoint_ids = _name##_endpoint_ids, \
78 .endpoint_i3c_devs = _name##_endpoint_i3c_devs, \
79 };
80
81#endif /* ZEPHYR_MCTP_I3C_CONTROLLER_H_ */
Main header file for I3C (Inter-Integrated Circuit) driver API.
Public kernel APIs.
__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:924
An MCTP binding for Zephyr's I3C interface using IBI interrupts for signaling.
Definition mctp_i3c_controller.h:21