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 Croxel, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_DRIVERS_SPI_RTIO_H_
8#define ZEPHYR_DRIVERS_SPI_RTIO_H_
9
10#include <zephyr/kernel.h>
11#include <zephyr/drivers/spi.h>
12#include <zephyr/rtio/rtio.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
30
38#define SPI_RTIO_DEFINE(_name, _sq_sz, _cq_sz) \
39 RTIO_DEFINE(CONCAT(_name, _r), _sq_sz, _cq_sz); \
40 static struct spi_rtio _name = { \
41 .r = &CONCAT(_name, _r), \
42 };
43
56int spi_rtio_copy(struct rtio *r,
57 struct rtio_iodev *iodev,
58 const struct spi_buf_set *tx_bufs,
59 const struct spi_buf_set *rx_bufs,
60 struct rtio_sqe **last_sqe);
61
68void spi_rtio_init(struct spi_rtio *ctx, const struct device *dev);
69
79bool spi_rtio_complete(struct spi_rtio *ctx, int status);
80
87bool spi_rtio_submit(struct spi_rtio *ctx, struct rtio_iodev_sqe *iodev_sqe);
88
97 const struct spi_config *config,
98 const struct spi_buf_set *tx_bufs,
99 const struct spi_buf_set *rx_bufs);
100
108 struct rtio_iodev_sqe *iodev_sqe);
109
110#ifdef __cplusplus
111}
112#endif
113
114#endif /* ZEPHYR_DRIVERS_SPI_RTIO_H_ */
workaround assembler barfing for ST r
Definition asm-macro-32-bit-gnu.h:24
bool spi_rtio_submit(struct spi_rtio *ctx, struct rtio_iodev_sqe *iodev_sqe)
Submit, atomically, a submission to work on at some point.
void spi_rtio_init(struct spi_rtio *ctx, const struct device *dev)
Initialize a SPI RTIO context.
bool spi_rtio_complete(struct spi_rtio *ctx, int status)
Signal that the current (ctx->txn_curr) submission has been completed.
int spi_rtio_copy(struct rtio *r, struct rtio_iodev *iodev, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, struct rtio_sqe **last_sqe)
Copy the tx_bufs and rx_bufs into a set of RTIO requests.
void spi_rtio_iodev_default_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe)
Fallback SPI RTIO submit implementation.
int spi_rtio_transceive(struct spi_rtio *ctx, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs)
Perform a SPI Transfer (transceive) in a blocking call.
Public API for SPI drivers and applications.
Public kernel APIs.
Real-Time IO device API for moving bytes with low effort.
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
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
An RTIO context containing what can be viewed as a pair of queues.
Definition rtio.h:396
SPI buffer array structure.
Definition spi.h:471
SPI controller configuration structure.
Definition spi.h:301
Complete SPI DT information.
Definition spi.h:377
struct spi_config config
Slave specific configuration.
Definition spi.h:381
Driver context for implementing SPI with RTIO.
Definition rtio.h:21
struct rtio_iodev iodev
Definition rtio.h:25
struct rtio_iodev_sqe * txn_head
Definition rtio.h:26
struct k_spinlock lock
Definition rtio.h:22
struct rtio * r
Definition rtio.h:23
struct spi_dt_spec dt_spec
Definition rtio.h:28
struct rtio_iodev_sqe * txn_curr
Definition rtio.h:27
struct mpsc io_q
Definition rtio.h:24