Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

RTIO. More...

Modules

 RTIO CQE Flags
 RTIO CQE Flags.
 
 RTIO MPSC API
 RTIO Multiple Producer Single Consumer (MPSC) Queue API.
 
 RTIO Priorities
 RTIO Predefined Priorties.
 
 RTIO SPSC API
 RTIO Single Producer Single Consumer (SPSC) Queue API.
 
 RTIO SQE Flags
 RTIO SQE Flags.
 

Data Structures

struct  rtio_sqe
 A submission queue event. More...
 
struct  rtio_cqe
 A completion queue event. More...
 
struct  rtio_sqe_pool
 
struct  rtio_cqe_pool
 
struct  rtio
 An RTIO context containing what can be viewed as a pair of queues. More...
 
struct  rtio_iodev_sqe
 Compute the mempool block index for a given pointer. More...
 
struct  rtio_iodev_api
 API that an RTIO IO device should implement. More...
 
struct  rtio_iodev
 An IO device with a function table for submitting requests. More...
 

Macros

#define RTIO_IODEV_I2C_STOP   BIT(1)
 Equivalent to the I2C_MSG_STOP flag.
 
#define RTIO_IODEV_I2C_RESTART   BIT(2)
 Equivalent to the I2C_MSG_RESTART flag.
 
#define RTIO_IODEV_I2C_10_BITS   BIT(3)
 Equivalent to the I2C_MSG_ADDR_10_BITS.
 
#define RTIO_OP_NOP   0
 An operation that does nothing and will complete immediately.
 
#define RTIO_OP_RX   (RTIO_OP_NOP+1)
 An operation that receives (reads)
 
#define RTIO_OP_TX   (RTIO_OP_RX+1)
 An operation that transmits (writes)
 
#define RTIO_OP_TINY_TX   (RTIO_OP_TX+1)
 An operation that transmits tiny writes by copying the data to write.
 
#define RTIO_OP_CALLBACK   (RTIO_OP_TINY_TX+1)
 An operation that calls a given function (callback)
 
#define RTIO_OP_TXRX   (RTIO_OP_CALLBACK+1)
 An operation that transceives (reads and writes simultaneously)
 
#define RTIO_OP_I2C_RECOVER   (RTIO_OP_TXRX+1)
 An operation to recover I2C buses.
 
#define RTIO_OP_I2C_CONFIGURE   (RTIO_OP_I2C_RECOVER+1)
 An operation to configure I2C buses.
 
#define RTIO_IODEV_DEFINE(name, iodev_api, iodev_data)
 Statically define and initialize an RTIO IODev.
 
#define RTIO_BMEM   COND_CODE_1(CONFIG_USERSPACE, (K_APP_BMEM(rtio_partition) static), (static))
 Allocate to bss if available.
 
#define RTIO_DMEM   COND_CODE_1(CONFIG_USERSPACE, (K_APP_DMEM(rtio_partition) static), (static))
 Allocate as initialized memory if available.
 
#define RTIO_DEFINE(name, sq_sz, cq_sz)
 Statically define and initialize an RTIO context.
 
#define RTIO_DEFINE_WITH_MEMPOOL(name, sq_sz, cq_sz, num_blks, blk_size, balign)
 Statically define and initialize an RTIO context.
 

Typedefs

typedef void(* rtio_callback_t) (struct rtio *r, const struct rtio_sqe *sqe, void *arg0)
 Callback signature for RTIO_OP_CALLBACK.
 

Functions

static size_t rtio_mempool_block_size (const struct rtio *r)
 Get the mempool block size of the RTIO context.
 
static void rtio_sqe_prep_nop (struct rtio_sqe *sqe, const struct rtio_iodev *iodev, void *userdata)
 Prepare a nop (no op) submission.
 
static void rtio_sqe_prep_read (struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, uint8_t *buf, uint32_t len, void *userdata)
 Prepare a read op submission.
 
