Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
rtio.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Intel Corporation
3 * Copyright (c) 2024 Meta Platforms
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_DRIVERS_I3C_RTIO_H_
9#define ZEPHYR_DRIVERS_I3C_RTIO_H_
10
11#include <zephyr/kernel.h>
12#include <zephyr/drivers/i3c.h>
13#include <zephyr/rtio/rtio.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
22struct i3c_rtio {
23 struct k_sem lock;
25 struct rtio *r;
26 struct mpsc io_q;
31};
32
40#define I3C_RTIO_DEFINE(_name, _sq_sz, _cq_sz) \
41 RTIO_DEFINE(CONCAT(_name, _r), _sq_sz, _cq_sz); \
42 static struct i3c_rtio _name = { \
43 .r = &CONCAT(_name, _r), \
44 };
45
52struct rtio_sqe *i3c_rtio_copy(struct rtio *r, struct rtio_iodev *iodev, const struct i3c_msg *msgs,
53 uint8_t num_msgs);
54
60void i3c_rtio_init(struct i3c_rtio *ctx);
61
71bool i3c_rtio_complete(struct i3c_rtio *ctx, int status);
72
79bool i3c_rtio_submit(struct i3c_rtio *ctx, struct rtio_iodev_sqe *iodev_sqe);
80
90
99int i3c_rtio_transfer(struct i3c_rtio *ctx, struct i3c_msg *msgs, uint8_t num_msgs,
100 struct i3c_device_desc *desc);
101
110int i3c_rtio_recover(struct i3c_rtio *ctx);
111
120int i3c_rtio_ccc(struct i3c_rtio *ctx, struct i3c_ccc_payload *payload);
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* ZEPHYR_DRVIERS_I3C_RTIO_H_ */
workaround assembler barfing for ST r
Definition asm-macro-32-bit-gnu.h:24
bool i3c_rtio_submit(struct i3c_rtio *ctx, struct rtio_iodev_sqe *iodev_sqe)
Submit, atomically, a submission to work on at some point.
int i3c_rtio_configure(struct i3c_rtio *ctx, enum i3c_config_type type, void *config)
Configure the I3C bus controller.
bool i3c_rtio_complete(struct i3c_rtio *ctx, int status)
Signal that the current (ctx->txn_curr) submission has been completed.
void i3c_rtio_init(struct i3c_rtio *ctx)
Initialize an i3c rtio context.
int i3c_rtio_transfer(struct i3c_rtio *ctx, struct i3c_msg *msgs, uint8_t num_msgs, struct i3c_device_desc *desc)
Transfer i3c messages in a blocking call.
int i3c_rtio_ccc(struct i3c_rtio *ctx, struct i3c_ccc_payload *payload)
Perform an I3C CCC in a blocking call.
struct rtio_sqe * i3c_rtio_copy(struct rtio *r, struct rtio_iodev *iodev, const struct i3c_msg *msgs, uint8_t num_msgs)
Copy an array of i3c_msgs to rtio submissions and a transaction.
int i3c_rtio_recover(struct i3c_rtio *ctx)
Perform an I3C bus recovery in a blocking call.
i3c_config_type
Type of configuration being passed to configure function.
Definition i3c.h:509
Public kernel APIs.
Real-Time IO device API for moving bytes with low effort.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Payload structure for one CCC transaction.
Definition ccc.h:267
Structure describing a I3C target device.
Definition i3c.h:929
One I3C Message.
Definition i3c.h:473
Driver context for implementing i3c with rtio.
Definition rtio.h:22
struct rtio_iodev iodev
Definition rtio.h:27
struct i3c_device_desc * i3c_desc
Definition rtio.h:30
struct k_spinlock slock
Definition rtio.h:24
struct rtio_iodev_sqe * txn_curr
Definition rtio.h:29
struct rtio * r
Definition rtio.h:25
struct mpsc io_q
Definition rtio.h:26
struct rtio_iodev_sqe * txn_head
Definition rtio.h:28
struct k_sem lock
Definition rtio.h:23
Kernel Spin Lock.
Definition spinlock.h:45
MPSC Queue.
Definition mpsc_lockfree.h:86
Compute the mempool block index for a given pointer.
Definition rtio.h:492
An IO device with a function table for submitting requests.
Definition rtio.h:517
A submission queue event.
Definition rtio.h:286
const struct rtio_iodev * iodev
Device to operation on.
Definition rtio.h:295
int type
Definition rtio.h:345
void * config
Definition rtio.h:346
An RTIO context containing what can be viewed as a pair of queues.
Definition rtio.h:396