Zephyr Project API
3.2.0
A Scalable Open Source RTOS
|
RTIO API. More...
Modules | |
RTIO Priorities | |
RTIO Predefined Priorties. | |
RTIO SQE Flags | |
RTIO SQE Flags. | |
Data Structures | |
struct | rtio_sqe |
A submission queue event. More... | |
struct | rtio_sq |
Submission queue. More... | |
struct | rtio_cqe |
A completion queue event. More... | |
struct | rtio_cq |
Completion queue. More... | |
struct | rtio_executor_api |
struct | rtio_executor |
An executor does the work of executing the submissions. More... | |
struct | rtio |
An RTIO queue pair that both the kernel and application work with. More... | |
struct | rtio_iodev_api |
API that an RTIO IO device should implement. More... | |
struct | rtio_iodev_sqe |
struct | rtio_iodev_sq |
IO device submission queue. More... | |
struct | rtio_iodev |
An IO device with a function table for submitting requests. More... | |
Macros | |
#define | RTIO_OP_NOP 0 |
#define | RTIO_OP_RX 1 |
#define | RTIO_OP_TX 2 |
#define | RTIO_SQ_DEFINE(name, len) static RTIO_SPSC_DEFINE(name, struct rtio_sqe, len) |
Statically define and initialize a fixed length submission queue. More... | |
#define | RTIO_CQ_DEFINE(name, len) static RTIO_SPSC_DEFINE(name, struct rtio_cqe, len) |
Statically define and initialize a fixed length completion queue. More... | |
#define | RTIO_DEFINE(name, exec, sq_sz, cq_sz) |
Statically define and initialize an RTIO context. More... | |
Functions | |
static void | rtio_sqe_prep_nop (struct rtio_sqe *sqe, struct rtio_iodev *iodev, void *userdata) |
Prepare a nop (no op) submission. More... | |
static void | rtio_sqe_prep_read (struct rtio_sqe *sqe, struct rtio_iodev *iodev, int8_t prio, uint8_t *buf, uint32_t len, void *userdata) |
Prepare a read op submission. More... | |
static void | rtio_sqe_prep_write (struct rtio_sqe *sqe, struct rtio_iodev *iodev, int8_t prio, uint8_t *buf, uint32_t len, void *userdata) |
Prepare a write op submission. More... | |
static void | rtio_set_executor (struct rtio *r, struct rtio_executor *exc) |
Set the executor of the rtio context. More... | |
static void | rtio_iodev_submit (const struct rtio_sqe *sqe, struct rtio *r) |
Perform a submitted operation with an iodev. More... | |
static int | rtio_submit (struct rtio *r, uint32_t wait_count) |
Submit I/O requests to the underlying executor. More... | |
static struct rtio_cqe * | rtio_cqe_consume (struct rtio *r) |
Consume a single completion queue event if available. More... | |
static struct rtio_cqe * | rtio_cqe_consume_block (struct rtio *r) |
Wait for and consume a single completion queue event. More... | |
static void | rtio_sqe_ok (struct rtio *r, const struct rtio_sqe *sqe, int result) |
Inform the executor of a submission completion with success. More... | |
static void | rtio_sqe_err (struct rtio *r, const struct rtio_sqe *sqe, int result) |
Inform the executor of a submissions completion with error. More... | |
static void | rtio_cqe_submit (struct rtio *r, int result, void *userdata) |
RTIO API.
#define RTIO_CQ_DEFINE | ( | name, | |
len | |||
) | static RTIO_SPSC_DEFINE(name, struct rtio_cqe, len) |
#include <include/zephyr/rtio/rtio.h>
Statically define and initialize a fixed length completion queue.
name | Name of the completion queue. |
len | Queue length, power of 2 required (2, 4, 8). |
#define RTIO_DEFINE | ( | name, | |
exec, | |||
sq_sz, | |||
cq_sz | |||
) |
#include <include/zephyr/rtio/rtio.h>
Statically define and initialize an RTIO context.
name | Name of the RTIO |
exec | Symbol for rtio_executor (pointer) |
sq_sz | Size of the submission queue, must be power of 2 |
cq_sz | Size of the completion queue, must be power of 2 |
#define RTIO_OP_NOP 0 |
#include <include/zephyr/rtio/rtio.h>
An operation that does nothing and will complete immediately
#define RTIO_OP_RX 1 |
#include <include/zephyr/rtio/rtio.h>
An operation that receives (reads)
#define RTIO_OP_TX 2 |
#include <include/zephyr/rtio/rtio.h>
An operation that transmits (writes)
#define RTIO_SQ_DEFINE | ( | name, | |
len | |||
) | static RTIO_SPSC_DEFINE(name, struct rtio_sqe, len) |
#include <include/zephyr/rtio/rtio.h>
Statically define and initialize a fixed length submission queue.
name | Name of the submission queue. |
len | Queue length, power of 2 required (2, 4, 8). |
#include <include/zephyr/rtio/rtio.h>
Consume a single completion queue event if available.
If a completion queue event is returned rtio_cq_release(r) must be called at some point to release the cqe spot for the cqe producer.
r | RTIO context |
cqe | A valid completion queue event consumed from the completion queue |
NULL | No completion queue event available |
#include <include/zephyr/rtio/rtio.h>
Wait for and consume a single completion queue event.
If a completion queue event is returned rtio_cq_release(r) must be called at some point to release the cqe spot for the cqe producer.
r | RTIO context |
cqe | A valid completion queue event consumed from the completion queue |
|
inlinestatic |
#include <include/zephyr/rtio/rtio.h>
Submit a completion queue event with a given result and userdata
Called by the executor to produce a completion queue event, no inherent locking is performed and this is not safe to do from multiple callers.
r | RTIO context |
result | Integer result code (could be -errno) |
userdata | Userdata to pass along to completion |
#include <include/zephyr/rtio/rtio.h>
Perform a submitted operation with an iodev.
sqe | Submission to work on |
r | RTIO context |
|
inlinestatic |
#include <include/zephyr/rtio/rtio.h>
Set the executor of the rtio context.
#include <include/zephyr/rtio/rtio.h>
Inform the executor of a submissions completion with error.
This SHALL fail the remaining submissions in the chain.
r | RTIO context |
sqe | Submission that has failed |
result | Result of the request |
#include <include/zephyr/rtio/rtio.h>
Inform the executor of a submission completion with success.
This may start the next asynchronous request if one is available.
r | RTIO context |
sqe | Submission that has succeeded |
result | Result of the request |
|
inlinestatic |
#include <include/zephyr/rtio/rtio.h>
Prepare a nop (no op) submission.
|
inlinestatic |
#include <include/zephyr/rtio/rtio.h>
Prepare a read op submission.
|
inlinestatic |
#include <include/zephyr/rtio/rtio.h>
Prepare a write op submission.
#include <include/zephyr/rtio/rtio.h>
Submit I/O requests to the underlying executor.
Submits the queue of requested IO operation chains to the underlying executor. The underlying executor will decide on which hardware and with what sort of parallelism the execution of IO chains is performed.
r | RTIO context |
wait_count | Count of completions to wait for If wait_count is for completions flag is set, the call will not return until the desired number of completions are done. A wait count of non-zero requires the caller be on a thread. |
0 | On success |