static void rtio_sqe_prep_read_with_pool (struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, void *userdata)
 Prepare a read op submission with context's mempool.
 
static void rtio_sqe_prep_read_multishot (struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, void *userdata)
 
static void rtio_sqe_prep_write (struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, uint8_t *buf, uint32_t len, void *userdata)
 Prepare a write op submission.
 
static void rtio_sqe_prep_tiny_write (struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, const uint8_t *tiny_write_data, uint8_t tiny_write_len, void *userdata)
 Prepare a tiny write op submission.
 
static void rtio_sqe_prep_callback (struct rtio_sqe *sqe, rtio_callback_t callback, void *arg0, void *userdata)
 Prepare a callback op submission.
 
static void rtio_sqe_prep_transceive (struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, uint8_t *tx_buf, uint8_t *rx_buf, uint32_t buf_len, void *userdata)
 Prepare a transceive op submission.
 
static struct rtio_iodev_sqertio_sqe_pool_alloc (struct rtio_sqe_pool *pool)
 
static void rtio_sqe_pool_free (struct rtio_sqe_pool *pool, struct rtio_iodev_sqe *iodev_sqe)
 
static struct rtio_cqertio_cqe_pool_alloc (struct rtio_cqe_pool *pool)
 
static void rtio_cqe_pool_free (struct rtio_cqe_pool *pool, struct rtio_cqe *cqe)
 
static int rtio_block_pool_alloc (struct rtio *r, size_t min_sz, size_t max_sz, uint8_t **buf, uint32_t *buf_len)
 
static void rtio_block_pool_free (struct rtio *r, void *buf, uint32_t buf_len)
 
static uint32_t rtio_sqe_acquirable (struct rtio *r)
 Count of acquirable submission queue events.
 
static struct rtio_iodev_sqertio_txn_next (const struct rtio_iodev_sqe *iodev_sqe)
 Get the next sqe in the transaction.
 
static struct rtio_iodev_sqertio_chain_next (const struct rtio_iodev_sqe *iodev_sqe)
 Get the next sqe in the chain.
 
static struct rtio_iodev_sqertio_iodev_sqe_next (const struct rtio_iodev_sqe *iodev_sqe)
 Get the next sqe in the chain or transaction.
 
static struct rtio_sqertio_sqe_acquire (struct rtio *r)
 Acquire a single submission queue event if available.
 
static void rtio_sqe_drop_all (struct rtio *r)
 Drop all previously acquired sqe.
 
static struct rtio_cqertio_cqe_acquire (struct rtio *r)
 Acquire a complete queue event if available.
 
static void rtio_cqe_produce (struct rtio *r, struct rtio_cqe *cqe)
 Produce a complete queue event if available.
 
static struct rtio_cqertio_cqe_consume (struct rtio *r)
 Consume a single completion queue event if available.
 
static struct rtio_cqertio_cqe_consume_block (struct rtio *r)
 Wait for and consume a single completion queue event.
 
static void rtio_cqe_release (struct rtio *r, struct rtio_cqe *cqe)
 Release consumed completion queue event.
 
static uint32_t rtio_cqe_compute_flags (struct rtio_iodev_sqe *iodev_sqe)
 Compute the CQE flags from the rtio_iodev_sqe entry.
 
int rtio_cqe_get_mempool_buffer (const struct rtio *r, struct rtio_cqe *cqe, uint8_t **buff, uint32_t *buff_len)
 Retrieve the mempool buffer that was allocated for the CQE.
 
void rtio_executor_submit (struct rtio *r)
 
void rtio_executor_ok (struct rtio_iodev_sqe *iodev_sqe, int result)
 
void rtio_executor_err (struct rtio_iodev_sqe *iodev_sqe, int result)
 
static void rtio_iodev_sqe_ok (struct rtio_iodev_sqe *iodev_sqe, int result)
 Inform the executor of a submission completion with success.
 
