26#ifndef ZEPHYR_INCLUDE_RTIO_RTIO_H_
27#define ZEPHYR_INCLUDE_RTIO_RTIO_H_
65#define RTIO_PRIO_LOW 0U
70#define RTIO_PRIO_NORM 127U
75#define RTIO_PRIO_HIGH 255U
96#define RTIO_SQE_CHAINED BIT(0)
108#define RTIO_SQE_TRANSACTION BIT(1)
120#define RTIO_SQE_MEMPOOL_BUFFER BIT(2)
128#define RTIO_SQE_CANCELED BIT(3)
136#define RTIO_SQE_MULTISHOT BIT(4)
141#define RTIO_SQE_NO_RESPONSE BIT(5)
160#define RTIO_CQE_FLAG_MEMPOOL_BUFFER BIT(0)
162#define RTIO_CQE_FLAG_GET(flags) FIELD_GET(GENMASK(7, 0), (flags))
170#define RTIO_CQE_FLAG_MEMPOOL_GET_BLK_IDX(flags) FIELD_GET(GENMASK(19, 8), (flags))
178#define RTIO_CQE_FLAG_MEMPOOL_GET_BLK_CNT(flags) FIELD_GET(GENMASK(31, 20), (flags))
187#define RTIO_CQE_FLAG_PREP_MEMPOOL(blk_idx, blk_cnt) \
188 (FIELD_PREP(GENMASK(7, 0), RTIO_CQE_FLAG_MEMPOOL_BUFFER) | \
189 FIELD_PREP(GENMASK(19, 8), blk_idx) | FIELD_PREP(GENMASK(31, 20), blk_cnt))
198#define RTIO_IODEV_I2C_STOP BIT(1)
203#define RTIO_IODEV_I2C_RESTART BIT(2)
208#define RTIO_IODEV_I2C_10_BITS BIT(3)
288BUILD_ASSERT(
sizeof(
struct rtio_sqe) <= 64);
328#ifdef CONFIG_RTIO_SUBMIT_SEM
332 struct k_sem *submit_sem;
337#ifdef CONFIG_RTIO_CONSUME_SEM
342 struct k_sem *consume_sem;
359#ifdef CONFIG_RTIO_SYS_MEM_BLOCKS
361 struct sys_mem_blocks *block_pool;
383#ifndef CONFIG_RTIO_SYS_MEM_BLOCKS
387 if (
r == NULL ||
r->block_pool == NULL) {
390 return BIT(
r->block_pool->info.blk_sz_shift);
401#ifdef CONFIG_RTIO_SYS_MEM_BLOCKS
402static inline uint16_t __rtio_compute_mempool_block_index(
const struct rtio *
r,
const void *ptr)
405 struct sys_mem_blocks *mem_pool =
r->block_pool;
409 uint32_t buff_size = mem_pool->info.num_blocks * block_size;
411 if (addr < buff || addr >= buff + buff_size) {
414 return (addr - buff) / block_size;
460#define RTIO_OP_RX (RTIO_OP_NOP+1)
463#define RTIO_OP_TX (RTIO_OP_RX+1)
466#define RTIO_OP_TINY_TX (RTIO_OP_TX+1)
469#define RTIO_OP_CALLBACK (RTIO_OP_TINY_TX+1)
472#define RTIO_OP_TXRX (RTIO_OP_CALLBACK+1)
475#define RTIO_OP_I2C_RECOVER (RTIO_OP_TXRX+1)
478#define RTIO_OP_I2C_CONFIGURE (RTIO_OP_I2C_RECOVER+1)
565 const uint8_t *tiny_write_data,
569 __ASSERT_NO_MSG(tiny_write_len <=
sizeof(sqe->
tiny_buf));
672#ifndef CONFIG_RTIO_SYS_MEM_BLOCKS
686 if (block_size == 0) {
695 *buf_len = num_blks * block_size;
700 }
while (bytes >= min_sz);
708#ifndef CONFIG_RTIO_SYS_MEM_BLOCKS
713 size_t num_blks = buf_len >>
r->block_pool->info.blk_sz_shift;
729#define RTIO_IODEV_DEFINE(name, iodev_api, iodev_data) \
730 STRUCT_SECTION_ITERABLE(rtio_iodev, name) = { \
731 .api = (iodev_api), \
732 .data = (iodev_data), \
735#define Z_RTIO_SQE_POOL_DEFINE(name, sz) \
736 static struct rtio_iodev_sqe CONCAT(_sqe_pool_, name)[sz]; \
737 STRUCT_SECTION_ITERABLE(rtio_sqe_pool, name) = { \
738 .free_q = MPSC_INIT((name.free_q)), \
741 .pool = CONCAT(_sqe_pool_, name), \
745#define Z_RTIO_CQE_POOL_DEFINE(name, sz) \
746 static struct rtio_cqe CONCAT(_cqe_pool_, name)[sz]; \
747 STRUCT_SECTION_ITERABLE(rtio_cqe_pool, name) = { \
748 .free_q = MPSC_INIT((name.free_q)), \
751 .pool = CONCAT(_cqe_pool_, name), \
763#define RTIO_BMEM COND_CODE_1(CONFIG_USERSPACE, (K_APP_BMEM(rtio_partition) static), (static))
774#define RTIO_DMEM COND_CODE_1(CONFIG_USERSPACE, (K_APP_DMEM(rtio_partition) static), (static))
776#define Z_RTIO_BLOCK_POOL_DEFINE(name, blk_sz, blk_cnt, blk_align) \
777 RTIO_BMEM uint8_t __aligned(WB_UP(blk_align)) \
778 CONCAT(_block_pool_, name)[blk_cnt*WB_UP(blk_sz)]; \
779 _SYS_MEM_BLOCKS_DEFINE_WITH_EXT_BUF(name, WB_UP(blk_sz), blk_cnt, \
780 CONCAT(_block_pool_, name), RTIO_DMEM)
782#define Z_RTIO_DEFINE(name, _sqe_pool, _cqe_pool, _block_pool) \
783 IF_ENABLED(CONFIG_RTIO_SUBMIT_SEM, \
784 (static K_SEM_DEFINE(CONCAT(_submit_sem_, name), 0, K_SEM_MAX_LIMIT))) \
785 IF_ENABLED(CONFIG_RTIO_CONSUME_SEM, \
786 (static K_SEM_DEFINE(CONCAT(_consume_sem_, name), 0, K_SEM_MAX_LIMIT))) \
787 STRUCT_SECTION_ITERABLE(rtio, name) = { \
788 IF_ENABLED(CONFIG_RTIO_SUBMIT_SEM, (.submit_sem = &CONCAT(_submit_sem_, name),)) \
789 IF_ENABLED(CONFIG_RTIO_SUBMIT_SEM, (.submit_count = 0,)) \
790 IF_ENABLED(CONFIG_RTIO_CONSUME_SEM, (.consume_sem = &CONCAT(_consume_sem_, name),))\
791 .cq_count = ATOMIC_INIT(0), \
792 .xcqcnt = ATOMIC_INIT(0), \
793 .sqe_pool = _sqe_pool, \
794 .cqe_pool = _cqe_pool, \
795 IF_ENABLED(CONFIG_RTIO_SYS_MEM_BLOCKS, (.block_pool = _block_pool,)) \
796 .sq = MPSC_INIT((name.sq)), \
797 .cq = MPSC_INIT((name.cq)), \
807#define RTIO_DEFINE(name, sq_sz, cq_sz) \
808 Z_RTIO_SQE_POOL_DEFINE(CONCAT(name, _sqe_pool), sq_sz); \
809 Z_RTIO_CQE_POOL_DEFINE(CONCAT(name, _cqe_pool), cq_sz); \
810 Z_RTIO_DEFINE(name, &CONCAT(name, _sqe_pool), \
811 &CONCAT(name, _cqe_pool), NULL)
825#define RTIO_DEFINE_WITH_MEMPOOL(name, sq_sz, cq_sz, num_blks, blk_size, balign) \
826 Z_RTIO_SQE_POOL_DEFINE(name##_sqe_pool, sq_sz); \
827 Z_RTIO_CQE_POOL_DEFINE(name##_cqe_pool, cq_sz); \
828 Z_RTIO_BLOCK_POOL_DEFINE(name##_block_pool, blk_size, num_blks, balign); \
829 Z_RTIO_DEFINE(name, &name##_sqe_pool, &name##_cqe_pool, &name##_block_pool)
842 return r->sqe_pool->pool_free;
856 return iodev_sqe->
next;
874 return iodev_sqe->
next;
890 return iodev_sqe->
next;
905 if (iodev_sqe == NULL) {
911 return &iodev_sqe->
sqe;
924 while (node != NULL) {
971#ifdef CONFIG_RTIO_CONSUME_SEM
1001#ifdef CONFIG_RTIO_CONSUME_SEM
1005 while (node == NULL) {
1035#ifdef CONFIG_RTIO_SYS_MEM_BLOCKS
1037 struct rtio *
r = iodev_sqe->
r;
1038 struct sys_mem_blocks *mem_pool =
r->block_pool;
1039 int blk_index = (iodev_sqe->
sqe.
buf - mem_pool->buffer) >>
1040 mem_pool->info.blk_sz_shift;
1041 int blk_count = iodev_sqe->
sqe.
buf_len >> mem_pool->info.blk_sz_shift;
1046 ARG_UNUSED(iodev_sqe);
1070static inline int z_impl_rtio_cqe_get_mempool_buffer(
const struct rtio *
r,
struct rtio_cqe *cqe,
1073#ifdef CONFIG_RTIO_SYS_MEM_BLOCKS
1079 *buff =
r->block_pool->buffer + blk_idx * blk_size;
1080 *buff_len = blk_count * blk_size;
1081 __ASSERT_NO_MSG(*buff >=
r->block_pool->buffer);
1082 __ASSERT_NO_MSG(*buff <
1083 r->block_pool->buffer + blk_size *
r->block_pool->info.num_blocks);
1091 ARG_UNUSED(buff_len);
1152#ifdef CONFIG_RTIO_SUBMIT_SEM
1153 if (
r->submit_count > 0) {
1155 if (
r->submit_count == 0) {
1160#ifdef CONFIG_RTIO_CONSUME_SEM
1165#define __RTIO_MEMPOOL_GET_NUM_BLKS(num_bytes, blk_size) (((num_bytes) + (blk_size)-1) / (blk_size))
1184#ifdef CONFIG_RTIO_SYS_MEM_BLOCKS
1186 struct rtio *
r = iodev_sqe->
r;
1188 if (sqe->
buf != NULL) {
1189 if (sqe->
buf_len < min_buf_len) {
1207 ARG_UNUSED(max_buf_len);
1210 if (sqe->
buf_len < min_buf_len) {
1235static inline void z_impl_rtio_release_buffer(
struct rtio *
r,
void *buff,
uint32_t buff_len)
1237#ifdef CONFIG_RTIO_SYS_MEM_BLOCKS
1238 if (
r == NULL || buff == NULL ||
r->block_pool == NULL || buff_len == 0) {
1246 ARG_UNUSED(buff_len);
1257#ifdef CONFIG_RTIO_SUBMIT_SEM
1261#ifdef CONFIG_RTIO_CONSUME_SEM
1278static inline int z_impl_rtio_sqe_cancel(
struct rtio_sqe *sqe)
1285 }
while (iodev_sqe != NULL);
1306 struct rtio_sqe **handle,
size_t sqe_count);
1308static inline int z_impl_rtio_sqe_copy_in_get_handles(
struct rtio *
r,
const struct rtio_sqe *sqes,
1315 if (acquirable < sqe_count) {
1319 for (
unsigned long i = 0; i < sqe_count; i++) {
1321 __ASSERT_NO_MSG(sqe != NULL);
1322 if (handle != NULL && i == 0) {
1371static inline int z_impl_rtio_cqe_copy_out(
struct rtio *
r,
1384#ifdef CONFIG_BOARD_NATIVE_POSIX
1392 cqes[copied++] = *cqe;
1414static inline int z_impl_rtio_submit(
struct rtio *
r,
uint32_t wait_count)
1418#ifdef CONFIG_RTIO_SUBMIT_SEM
1421 if (wait_count > 0) {
1423 "expected rtio submit with wait count to be called from a thread");
1426 r->submit_count = wait_count;
1441#ifdef CONFIG_RTIO_SUBMIT_SEM
1443 if (wait_count > 0) {
1446 "semaphore was reset or timed out while waiting on completions!");
1466#include <zephyr/syscalls/rtio.h>
workaround assembler barfing for ST r
Definition: asm-macro-32-bit-gnu.h:24
long atomic_t
Definition: atomic_types.h:15
atomic_val_t atomic_get(const atomic_t *target)
Atomic get.
atomic_val_t atomic_inc(atomic_t *target)
Atomic increment.
#define K_FOREVER
Generate infinite timeout delay.
Definition: kernel.h:1363
#define K_NO_WAIT
Generate null timeout delay.
Definition: kernel.h:1253
k_timepoint_t sys_timepoint_calc(k_timeout_t timeout)
Calculate a timepoint value.
static bool sys_timepoint_expired(k_timepoint_t timepoint)
Indicates if timepoint is expired.
Definition: sys_clock.h:327
#define K_TIMEOUT_EQ(a, b)
Compare timeouts for equality.
Definition: sys_clock.h:80
#define K_TICKS(t)
Generate timeout delay from system ticks.
Definition: kernel.h:1305
bool k_is_in_isr(void)
Determine if code is running at interrupt level.
int sys_mem_blocks_free_contiguous(sys_mem_blocks_t *mem_block, void *block, size_t count)
Free contiguous multiple memory blocks.
int sys_mem_blocks_alloc_contiguous(sys_mem_blocks_t *mem_block, size_t count, void **out_block)
Allocate a contiguous set of memory blocks.
static ALWAYS_INLINE void mpsc_push(struct mpsc *q, struct mpsc_node *n)
Push a node.
Definition: mpsc_lockfree.h:126
static struct mpsc_node * mpsc_pop(struct mpsc *q)
Pop a node off of the list.
Definition: mpsc_lockfree.h:145
#define RTIO_CQE_FLAG_MEMPOOL_GET_BLK_CNT(flags)
Get the block count of a mempool flags.
Definition: rtio.h:178
#define RTIO_CQE_FLAG_MEMPOOL_GET_BLK_IDX(flags)
Get the block index of a mempool flags.
Definition: rtio.h:170
#define RTIO_CQE_FLAG_MEMPOOL_BUFFER
The entry's buffer was allocated from the RTIO's mempool.
Definition: rtio.h:160
#define RTIO_CQE_FLAG_PREP_MEMPOOL(blk_idx, blk_cnt)
Prepare CQE flags for a mempool read.
Definition: rtio.h:187
#define RTIO_CQE_FLAG_GET(flags)
Definition: rtio.h:162
#define RTIO_SQE_MULTISHOT
The SQE should continue producing CQEs until canceled.
Definition: rtio.h:136
#define RTIO_SQE_TRANSACTION
The next request in the queue is part of a transaction.
Definition: rtio.h:108
#define RTIO_SQE_MEMPOOL_BUFFER
The buffer should be allocated by the RTIO mempool.
Definition: rtio.h:120
#define RTIO_SQE_CANCELED
The SQE should not execute if possible.
Definition: rtio.h:128
#define RTIO_SQE_CHAINED
The next request in the queue should wait on this one.
Definition: rtio.h:96
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.
Definition: rtio.h:605
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.
Definition: rtio.h:517
void rtio_executor_err(struct rtio_iodev_sqe *iodev_sqe, int result)
#define RTIO_OP_CALLBACK
An operation that calls a given function (callback)
Definition: rtio.h:469
static uint32_t rtio_sqe_acquirable(struct rtio *r)
Count of acquirable submission queue events.
Definition: rtio.h:840
static void rtio_cqe_pool_free(struct rtio_cqe_pool *pool, struct rtio_cqe *cqe)
Definition: rtio.h:662
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.
Definition: rtio.h:562
static size_t rtio_mempool_block_size(const struct rtio *r)
Get the mempool block size of the RTIO context.
Definition: rtio.h:381
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.
Definition: rtio.h:1138
static void rtio_sqe_prep_nop(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, void *userdata)
Prepare a nop (no op) submission.
Definition: rtio.h:483
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 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.
Definition: rtio.h:1347
static void rtio_cqe_produce(struct rtio *r, struct rtio_cqe *cqe)
Produce a complete queue event if available.
Definition: rtio.h:950
#define RTIO_OP_TINY_TX
An operation that transmits tiny writes by copying the data to write.
Definition: rtio.h:466
static uint32_t rtio_cqe_compute_flags(struct rtio_iodev_sqe *iodev_sqe)
Compute the CQE flags from the rtio_iodev_sqe entry.
Definition: rtio.h:1031
void rtio_executor_ok(struct rtio_iodev_sqe *iodev_sqe, int result)
static int rtio_block_pool_alloc(struct rtio *r, size_t min_sz, size_t max_sz, uint8_t **buf, uint32_t *buf_len)
Definition: rtio.h:669
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 struct rtio_cqe * rtio_cqe_pool_alloc(struct rtio_cqe_pool *pool)
Definition: rtio.h:645
struct k_mem_partition rtio_partition
The memory partition associated with all RTIO context information.
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.
Definition: rtio.h:496
static struct rtio_sqe * rtio_sqe_acquire(struct rtio *r)
Acquire a single submission queue event if available.
Definition: rtio.h:901
#define RTIO_OP_TX
An operation that transmits (writes)
Definition: rtio.h:463
static void rtio_sqe_drop_all(struct rtio *r)
Drop all previously acquired sqe.
Definition: rtio.h:919
static void rtio_sqe_prep_read_multishot(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, void *userdata)
Definition: rtio.h:525
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.
static void rtio_sqe_prep_callback(struct rtio_sqe *sqe, rtio_callback_t callback, void *arg0, void *userdata)
Prepare a callback op submission.
Definition: rtio.h:588
static void rtio_access_grant(struct rtio *r, struct k_thread *t)
Grant access to an RTIO context to a user thread.
Definition: rtio.h:1253
#define RTIO_OP_TXRX
An operation that transceives (reads and writes simultaneously)
Definition: rtio.h:472
static void rtio_cqe_release(struct rtio *r, struct rtio_cqe *cqe)
Release consumed completion queue event.
Definition: rtio.h:1020
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.
Definition: rtio.h:1179
static void rtio_iodev_sqe_err(struct rtio_iodev_sqe *iodev_sqe, int result)
Inform the executor of a submissions completion with error.
Definition: rtio.h:1122
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.
Definition: rtio.h:536
void(* rtio_callback_t)(struct rtio *r, const struct rtio_sqe *sqe, void *arg0)
Callback signature for RTIO_OP_CALLBACK.
Definition: rtio.h:227
int rtio_sqe_cancel(struct rtio_sqe *sqe)
Attempt to cancel an SQE.
static void rtio_sqe_pool_free(struct rtio_sqe_pool *pool, struct rtio_iodev_sqe *iodev_sqe)
Definition: rtio.h:638
static void rtio_iodev_sqe_ok(struct rtio_iodev_sqe *iodev_sqe, int result)
Inform the executor of a submission completion with success.
Definition: rtio.h:1109
#define RTIO_OP_NOP
An operation that does nothing and will complete immediately.
Definition: rtio.h:457
static struct rtio_cqe * rtio_cqe_acquire(struct rtio *r)
Acquire a complete queue event if available.
Definition: rtio.h:934
static struct rtio_iodev_sqe * rtio_chain_next(const struct rtio_iodev_sqe *iodev_sqe)
Get the next sqe in the chain.
Definition: rtio.h:871
static struct rtio_cqe * rtio_cqe_consume(struct rtio *r)
Consume a single completion queue event if available.
Definition: rtio.h:966
static struct rtio_iodev_sqe * rtio_sqe_pool_alloc(struct rtio_sqe_pool *pool)
Definition: rtio.h:623
static struct rtio_iodev_sqe * rtio_iodev_sqe_next(const struct rtio_iodev_sqe *iodev_sqe)
Get the next sqe in the chain or transaction.
Definition: rtio.h:888
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.
static struct rtio_iodev_sqe * rtio_txn_next(const struct rtio_iodev_sqe *iodev_sqe)
Get the next sqe in the transaction.
Definition: rtio.h:853
void rtio_executor_submit(struct rtio *r)
static struct rtio_cqe * rtio_cqe_consume_block(struct rtio *r)
Wait for and consume a single completion queue event.
Definition: rtio.h:996
static void rtio_block_pool_free(struct rtio *r, void *buf, uint32_t buf_len)
Definition: rtio.h:706
#define RTIO_OP_RX
An operation that receives (reads)
Definition: rtio.h:460
int rtio_submit(struct rtio *r, uint32_t wait_count)
Submit I/O requests to the underlying executor.
void k_sem_reset(struct k_sem *sem)
Resets a semaphore's count to zero.
void k_sem_give(struct k_sem *sem)
Give a semaphore.
int k_sem_take(struct k_sem *sem, k_timeout_t timeout)
Take a semaphore.
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
#define CONTAINER_OF(ptr, type, field)
Get a pointer to a structure containing the element.
Definition: util.h:268
#define DIV_ROUND_UP(n, d)
Divide and round up.
Definition: util.h:336
#define EINVAL
Invalid argument.
Definition: errno.h:60
#define ENOMEM
Not enough core.
Definition: errno.h:50
#define ENOTSUP
Unsupported value.
Definition: errno.h:114
void k_yield(void)
Yield the current thread.
int32_t k_sleep(k_timeout_t timeout)
Put the current thread to sleep.
void k_object_access_grant(const void *object, struct k_thread *thread)
Grant a thread access to a kernel object.
A wait-free intrusive multi producer single consumer (MPSC) queue using a singly linked list.
flags
Definition: parser.h:96
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
#define UINT16_MAX
Definition: stdint.h:28
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:105
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
__INT8_TYPE__ int8_t
Definition: stdint.h:72
void * memset(void *buf, int c, size_t n)
void * memcpy(void *ZRESTRICT d, const void *ZRESTRICT s, size_t n)
Memory Partition.
Definition: mem_domain.h:55
Thread Structure.
Definition: thread.h:259
Kernel timeout type.
Definition: sys_clock.h:65
Kernel timepoint type.
Definition: sys_clock.h:219
Queue member.
Definition: mpsc_lockfree.h:79
MPSC Queue.
Definition: mpsc_lockfree.h:86
struct rtio_cqe * pool
Definition: rtio.h:313
struct mpsc free_q
Definition: rtio.h:310
const uint16_t pool_size
Definition: rtio.h:311
uint16_t pool_free
Definition: rtio.h:312
A completion queue event.
Definition: rtio.h:294
void * userdata
Associated userdata with operation.
Definition: rtio.h:298
struct mpsc_node q
Definition: rtio.h:295
uint32_t flags
Flags associated with the operation.
Definition: rtio.h:299
int32_t result
Result from operation.
Definition: rtio.h:297
API that an RTIO IO device should implement.
Definition: rtio.h:433
void(* submit)(struct rtio_iodev_sqe *iodev_sqe)
Submit to the iodev an entry to work on.
Definition: rtio.h:442
Compute the mempool block index for a given pointer.
Definition: rtio.h:423
struct rtio_iodev_sqe * next
Definition: rtio.h:426
struct rtio_sqe sqe
Definition: rtio.h:424
struct rtio * r
Definition: rtio.h:427
struct mpsc_node q
Definition: rtio.h:425
An IO device with a function table for submitting requests.
Definition: rtio.h:448
const struct rtio_iodev_api * api
Definition: rtio.h:450
void * data
Definition: rtio.h:453
struct rtio_iodev_sqe * pool
Definition: rtio.h:306
const uint16_t pool_size
Definition: rtio.h:304
struct mpsc free_q
Definition: rtio.h:303
uint16_t pool_free
Definition: rtio.h:305
A submission queue event.
Definition: rtio.h:232
uint32_t i2c_config
OP_I2C_CONFIGURE.
Definition: rtio.h:282
void * userdata
User provided data which is returned upon operation completion.
Definition: rtio.h:252
uint8_t * tx_buf
Definition: rtio.h:277
uint8_t op
Op code.
Definition: rtio.h:233
void * arg0
Last argument given to callback.
Definition: rtio.h:271
uint8_t * rx_buf
Definition: rtio.h:278
uint8_t prio
Op priority.
Definition: rtio.h:235
uint8_t * buf
Buffer to use.
Definition: rtio.h:259
uint32_t buf_len
Length of buffer.
Definition: rtio.h:258
const struct rtio_iodev * iodev
Device to operation on.
Definition: rtio.h:243
uint16_t flags
Op Flags.
Definition: rtio.h:237
uint8_t tiny_buf_len
Length of tiny buffer.
Definition: rtio.h:264
uint32_t txrx_buf_len
Definition: rtio.h:276
uint8_t tiny_buf[7]
Tiny buffer.
Definition: rtio.h:265
rtio_callback_t callback
Definition: rtio.h:270
uint16_t iodev_flags
Op iodev flags.
Definition: rtio.h:239
An RTIO context containing what can be viewed as a pair of queues.
Definition: rtio.h:327
struct rtio_cqe_pool * cqe_pool
Definition: rtio.h:357
struct mpsc sq
Definition: rtio.h:365
atomic_t cq_count
Definition: rtio.h:346
struct rtio_sqe_pool * sqe_pool
Definition: rtio.h:354
atomic_t xcqcnt
Definition: rtio.h:351
struct mpsc cq
Definition: rtio.h:368