Zephyr API Documentation 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;
38#ifdef CONFIG_MCTP_I3C_CONTROLLER_POLLING_MODE
39 struct k_work_delayable poll_work;
40 k_timeout_t poll_interval;
41#endif
43};
44
46int mctp_i3c_controller_start(struct mctp_binding *binding);
47int mctp_i3c_controller_tx(struct mctp_binding *binding, struct mctp_pktbuf *pkt);
48
49#define MCTP_I3C_ENDPOINT_IDS(_node_id, _name) \
50 static uint8_t _name##_endpoint_ids[DT_PROP_LEN(_node_id, endpoints)] \
51 = DT_PROP(_node_id, endpoint_ids)
52
53#define MCTP_I3C_ENDPOINT_DEVICE(_idx, _node_id, ...) \
54 DEVICE_DT_GET_BY_IDX(_node_id, endpoints, _idx)
55
56#define MCTP_I3C_CONTROLLER_DEFINE_DEVICES(_node_id, _name) \
57 const struct device *_name##_endpoints[] = { \
58 LISTIFY(DT_PROP_LEN(_node_id, endpoints), \
59 MCTP_I3C_ENDPOINT_DEVICE, (,), _node_id) \
60 }
61
63
73#define MCTP_I3C_CONTROLLER_DT_DEFINE(_name, _node_id) \
74 MCTP_I3C_CONTROLLER_DEFINE_DEVICES(_node_id, _name); \
75 MCTP_I3C_ENDPOINT_IDS(_node_id, _name); \
76 static struct i3c_device_desc \
77 *_name##_endpoint_i3c_devs[DT_PROP_LEN(_node_id, endpoints)]; \
78 static struct mctp_binding_i3c_controller _name = { \
79 .binding = { \
80 .name = STRINGIFY(_name), .version = 1, \
81 .start = mctp_i3c_controller_start, \
82 .tx = mctp_i3c_controller_tx, \
83 .pkt_size = MCTP_I3C_MAX_PKT_SIZE, \
84 .tx_storage = _name.tx_storage, \
85 }, \
86 .num_endpoints = DT_PROP_LEN(_node_id, endpoints), \
87 .devices = _name##_endpoints, \
88 .endpoint_ids = _name##_endpoint_ids, \
89 .endpoint_i3c_devs = _name##_endpoint_i3c_devs, \
90 COND_CODE_1(CONFIG_MCTP_I3C_CONTROLLER_POLLING_MODE, \
91 (.poll_interval = \
92 K_MSEC(CONFIG_MCTP_I3C_CONTROLLER_POLL_INTERVAL_MS)), ()) \
93 };
94
95#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
Kernel timeout type.
Definition clock.h:65
A structure used to submit work after a delay.
Definition kernel.h:4759
An MCTP binding for Zephyr's I3C interface using IBI interrupts for signaling.
Definition mctp_i3c_controller.h:27