static void rtio_iodev_sqe_err (struct rtio_iodev_sqe *iodev_sqe, int result)
 Inform the executor of a submissions completion with error.
 
static void rtio_iodev_cancel_all (struct rtio_iodev *iodev)
 Cancel all requests that are pending for the iodev.
 
static void rtio_cqe_submit (struct rtio *r, int result, void *userdata, uint32_t flags)
 Submit a completion queue event with a given result and userdata.
 
static int rtio_sqe_rx_buf (const struct rtio_iodev_sqe *iodev_sqe, uint32_t min_buf_len, uint32_t max_buf_len, uint8_t **buf, uint32_t *buf_len)
 Get the buffer associate with the RX submission.
 
void rtio_release_buffer (struct rtio *r, void *buff, uint32_t buff_len)
 Release memory that was allocated by the RTIO's memory pool.
 
static void rtio_access_grant (struct rtio *r, struct k_thread *t)
 Grant access to an RTIO context to a user thread.
 
int rtio_sqe_cancel (struct rtio_sqe *sqe)
 Attempt to cancel an SQE.
 
int rtio_sqe_copy_in_get_handles (struct rtio *r, const struct rtio_sqe *sqes, struct rtio_sqe **handle, size_t sqe_count)
 Copy an array of SQEs into the queue and get resulting handles back.
 
static int rtio_sqe_copy_in (struct rtio *r, const struct rtio_sqe *sqes, size_t sqe_count)
 Copy an array of SQEs into the queue.
 
int rtio_cqe_copy_out (struct rtio *r, struct rtio_cqe *cqes, size_t cqe_count, k_timeout_t timeout)
 Copy an array of CQEs from the queue.
 
int rtio_submit (struct rtio *r, uint32_t wait_count)
 Submit I/O requests to the underlying executor.
 

Variables

struct k_mem_partition rtio_partition
 The memory partition associated with all RTIO context information.
 

Detailed Description

RTIO.

Since
3.2
Version
0.1.0

Macro Definition Documentation

◆ RTIO_BMEM

#define RTIO_BMEM   COND_CODE_1(CONFIG_USERSPACE, (K_APP_BMEM(rtio_partition) static), (static))

#include <zephyr/rtio/rtio.h>

Allocate to bss if available.

If CONFIG_USERSPACE is selected, allocate to the rtio_partition bss. Maps to: K_APP_BMEM(rtio_partition) static

If CONFIG_USERSPACE is disabled, allocate as plain static: static

◆ RTIO_DEFINE

#define RTIO_DEFINE (   name,
  sq_sz,
  cq_sz 
)

#include <zephyr/rtio/rtio.h>

Value:
Z_RTIO_SQE_POOL_DEFINE(CONCAT(name, _sqe_pool), sq_sz); \
Z_RTIO_CQE_POOL_DEFINE(CONCAT(name, _cqe_pool), cq_sz); \
Z_RTIO_DEFINE(name, &CONCAT(name, _sqe_pool), \
&CONCAT(name, _cqe_pool), NULL)
#define CONCAT(...)
Concatenate input arguments.
Definition: util.h:285

Statically define and initialize an RTIO context.

Parameters
nameName of the RTIO
sq_szSize of the submission queue entry pool
cq_szSize of the completion queue entry pool

◆ RTIO_DEFINE_WITH_MEMPOOL

#define RTIO_DEFINE_WITH_MEMPOOL (   name,
  sq_sz,
  cq_sz,
  num_blks,
  blk_size,
  balign 
)

#include <zephyr/rtio/rtio.h>

