Zephyr Project API 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
rtio.h File Reference
#include <zephyr/kernel.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/rtio/rtio.h>

Go to the source code of this file.

Data Structures

struct  spi_rtio
 Driver context for implementing SPI with RTIO. More...
 

Macros

#define SPI_RTIO_DEFINE(_name, _sq_sz, _cq_sz)
 Statically define a spi_rtio context.
 

Functions

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_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.
 
bool spi_rtio_submit (struct spi_rtio *ctx, struct rtio_iodev_sqe *iodev_sqe)
 Submit, atomically, a submission to work on at some point.
 
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.
 
void spi_rtio_iodev_default_submit (const struct device *dev, struct rtio_iodev_sqe *iodev_sqe)
 Fallback SPI RTIO submit implementation.
 

Macro Definition Documentation

◆ SPI_RTIO_DEFINE

#define SPI_RTIO_DEFINE (   _name,
  _sq_sz,
  _cq_sz 
)
Value:
RTIO_DEFINE(CONCAT(_name, _r), _sq_sz, _cq_sz); \
static struct spi_rtio _name = { \
.r = &CONCAT(_name, _r), \
};
#define RTIO_DEFINE(name, sq_sz, cq_sz)
Statically define and initialize an RTIO context.
Definition rtio.h:836
#define CONCAT(...)
Concatenate input arguments.
Definition util.h:311
Driver context for implementing SPI with RTIO.
Definition rtio.h:21
struct rtio * r
Definition rtio.h:23

Statically define a spi_rtio context.

Parameters
_nameSymbolic name of the context
_sq_szSubmission queue entry pool size
_cq_szCompletion queue entry pool size

Function Documentation

◆ spi_rtio_complete()

bool spi_rtio_complete ( struct spi_rtio ctx,
int  status 
)

Signal that the current (ctx->txn_curr) submission has been completed.

Parameters
ctxSPI RTIO driver context
statusCompletion status, negative values are errors
Return values
trueNext submission is ready to start
falseNo more submissions to work on

◆ spi_rtio_copy()

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.

Parameters
[in]rrtio context
[in]iodeviodev to transceive with
[in]tx_bufstransmit buffer set
[in]rx_bufsreceive buffer set
[out]last_sqelast sqe submitted, NULL if not enough memory
Return values
Numberof submission queue entries
-ENOMEMout of memory

◆ spi_rtio_init()

void spi_rtio_init ( struct spi_rtio ctx,
const struct device dev 
)

Initialize a SPI RTIO context.

Parameters
ctxSPI RTIO driver context
devSPI bus

◆ spi_rtio_iodev_default_submit()

void spi_rtio_iodev_default_submit ( const struct device dev,
struct rtio_iodev_sqe iodev_sqe 
)

Fallback SPI RTIO submit implementation.

Default RTIO SPI implementation for drivers who do no yet have native support. For details, see spi_iodev_submit.

◆ spi_rtio_submit()

bool spi_rtio_submit ( struct spi_rtio ctx,
struct rtio_iodev_sqe iodev_sqe 
)

Submit, atomically, a submission to work on at some point.

Return values
trueNext submission is ready to start
falseNo new submission to start or submissions are in progress already

◆ spi_rtio_transceive()

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.

Provides a compatible API for the existing spi_transceive API by blocking the caller until the operation is complete. For details see spi_transceive.