Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mctp_i3c_target.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_TARGET_H_
9#define ZEPHYR_MCTP_I3C_TARGET_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 const struct device *i3c;
25 struct i3c_target_config i3c_target_cfg;
26 uint8_t endpoint_id;
27 struct mctp_pktbuf *tx_pkt;
28 struct k_sem *tx_lock;
29 struct k_sem *tx_complete;
30 struct mctp_pktbuf *rx_pkt;
31 uint8_t tx_storage[MCTP_PKTBUF_SIZE(MCTP_I3C_MAX_PKT_SIZE)] PKTBUF_STORAGE_ALIGN;
33};
34
36extern const struct i3c_target_callbacks mctp_i3c_target_callbacks;
37int mctp_i3c_target_start(struct mctp_binding *binding);
38int mctp_i3c_target_tx(struct mctp_binding *binding, struct mctp_pktbuf *pkt);
40
47#define MCTP_I3C_TARGET_DT_DEFINE(_name, _node_id) \
48 K_SEM_DEFINE(_name##_tx_lock, 1, 1); \
49 K_SEM_DEFINE(_name##_tx_complete, 0, 1); \
50 struct mctp_binding_i3c_target _name = { \
51 .binding = { \
52 .name = STRINGIFY(_name), .version = 1, \
53 .start = mctp_i3c_target_start, \
54 .tx = mctp_i3c_target_tx, \
55 .pkt_size = MCTP_I3C_MAX_PKT_SIZE, \
56 .tx_storage = _name.tx_storage, \
57 }, \
58 .i3c = DEVICE_DT_GET(DT_PHANDLE(_node_id, i3c)), \
59 .i3c_target_cfg = { \
60 .callbacks = &mctp_i3c_target_callbacks, \
61 }, \
62 .endpoint_id = DT_PROP(_node_id, endpoint_id), \
63 .tx_lock = &_name##_tx_lock, \
64 .tx_complete = &_name##_tx_complete, \
65 };
66
67#endif /* ZEPHYR_MCTP_I3C_TARGET_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
Definition target_device.h:106
Structure describing a device that supports the I3C target API.
Definition target_device.h:101
Semaphore structure.
Definition kernel.h:3663
An MCTP binding for Zephyr's I3C target interface using GPIO.
Definition mctp_i3c_target.h:21