Zephyr API Documentation 4.3.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
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);
37void mctp_i3c_controller_ibi_cb(struct i3c_device_desc *target, struct i3c_ibi_payload *payload);
38
39#define MCTP_I3C_ENDPOINT_IDS(_node_id, _name) \
40 static uint8_t _name##_endpoint_ids[DT_PROP_LEN(_node_id, endpoints)] \
41 = DT_PROP(_node_id, endpoint_ids)
42
43#define MCTP_I3C_ENDPOINT_DEVICE(_idx, _node_id, ...) \
44 DEVICE_DT_GET_BY_IDX(_node_id, endpoints, _idx)
45
46#define MCTP_I3C_CONTROLLER_DEFINE_DEVICES(_node_id, _name) \
47 const struct device *_name##_endpoints[] = { \
48 LISTIFY(DT_PROP_LEN(_node_id, endpoints), \
49 MCTP_I3C_ENDPOINT_DEVICE, (,), _node_id) \
50 }
51
53
64#define MCTP_I3C_CONTROLLER_DT_DEFINE(_name, _node_id) \
65 MCTP_I3C_CONTROLLER_DEFINE_DEVICES(_node_id, _name); \
66 MCTP_I3C_ENDPOINT_IDS(_node_id, _name); \
67 static struct i3c_device_desc \
68 *_name##_endpoint_i3c_devs[DT_PROP_LEN(_node_id, endpoints)]; \
69 static struct mctp_binding_i3c_controller _name = { \
70 .binding = { \
71 .name = STRINGIFY(_name), .version = 1, \
72 .start = mctp_i3c_controller_start, \
73 .tx = mctp_i3c_controller_tx, \
74 .pkt_size = MCTP_I3C_MAX_PKT_SIZE, \
75 }, \
76 .num_endpoints = DT_PROP_LEN(_node_id, endpoints), \
77 .devices = _name##_endpoints, \
78 .endpoint_ids = _name##_endpoint_ids, \
79 .endpoint_i3c_devs = _name##_endpoint_i3c_devs, \
80 };
81
82#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
Structure of payload buffer for IBI.
Definition ibi.h:74
An MCTP binding for Zephyr's I3C interface using IBI interrupts for signaling.
Definition mctp_i3c_controller.h:21