Value:
Z_RTIO_SQE_POOL_DEFINE(name##_sqe_pool, sq_sz); \
Z_RTIO_CQE_POOL_DEFINE(name##_cqe_pool, cq_sz); \
Z_RTIO_BLOCK_POOL_DEFINE(name##_block_pool, blk_size, num_blks, balign); \
Z_RTIO_DEFINE(name, &name##_sqe_pool, &name##_cqe_pool, &name##_block_pool)

Statically define and initialize an RTIO context.

Parameters
nameName of the RTIO
sq_szSize of the submission queue, must be power of 2
cq_szSize of the completion queue, must be power of 2
num_blksNumber of blocks in the memory pool
blk_sizeThe number of bytes in each block
balignThe block alignment

◆ RTIO_DMEM

#define RTIO_DMEM   COND_CODE_1(CONFIG_USERSPACE, (K_APP_DMEM(rtio_partition) static), (static))

#include <zephyr/rtio/rtio.h>

Allocate as initialized memory if available.

If CONFIG_USERSPACE is selected, allocate to the rtio_partition init. Maps to: K_APP_DMEM(rtio_partition) static

If CONFIG_USERSPACE is disabled, allocate as plain static: static

◆ RTIO_IODEV_DEFINE

#define RTIO_IODEV_DEFINE (   name,
  iodev_api,
  iodev_data 
)

#include <zephyr/rtio/rtio.h>

Value:
.api = (iodev_api), \
.iodev_sq = RTIO_MPSC_INIT((name.iodev_sq)), \
.data = (iodev_data), \
}
#define STRUCT_SECTION_ITERABLE(struct_type, varname)
Defines a new element for an iterable section.
Definition: iterable_sections.h:216
#define RTIO_MPSC_INIT(symbol)
Static initializer for a mpsc queue.
Definition: rtio_mpsc.h:100
An IO device with a function table for submitting requests.
Definition: rtio.h:448

Statically define and initialize an RTIO IODev.

Parameters
nameName of the iodev
iodev_apiPointer to struct rtio_iodev_api
iodev_dataData pointer

◆ RTIO_IODEV_I2C_10_BITS

#define RTIO_IODEV_I2C_10_BITS   BIT(3)

#include <zephyr/rtio/rtio.h>

Equivalent to the I2C_MSG_ADDR_10_BITS.

◆ RTIO_IODEV_I2C_RESTART

#define RTIO_IODEV_I2C_RESTART   BIT(2)

#include <zephyr/rtio/rtio.h>

Equivalent to the I2C_MSG_RESTART flag.

◆ RTIO_IODEV_I2C_STOP

#define RTIO_IODEV_I2C_STOP   BIT(1)

#include <zephyr/rtio/rtio.h>

Equivalent to the I2C_MSG_STOP flag.

◆ RTIO_OP_CALLBACK

#define RTIO_OP_CALLBACK   (RTIO_OP_TINY_TX+1)

#include <zephyr/rtio/rtio.h>

An operation that calls a given function (callback)

◆ RTIO_OP_I2C_CONFIGURE

#define RTIO_OP_I2C_CONFIGURE   (RTIO_OP_I2C_RECOVER+1)

#include <zephyr/rtio/rtio.h>

An operation to configure I2C buses.

◆ RTIO_OP_I2C_RECOVER

#define RTIO_OP_I2C_RECOVER   (RTIO_OP_TXRX+1)

#include <zephyr/rtio/rtio.h>

An operation to recover I2C buses.

◆ RTIO_OP_NOP

#define RTIO_OP_NOP   0

#include <zephyr/rtio/rtio.h>

An operation that does nothing and will complete immediately.

◆ RTIO_OP_RX

#define RTIO_OP_RX   (RTIO_OP_NOP+1)

#include <zephyr/rtio/rtio.h>

An operation that receives (reads)

◆ RTIO_OP_TINY_TX

#define RTIO_OP_TINY_TX   (RTIO_OP_TX+1)

#include <zephyr/rtio/rtio.h>

An operation that transmits tiny writes by copying the data to write.

◆ RTIO_OP_TX

#define RTIO_OP_TX   (RTIO_OP_RX+1)

#include <zephyr/rtio/rtio.h>

An operation that transmits (writes)

◆ RTIO_OP_TXRX

#define RTIO_OP_TXRX   (RTIO_OP_CALLBACK+1)

#include <zephyr/rtio/rtio.h>

An operation that transceives (reads and writes simultaneously)

Typedef Documentation

◆ rtio_callback_t

rtio_callback_t

#include <zephyr/rtio/rtio.h>

Callback signature for RTIO_OP_CALLBACK.

Parameters
rRTIO context being used with the callback
sqeSubmission for the callback op
arg0Argument option as part of the sqe

Function Documentation

◆ rtio_access_grant()

static void rtio_access_grant ( struct rtio r,
struct k_thread t 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Grant access to an RTIO context to a user thread.

◆ rtio_block_pool_alloc()

static int rtio_block_pool_alloc ( struct rtio r,
size_t  min_sz,
size_t  max_sz,
uint8_t **  buf,
uint32_t buf_len 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

◆ rtio_block_pool_free()

static void rtio_block_pool_free ( struct rtio r,
void *  buf,
uint32_t  buf_len 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

◆ rtio_chain_next()

static struct rtio_iodev_sqe * rtio_chain_next ( const struct rtio_iodev_sqe iodev_sqe)
inlinestatic

#include <zephyr/rtio/rtio.h>

Get the next sqe in the chain.

Parameters
iodev_sqeSubmission queue entry
Return values
NULLif current sqe is last in chain
structrtio_sqe * if available

◆ rtio_cqe_acquire()

static struct rtio_cqe * rtio_cqe_acquire ( struct rtio r)
inlinestatic

#include <zephyr/rtio/rtio.h>

Acquire a complete queue event if available.

◆ rtio_cqe_compute_flags()

static uint32_t rtio_cqe_compute_flags ( struct rtio_iodev_sqe iodev_sqe)
inlinestatic

#include <zephyr/rtio/rtio.h>

Compute the CQE flags from the rtio_iodev_sqe entry.

Parameters
iodev_sqeThe SQE entry in question.
Returns
The value that should be set for the CQE's flags field.

◆ rtio_cqe_consume()

static struct rtio_cqe * rtio_cqe_consume ( struct rtio r)
inlinestatic

#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.

Parameters
rRTIO context
Return values
cqeA valid completion queue event consumed from the completion queue
NULLNo completion queue event available

◆ rtio_cqe_consume_block()

static struct rtio_cqe * rtio_cqe_consume_block ( struct rtio r)
inlinestatic

#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.

Parameters
rRTIO context
Return values
cqeA valid completion queue event consumed from the completion queue

◆ rtio_cqe_copy_out()

int rtio_cqe_copy_out ( struct rtio r,
struct rtio_cqe cqes,
size_t  cqe_count,
k_timeout_t  timeout 
)

#include <zephyr/rtio/rtio.h>

Copy an array of CQEs from the queue.

Copies from the RTIO context and its queue completion queue events, waiting for the given time period to gather the number of completions requested.

Parameters
rRTIO context
cqesPointer to an array of SQEs
cqe_countCount of sqes in array
timeoutTimeout to wait for each completion event. Total wait time is potentially timeout*cqe_count at maximum.
Return values
copy_countCount of copied CQEs (0 to cqe_count)

◆ rtio_cqe_get_mempool_buffer()

int rtio_cqe_get_mempool_buffer ( const struct rtio r,
struct rtio_cqe cqe,
uint8_t **  buff,
uint32_t buff_len 
)

#include <zephyr/rtio/rtio.h>

Retrieve the mempool buffer that was allocated for the CQE.

If the RTIO context contains a memory pool, and the SQE was created by calling rtio_sqe_read_with_pool(), this function can be used to retrieve the memory associated with the read. Once processing is done, it should be released by calling rtio_release_buffer().

Parameters
[in]rRTIO context
[in]cqeThe CQE handling the event.
[out]buffPointer to the mempool buffer
[out]buff_lenLength of the allocated buffer
Returns
0 on success
-EINVAL if the buffer wasn't allocated for this cqe
-ENOTSUP if memory blocks are disabled

◆ rtio_cqe_pool_alloc()

static struct rtio_cqe * rtio_cqe_pool_alloc ( struct rtio_cqe_pool pool)
inlinestatic

#include <zephyr/rtio/rtio.h>

◆ rtio_cqe_pool_free()

static void rtio_cqe_pool_free ( struct rtio_cqe_pool pool,
struct rtio_cqe cqe 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

◆ rtio_cqe_produce()

static void rtio_cqe_produce ( struct rtio r,
struct rtio_cqe cqe 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Produce a complete queue event if available.

◆ rtio_cqe_release()

static void rtio_cqe_release ( struct rtio r,
struct rtio_cqe cqe 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Release consumed completion queue event.

Parameters
rRTIO context
cqeCompletion queue entry

◆ rtio_cqe_submit()

static void rtio_cqe_submit ( struct rtio r,
int  result,
void *  userdata,
uint32_t  flags 
)
inlinestatic

#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.

Parameters
rRTIO context
resultInteger result code (could be -errno)
userdataUserdata to pass along to completion
flagsFlags to use for the CEQ see RTIO_CQE_FLAG_*

◆ rtio_executor_err()

void rtio_executor_err ( struct rtio_iodev_sqe iodev_sqe,
int  result 
)

#include <zephyr/rtio/rtio.h>

◆ rtio_executor_ok()

void rtio_executor_ok ( struct rtio_iodev_sqe iodev_sqe,
int  result 
)

#include <zephyr/rtio/rtio.h>

◆ rtio_executor_submit()

void rtio_executor_submit ( struct rtio r)

#include <zephyr/rtio/rtio.h>

◆ rtio_iodev_cancel_all()

static void rtio_iodev_cancel_all ( struct rtio_iodev iodev)
inlinestatic

#include <zephyr/rtio/rtio.h>

Cancel all requests that are pending for the iodev.

Parameters
iodevIODev to cancel all requests for

◆ rtio_iodev_sqe_err()

static void rtio_iodev_sqe_err ( struct rtio_iodev_sqe iodev_sqe,
int  result 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Inform the executor of a submissions completion with error.

This SHALL fail the remaining submissions in the chain.

Parameters
iodev_sqeSubmission that has failed
resultResult of the request

◆ rtio_iodev_sqe_next()

static struct rtio_iodev_sqe * rtio_iodev_sqe_next ( const struct rtio_iodev_sqe iodev_sqe)
inlinestatic

#include <zephyr/rtio/rtio.h>

Get the next sqe in the chain or transaction.

Parameters
iodev_sqeSubmission queue entry
Return values
NULLif current sqe is last in chain
structrtio_iodev_sqe * if available

◆ rtio_iodev_sqe_ok()

static void rtio_iodev_sqe_ok ( struct rtio_iodev_sqe iodev_sqe,
int  result 
)
inlinestatic

#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.

Parameters
iodev_sqeIODev Submission that has succeeded
resultResult of the request

◆ rtio_mempool_block_size()

static size_t rtio_mempool_block_size ( const struct rtio r)
inlinestatic

#include <zephyr/rtio/rtio.h>

Get the mempool block size of the RTIO context.

Parameters
[in]rThe RTIO context
Returns
The size of each block in the context's mempool
0 if the context doesn't have a mempool

◆ rtio_release_buffer()

void rtio_release_buffer ( struct rtio r,
void *  buff,
uint32_t  buff_len 
)

#include <zephyr/rtio/rtio.h>

Release memory that was allocated by the RTIO's memory pool.

If the RTIO context was created by a call to RTIO_DEFINE_WITH_MEMPOOL(), then the cqe data might contain a buffer that's owned by the RTIO context. In those cases (if the read request was configured via rtio_sqe_read_with_pool()) the buffer must be returned back to the pool.

Call this function when processing is complete. This function will validate that the memory actually belongs to the RTIO context and will ignore invalid arguments.

Parameters
rRTIO context
buffPointer to the buffer to be released.
buff_lenNumber of bytes to free (will be rounded up to nearest memory block).

◆ rtio_sqe_acquirable()

static uint32_t rtio_sqe_acquirable ( struct rtio r)
inlinestatic

#include <zephyr/rtio/rtio.h>

Count of acquirable submission queue events.

Parameters
rRTIO context
Returns
Count of acquirable submission queue events

◆ rtio_sqe_acquire()

static struct rtio_sqe * rtio_sqe_acquire ( struct rtio r)
inlinestatic

#include <zephyr/rtio/rtio.h>

Acquire a single submission queue event if available.

Parameters
rRTIO context
Return values
sqeA valid submission queue event acquired from the submission queue
NULLNo subsmission queue event available

◆ rtio_sqe_cancel()

int rtio_sqe_cancel ( struct rtio_sqe sqe)

#include <zephyr/rtio/rtio.h>

Attempt to cancel an SQE.

If possible (not currently executing), cancel an SQE and generate a failure with -ECANCELED result.

Parameters
[in]sqeThe SQE to cancel
Returns
0 if the SQE was flagged for cancellation
<0 on error

◆ rtio_sqe_copy_in()

static int rtio_sqe_copy_in ( struct rtio r,
const struct rtio_sqe sqes,
size_t  sqe_count 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Copy an array of SQEs into the queue.

Useful if a batch of submissions is stored in ROM or RTIO is used from user mode where a copy must be made.

Partial copying is not done as chained SQEs need to be submitted as a whole set.

Parameters
rRTIO context
sqesPointer to an array of SQEs
sqe_countCount of sqes in array
Return values
0success
-ENOMEMnot enough room in the queue

◆ rtio_sqe_copy_in_get_handles()

int rtio_sqe_copy_in_get_handles ( struct rtio r,
const struct rtio_sqe sqes,
struct rtio_sqe **  handle,
size_t  sqe_count 
)

#include <zephyr/rtio/rtio.h>

Copy an array of SQEs into the queue and get resulting handles back.

Copies one or more SQEs into the RTIO context and optionally returns their generated SQE handles. Handles can be used to cancel events via the rtio_sqe_cancel() call.

Parameters
[in]rRTIO context
[in]sqesPointer to an array of SQEs
[out]handleOptional pointer to rtio_sqe pointer to store the handle of the first generated SQE. Use NULL to ignore.
[in]sqe_countCount of sqes in array
Return values
0success
-ENOMEMnot enough room in the queue

◆ rtio_sqe_drop_all()

static void rtio_sqe_drop_all ( struct rtio r)
inlinestatic

#include <zephyr/rtio/rtio.h>

Drop all previously acquired sqe.

Parameters
rRTIO context

◆ rtio_sqe_pool_alloc()

static struct rtio_iodev_sqe * rtio_sqe_pool_alloc ( struct rtio_sqe_pool pool)
inlinestatic

#include <zephyr/rtio/rtio.h>

◆ rtio_sqe_pool_free()

static void rtio_sqe_pool_free ( struct rtio_sqe_pool pool,
struct rtio_iodev_sqe iodev_sqe 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

◆ rtio_sqe_prep_callback()

static void rtio_sqe_prep_callback ( struct rtio_sqe sqe,
rtio_callback_t  callback,
void *  arg0,
void *  userdata 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Prepare a callback op submission.

A somewhat special operation in that it may only be done in kernel mode.

Used where general purpose logic is required in a queue of io operations to do transforms or logic.

◆ rtio_sqe_prep_nop()

static void rtio_sqe_prep_nop ( struct rtio_sqe sqe,
const struct rtio_iodev iodev,
void *  userdata 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Prepare a nop (no op) submission.

◆ rtio_sqe_prep_read()

static void rtio_sqe_prep_read ( struct rtio_sqe sqe,
const struct rtio_iodev iodev,
int8_t  prio,
uint8_t buf,
uint32_t  len,
void *  userdata 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Prepare a read op submission.

◆ rtio_sqe_prep_read_multishot()

static void rtio_sqe_prep_read_multishot ( struct rtio_sqe sqe,
const struct rtio_iodev iodev,
int8_t  prio,
void *  userdata 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

◆ rtio_sqe_prep_read_with_pool()

static void rtio_sqe_prep_read_with_pool ( struct rtio_sqe sqe,
const struct rtio_iodev iodev,
int8_t  prio,
void *  userdata 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Prepare a read op submission with context's mempool.

See also
rtio_sqe_prep_read()

◆ rtio_sqe_prep_tiny_write()

static void rtio_sqe_prep_tiny_write ( struct rtio_sqe sqe,
const struct rtio_iodev iodev,
int8_t  prio,
const uint8_t tiny_write_data,
uint8_t  tiny_write_len,
void *  userdata 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Prepare a tiny write op submission.

Unlike the normal write operation where the source buffer must outlive the call the tiny write data in this case is copied to the sqe. It must be tiny to fit within the specified size of a rtio_sqe.

This is useful in many scenarios with RTL logic where a write of the register to subsequently read must be done.

◆ rtio_sqe_prep_transceive()

static void rtio_sqe_prep_transceive ( struct rtio_sqe sqe,
const struct rtio_iodev iodev,
int8_t  prio,
uint8_t tx_buf,
uint8_t rx_buf,
uint32_t  buf_len,
void *  userdata 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Prepare a transceive op submission.

◆ rtio_sqe_prep_write()

static void rtio_sqe_prep_write ( struct rtio_sqe sqe,
const struct rtio_iodev iodev,
int8_t  prio,
uint8_t buf,
uint32_t  len,
void *  userdata 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Prepare a write op submission.

◆ rtio_sqe_rx_buf()

static int rtio_sqe_rx_buf ( const struct rtio_iodev_sqe iodev_sqe,
uint32_t  min_buf_len,
uint32_t  max_buf_len,
uint8_t **  buf,
uint32_t buf_len 
)
inlinestatic

#include <zephyr/rtio/rtio.h>

Get the buffer associate with the RX submission.

Parameters
[in]iodev_sqeThe submission to probe
[in]min_buf_lenThe minimum number of bytes needed for the operation
[in]max_buf_lenThe maximum number of bytes needed for the operation
[out]bufWhere to store the pointer to the buffer
[out]buf_lenWhere to store the size of the buffer
Returns
0 if buf and buf_len were successfully filled
-ENOMEM Not enough memory for min_buf_len

◆ rtio_submit()

int rtio_submit ( struct rtio r,
uint32_t  wait_count 
)

#include <zephyr/rtio/rtio.h>

Submit I/O requests to the underlying executor.

Submits the queue of submission queue events to the executor. The executor will do the work of managing tasks representing each submission chain, freeing submission queue events when done, and producing completion queue events as submissions are completed.

Parameters
rRTIO context
wait_countNumber of submissions to wait for completion of.
Return values
0On success

◆ rtio_txn_next()

static struct rtio_iodev_sqe * rtio_txn_next ( const struct rtio_iodev_sqe iodev_sqe)
inlinestatic

#include <zephyr/rtio/rtio.h>

Get the next sqe in the transaction.

Parameters
iodev_sqeSubmission queue entry
Return values
NULLif current sqe is last in transaction
structrtio_sqe * if available

Variable Documentation

◆ rtio_partition

struct k_mem_partition rtio_partition
extern

#include <zephyr/rtio/rtio.h>

The memory partition associated with all RTIO context information.