Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sqe.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2022 Intel Corporation
3 * SPDX-FileCopyrightText: <text>Copyright (c) 2026 Infineon Technologies AG,
4 * or an affiliate of Infineon Technologies AG. All rights reserved.</text>
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
13
14
15#ifndef ZEPHYR_INCLUDE_RTIO_SQE_H_
16#define ZEPHYR_INCLUDE_RTIO_SQE_H_
17
18#include <stdint.h>
19#include <string.h>
20#include <zephyr/kernel.h>
21#include <zephyr/sys/atomic.h>
23#include <zephyr/sys/util.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
33
46
50#define RTIO_PRIO_LOW 0U
51
55#define RTIO_PRIO_NORM 127U
56
60#define RTIO_PRIO_HIGH 255U
61
65
66
73
81#define RTIO_SQE_CHAINED BIT(0)
82
93#define RTIO_SQE_TRANSACTION BIT(1)
94
95
105#define RTIO_SQE_MEMPOOL_BUFFER BIT(2)
106
113#define RTIO_SQE_CANCELED BIT(3)
114
121#define RTIO_SQE_MULTISHOT BIT(4)
122
126#define RTIO_SQE_NO_RESPONSE BIT(5)
127
131
132
139
141#define RTIO_OP_NOP 0
142
144#define RTIO_OP_RX (RTIO_OP_NOP+1)
145
147#define RTIO_OP_TX (RTIO_OP_RX+1)
148
150#define RTIO_OP_TINY_TX (RTIO_OP_TX+1)
151
153#define RTIO_OP_CALLBACK (RTIO_OP_TINY_TX+1)
154
156#define RTIO_OP_TXRX (RTIO_OP_CALLBACK+1)
157
159#define RTIO_OP_DELAY (RTIO_OP_TXRX+1)
160
162#define RTIO_OP_I2C_RECOVER (RTIO_OP_DELAY+1)
163
165#define RTIO_OP_I2C_CONFIGURE (RTIO_OP_I2C_RECOVER+1)
166
168#define RTIO_OP_I3C_RECOVER (RTIO_OP_I2C_CONFIGURE+1)
169
171#define RTIO_OP_I3C_CONFIGURE (RTIO_OP_I3C_RECOVER+1)
172
174#define RTIO_OP_I3C_CCC (RTIO_OP_I3C_CONFIGURE+1)
175
177#define RTIO_OP_AWAIT (RTIO_OP_I3C_CCC+1)
178
182
183
190
194#define RTIO_IODEV_I2C_STOP BIT(1)
195
199#define RTIO_IODEV_I2C_RESTART BIT(2)
200
204#define RTIO_IODEV_I2C_10_BITS BIT(3)
205
209
216
220#define RTIO_IODEV_I3C_STOP BIT(1)
221
225#define RTIO_IODEV_I3C_RESTART BIT(2)
226
230#define RTIO_IODEV_I3C_HDR BIT(3)
231
235#define RTIO_IODEV_I3C_NBCH BIT(4)
236
240#define RTIO_IODEV_I3C_HDR_MODE_MASK GENMASK(15, 8)
241
245#define RTIO_IODEV_I3C_HDR_MODE_SET(flags) \
246 FIELD_PREP(RTIO_IODEV_I3C_HDR_MODE_MASK, flags)
247
251#define RTIO_IODEV_I3C_HDR_MODE_GET(flags) \
252 FIELD_GET(RTIO_IODEV_I3C_HDR_MODE_MASK, flags)
253
257#define RTIO_IODEV_I3C_HDR_CMD_CODE_MASK GENMASK(22, 16)
258
262#define RTIO_IODEV_I3C_HDR_CMD_CODE_SET(flags) \
263 FIELD_PREP(RTIO_IODEV_I3C_HDR_CMD_CODE_MASK, flags)
264
268#define RTIO_IODEV_I3C_HDR_CMD_CODE_GET(flags) \
269 FIELD_GET(RTIO_IODEV_I3C_HDR_CMD_CODE_MASK, flags)
270
274
275
277struct rtio_sqe;
278struct rtio_iodev_sqe;
279struct rtio_iodev;
280struct rtio;
282
291typedef void (*rtio_callback_t)(struct rtio *r, const struct rtio_sqe *sqe, int res, void *arg0);
292
299typedef void (*rtio_signaled_t)(struct rtio_iodev_sqe *iodev_sqe, void *userdata);
300
304struct rtio_sqe {
306
308
310
312
313 const struct rtio_iodev *iodev;
314
322 void *userdata;
323
324 union {
325
327 struct {
329 const uint8_t *buf;
330 } tx;
331
333 struct {
334 uint32_t buf_len;
336 } rx;
337
339 struct {
342 } tiny_tx;
343
345 struct {
347 void *arg0;
348 } callback;
349
351 struct {
352 uint32_t buf_len;
355 } txrx;
356
357#ifdef CONFIG_RTIO_OP_DELAY
359 struct {
360 k_timeout_t timeout;
361 k_timepoint_t expiry;
362 } delay;
363#endif
364
367
369 struct {
370 /* enum i3c_config_type type; */
371 int type;
372 void *config;
373 } i3c_config;
374
376 /* struct i3c_ccc_payload *ccc_payload; */
378
380 struct {
383 void *userdata;
384 } await;
385 };
386};
387
388
395 struct rtio_sqe sqe;
396 struct mpsc_node q;
398 struct rtio *r;
399};
400
401
403/* Ensure the rtio_iodev_sqe never grows beyond a common cacheline size of 64 bytes */
404#if CONFIG_RTIO_SQE_CACHELINE_CHECK
405#ifdef CONFIG_DCACHE_LINE_SIZE
406#define RTIO_CACHE_LINE_SIZE CONFIG_DCACHE_LINE_SIZE
407#else
408#define RTIO_CACHE_LINE_SIZE 64
409#endif
410BUILD_ASSERT(sizeof(struct rtio_iodev_sqe) <= RTIO_CACHE_LINE_SIZE,
411 "RTIO performs best when the submissions queue entries are less than a cache line");
412#endif
414
418static inline void rtio_sqe_prep_nop(struct rtio_sqe *sqe,
419 const struct rtio_iodev *iodev,
420 void *userdata)
421{
422 memset(sqe, 0, sizeof(struct rtio_sqe));
423 sqe->op = RTIO_OP_NOP;
424 sqe->iodev = iodev;
425 sqe->userdata = userdata;
426}
427
428
433static inline void _rtio_sqe_prep_read(struct rtio_sqe *sqe,
434 const struct rtio_iodev *iodev,
435 int8_t prio,
436 uint8_t *buf,
437 uint32_t len,
438 void *userdata)
439{
440 memset(sqe, 0, sizeof(struct rtio_sqe));
441 sqe->op = RTIO_OP_RX;
442 sqe->prio = prio;
443 sqe->iodev = iodev;
444 sqe->rx.buf_len = len;
445 sqe->rx.buf = buf;
446 sqe->userdata = userdata;
447}
449
453static inline void rtio_sqe_prep_read(struct rtio_sqe *sqe,
454 const struct rtio_iodev *iodev,
455 int8_t prio,
456 uint8_t *buf,
457 uint32_t len,
458 void *userdata)
459{
460 __ASSERT_NO_MSG(len > 0 && buf != NULL);
461
462 _rtio_sqe_prep_read(sqe, iodev, prio, buf, len, userdata);
463}
464
470static inline void rtio_sqe_prep_read_with_pool(struct rtio_sqe *sqe,
471 const struct rtio_iodev *iodev, int8_t prio,
472 void *userdata)
473{
474 _rtio_sqe_prep_read(sqe, iodev, prio, NULL, 0, userdata);
476}
477
478static inline void rtio_sqe_prep_read_multishot(struct rtio_sqe *sqe,
479 const struct rtio_iodev *iodev, int8_t prio,
480 void *userdata)
481{
482 rtio_sqe_prep_read_with_pool(sqe, iodev, prio, userdata);
484}
485
489static inline void rtio_sqe_prep_write(struct rtio_sqe *sqe,
490 const struct rtio_iodev *iodev,
491 int8_t prio,
492 const uint8_t *buf,
493 uint32_t len,
494 void *userdata)
495{
496 __ASSERT_NO_MSG(len > 0 && buf != NULL);
497
498 memset(sqe, 0, sizeof(struct rtio_sqe));
499 sqe->op = RTIO_OP_TX;
500 sqe->prio = prio;
501 sqe->iodev = iodev;
502 sqe->tx.buf_len = len;
503 sqe->tx.buf = buf;
504 sqe->userdata = userdata;
505}
506
517static inline void rtio_sqe_prep_tiny_write(struct rtio_sqe *sqe,
518 const struct rtio_iodev *iodev,
519 int8_t prio,
520 const uint8_t *tiny_write_data,
521 uint8_t tiny_write_len,
522 void *userdata)
523{
524 __ASSERT_NO_MSG(tiny_write_len <= sizeof(sqe->tiny_tx.buf));
525 __ASSERT_NO_MSG(tiny_write_len > 0 && tiny_write_data != NULL);
526
527 memset(sqe, 0, sizeof(struct rtio_sqe));
528 sqe->op = RTIO_OP_TINY_TX;
529 sqe->prio = prio;
530 sqe->iodev = iodev;
531 sqe->tiny_tx.buf_len = tiny_write_len;
532 memcpy(sqe->tiny_tx.buf, tiny_write_data, tiny_write_len);
533 sqe->userdata = userdata;
534}
535
544static inline void rtio_sqe_prep_callback(struct rtio_sqe *sqe,
545 rtio_callback_t callback,
546 void *arg0,
547 void *userdata)
548{
549 memset(sqe, 0, sizeof(struct rtio_sqe));
550 sqe->op = RTIO_OP_CALLBACK;
551 sqe->prio = 0;
552 sqe->iodev = NULL;
553 sqe->callback.callback = callback;
554 sqe->callback.arg0 = arg0;
555 sqe->userdata = userdata;
556}
557
568static inline void rtio_sqe_prep_callback_no_cqe(struct rtio_sqe *sqe,
569 rtio_callback_t callback,
570 void *arg0,
571 void *userdata)
572{
573 rtio_sqe_prep_callback(sqe, callback, arg0, userdata);
575}
576
580static inline void rtio_sqe_prep_transceive(struct rtio_sqe *sqe,
581 const struct rtio_iodev *iodev,
582 int8_t prio,
583 const uint8_t *tx_buf,
584 uint8_t *rx_buf,
585 uint32_t buf_len,
586 void *userdata)
587{
588 __ASSERT_NO_MSG(buf_len > 0 && tx_buf != NULL && rx_buf != NULL);
589
590 memset(sqe, 0, sizeof(struct rtio_sqe));
591 sqe->op = RTIO_OP_TXRX;
592 sqe->prio = prio;
593 sqe->iodev = iodev;
594 sqe->txrx.buf_len = buf_len;
595 sqe->txrx.tx_buf = tx_buf;
596 sqe->txrx.rx_buf = rx_buf;
597 sqe->userdata = userdata;
598}
599
614static inline void rtio_sqe_prep_await(struct rtio_sqe *sqe,
615 const struct rtio_iodev *iodev,
616 int8_t prio,
617 void *userdata)
618{
619 memset(sqe, 0, sizeof(struct rtio_sqe));
620 sqe->op = RTIO_OP_AWAIT;
621 sqe->prio = prio;
622 sqe->iodev = iodev;
623 sqe->userdata = userdata;
624}
625
637static inline void rtio_sqe_prep_await_iodev(struct rtio_sqe *sqe, const struct rtio_iodev *iodev,
638 int8_t prio, void *userdata)
639{
640 __ASSERT_NO_MSG(iodev != NULL);
641 rtio_sqe_prep_await(sqe, iodev, prio, userdata);
642}
643
654static inline void rtio_sqe_prep_await_executor(struct rtio_sqe *sqe, int8_t prio, void *userdata)
655{
656 rtio_sqe_prep_await(sqe, NULL, prio, userdata);
657}
658
670#ifdef CONFIG_RTIO_OP_DELAY
677extern struct rtio_iodev rtio_timeout_iodev;
678
679static inline void rtio_sqe_prep_delay(struct rtio_sqe *sqe,
680 k_timeout_t timeout,
681 void *userdata)
682{
683 memset(sqe, 0, sizeof(struct rtio_sqe));
684 sqe->op = RTIO_OP_DELAY;
685 sqe->prio = 0;
686 sqe->iodev = &rtio_timeout_iodev;
687 sqe->delay.timeout = timeout;
688 sqe->userdata = userdata;
689}
690#else
691#define rtio_sqe_prep_delay(sqe, timeout, userdata) \
692 BUILD_ASSERT(false, "CONFIG_RTIO_OP_DELAY not enabled")
693#endif
694
696static inline void rtio_sqe_prep_i2c_configure(struct rtio_sqe *sqe,
697 const struct rtio_iodev *iodev,
698 int8_t prio,
699 uint32_t dev_config,
700 void *userdata)
701{
702 memset(sqe, 0, sizeof(struct rtio_sqe));
704 sqe->prio = prio;
705 sqe->iodev = iodev;
706 sqe->i2c_config = dev_config;
707 sqe->userdata = userdata;
708}
709
711static inline void rtio_sqe_prep_i2c_recover(struct rtio_sqe *sqe,
712 const struct rtio_iodev *iodev,
713 int8_t prio,
714 void *userdata)
715{
716 memset(sqe, 0, sizeof(struct rtio_sqe));
717 sqe->op = RTIO_OP_I2C_RECOVER;
718 sqe->prio = prio;
719 sqe->iodev = iodev;
720 sqe->userdata = userdata;
721}
722
731static inline struct rtio_iodev_sqe *rtio_txn_next(const struct rtio_iodev_sqe *iodev_sqe)
732{
733 struct rtio_iodev_sqe *next = NULL;
734
735 SYS_PORT_TRACING_FUNC_ENTER(rtio, txn_next, iodev_sqe->r, iodev_sqe);
736 if (iodev_sqe->sqe.flags & RTIO_SQE_TRANSACTION) {
737 next = iodev_sqe->next;
738 }
739 SYS_PORT_TRACING_FUNC_EXIT(rtio, txn_next, iodev_sqe->r, next);
740 return next;
741}
742
743
752static inline struct rtio_iodev_sqe *rtio_chain_next(const struct rtio_iodev_sqe *iodev_sqe)
753{
754 struct rtio_iodev_sqe *next = NULL;
755
756 SYS_PORT_TRACING_FUNC_ENTER(rtio, txn_next, iodev_sqe->r, iodev_sqe);
757 if (iodev_sqe->sqe.flags & RTIO_SQE_CHAINED) {
758 next = iodev_sqe->next;
759 }
760 SYS_PORT_TRACING_FUNC_EXIT(rtio, txn_next, iodev_sqe->r, next);
761 return next;
762}
763
772static inline struct rtio_iodev_sqe *rtio_iodev_sqe_next(const struct rtio_iodev_sqe *iodev_sqe)
773{
774 return iodev_sqe->next;
775}
776
787static inline void rtio_iodev_sqe_await_signal(struct rtio_iodev_sqe *iodev_sqe,
788 rtio_signaled_t callback,
789 void *userdata)
790{
791 iodev_sqe->sqe.await.callback = callback;
792 iodev_sqe->sqe.await.userdata = userdata;
793
794 if (!atomic_cas(&iodev_sqe->sqe.await.ok, 0, 1)) {
795 callback(iodev_sqe, userdata);
796 }
797}
798
799/* Private structures and functions used for the pool of sqe structures */
801
802struct rtio_sqe_pool {
803 struct mpsc free_q;
804 const uint16_t pool_size;
805 uint16_t pool_free;
806 struct rtio_iodev_sqe *pool;
807};
808
809static inline struct rtio_iodev_sqe *rtio_sqe_pool_alloc(struct rtio_sqe_pool *pool)
810{
811 struct mpsc_node *node = mpsc_pop(&pool->free_q);
812
813 if (node == NULL) {
814 return NULL;
815 }
816
817 struct rtio_iodev_sqe *iodev_sqe = CONTAINER_OF(node, struct rtio_iodev_sqe, q);
818
819 pool->pool_free--;
820
821 return iodev_sqe;
822}
823
824static inline void rtio_sqe_pool_free(struct rtio_sqe_pool *pool, struct rtio_iodev_sqe *iodev_sqe)
825{
826 mpsc_push(&pool->free_q, &iodev_sqe->q);
827
828 pool->pool_free++;
829}
830
831#if CONFIG_RTIO_SQE_PLACEMENT_DTCM
832#define RTIO_SQE_MEM Z_GENERIC_SECTION(".dtcm_bss") static
833#elif defined(CONFIG_RTIO_SQE_PLACEMENT_NOCACHE)
834#define RTIO_SQE_MEM __nocache static
835#else
836#define RTIO_SQE_MEM static
837#endif
838
839/* Do not try and reformat the macros */
840/* clang-format off */
841
842#define Z_RTIO_SQE_POOL_DEFINE(name, sz) \
843 RTIO_SQE_MEM struct rtio_iodev_sqe CONCAT(_sqe_pool_, name)[sz]; \
844 STRUCT_SECTION_ITERABLE(rtio_sqe_pool, name) = { \
845 .free_q = MPSC_INIT((name.free_q)), \
846 .pool_size = sz, \
847 .pool_free = sz, \
848 .pool = CONCAT(_sqe_pool_, name), \
849 }
850
851/* clang-format on */
853
857
858#ifdef __cplusplus
859}
860#endif
861
862#endif /* ZEPHYR_INCLUDE_RTIO_SQE_H_ */
workaround assembler barfing for ST r
Definition asm-macro-32-bit-gnu.h:27
long atomic_t
Atomic integer variable.
Definition atomic_types.h:31
bool atomic_cas(atomic_t *target, atomic_val_t old_value, atomic_val_t new_value)
Atomic compare-and-set.
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_OP_CALLBACK
An operation that calls a given function (callback).
Definition sqe.h:153
#define RTIO_OP_I2C_RECOVER
An operation to recover I2C buses.
Definition sqe.h:162
#define RTIO_OP_TINY_TX
An operation that transmits tiny writes by copying the data to write.
Definition sqe.h:150
#define RTIO_OP_TX
An operation that transmits (writes).
Definition sqe.h:147
#define RTIO_OP_TXRX
An operation that transceives (reads and writes simultaneously).
Definition sqe.h:156
#define RTIO_OP_NOP
An operation that does nothing and will complete immediately.
Definition sqe.h:141
#define RTIO_OP_AWAIT
An operation to await a signal while blocking the iodev (if one is provided).
Definition sqe.h:177
#define RTIO_OP_I2C_CONFIGURE
An operation to configure I2C buses.
Definition sqe.h:165
#define RTIO_OP_DELAY
An operation that takes a specified amount of time (asynchronously) before completing.
Definition sqe.h:159
#define RTIO_OP_RX
An operation that receives (reads).
Definition sqe.h:144
#define RTIO_SQE_MULTISHOT
The SQE should continue producing CQEs until canceled.
Definition sqe.h:121
#define RTIO_SQE_TRANSACTION
The next request in the queue is part of a transaction.
Definition sqe.h:93
#define RTIO_SQE_MEMPOOL_BUFFER
The buffer should be allocated by the RTIO mempool.
Definition sqe.h:105
#define RTIO_SQE_NO_RESPONSE
The SQE does not produce a CQE.
Definition sqe.h:126
#define RTIO_SQE_CHAINED
The next request in the queue should wait on this one.
Definition sqe.h:81
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 sqe.h:470
static void rtio_sqe_prep_i2c_recover(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, void *userdata)
Prepare an i2c recover op submission.
Definition sqe.h:711
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 sqe.h:517
static void rtio_sqe_prep_nop(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, void *userdata)
Prepare a nop (no op) submission.
Definition sqe.h:418
void(* rtio_callback_t)(struct rtio *r, const struct rtio_sqe *sqe, int res, void *arg0)
Callback signature for RTIO_OP_CALLBACK.
Definition sqe.h:291
static void rtio_sqe_prep_await_iodev(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, void *userdata)
Prepare an await op submission which blocks an rtio_iodev until completion.
Definition sqe.h:637
static void rtio_iodev_sqe_await_signal(struct rtio_iodev_sqe *iodev_sqe, rtio_signaled_t callback, void *userdata)
Await an AWAIT SQE signal from RTIO IODEV.
Definition sqe.h:787
static void rtio_sqe_prep_write(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, const uint8_t *buf, uint32_t len, void *userdata)
Prepare a write op submission.
Definition sqe.h:489
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 sqe.h:453
static void rtio_sqe_prep_read_multishot(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, void *userdata)
Definition sqe.h:478
static void rtio_sqe_prep_callback(struct rtio_sqe *sqe, rtio_callback_t callback, void *arg0, void *userdata)
Prepare a callback op submission.
Definition sqe.h:544
static void rtio_sqe_prep_await_executor(struct rtio_sqe *sqe, int8_t prio, void *userdata)
Prepare an await op submission which completes the sqe after being signaled.
Definition sqe.h:654
void(* rtio_signaled_t)(struct rtio_iodev_sqe *iodev_sqe, void *userdata)
Callback signature for RTIO_OP_AWAIT signaled.
Definition sqe.h:299
static void rtio_sqe_prep_transceive(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, const uint8_t *tx_buf, uint8_t *rx_buf, uint32_t buf_len, void *userdata)
Prepare a transceive op submission.
Definition sqe.h:580
static void rtio_sqe_prep_i2c_configure(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, uint32_t dev_config, void *userdata)
Prepare an i2c configure op submission.
Definition sqe.h:696
#define rtio_sqe_prep_delay(sqe, timeout, userdata)
Prepare a delay operation submission which completes after the given timeout.
Definition sqe.h:691
static struct rtio_iodev_sqe * rtio_chain_next(const struct rtio_iodev_sqe *iodev_sqe)
Get the next sqe in the chain.
Definition sqe.h:752
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 sqe.h:772
static void rtio_sqe_prep_callback_no_cqe(struct rtio_sqe *sqe, rtio_callback_t callback, void *arg0, void *userdata)
Prepare a callback op submission that does not create a CQE.
Definition sqe.h:568
static struct rtio_iodev_sqe * rtio_txn_next(const struct rtio_iodev_sqe *iodev_sqe)
Get the next sqe in the transaction.
Definition sqe.h:731
static void rtio_sqe_prep_await(struct rtio_sqe *sqe, const struct rtio_iodev *iodev, int8_t prio, void *userdata)
Prepare an await op submission.
Definition sqe.h:614
#define SYS_PORT_TRACING_FUNC_ENTER(type, func,...)
Tracing macro for the entry into a function that might or might not return a value.
Definition tracing_macros.h:257
#define SYS_PORT_TRACING_FUNC_EXIT(type, func,...)
Tracing macro for when a function ends its execution.
Definition tracing_macros.h:283
#define CONTAINER_OF(ptr, type, field)
Get a pointer to a structure containing the element.
Definition util.h:281
#define NULL
Definition iar_missing_defs.h:20
#define BUILD_ASSERT(EXPR, MSG...)
Definition llvm.h:51
Public kernel APIs.
A wait-free intrusive multi producer single consumer (MPSC) queue using a singly linked list.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__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)
Kernel timeout type.
Definition clock.h:65
Kernel timepoint type.
Definition clock.h:291
Queue member.
Definition mpsc_lockfree.h:79
IO device submission queue entry.
Definition sqe.h:394
struct rtio_iodev_sqe * next
Definition sqe.h:397
struct rtio_sqe sqe
Definition sqe.h:395
struct rtio * r
Definition sqe.h:398
struct mpsc_node q
Definition sqe.h:396
An IO device with a function table for submitting requests.
Definition iodev.h:48
A submission queue event.
Definition sqe.h:304
uint32_t i2c_config
OP_I2C_CONFIGURE.
Definition sqe.h:366
void * userdata
User provided data which is returned upon operation completion.
Definition sqe.h:322
const uint8_t * tx_buf
Buffer to write from.
Definition sqe.h:353
uint8_t op
Op code.
Definition sqe.h:305
void * arg0
Last argument given to callback.
Definition sqe.h:347
atomic_t ok
Definition sqe.h:381
uint8_t * rx_buf
Buffer to read into.
Definition sqe.h:354
struct rtio_sqe::@342363352172076106335370162240320153276337137375::@017245174153135075241134370152236032302025336125 tiny_tx
OP_TINY_TX.
uint8_t prio
Op priority.
Definition sqe.h:307
uint32_t buf_len
Length of buffer.
Definition sqe.h:328
const struct rtio_iodev * iodev
Device to operation on.
Definition sqe.h:313
struct rtio_sqe::@342363352172076106335370162240320153276337137375::@331301263323312231326352370225016114352302103127 txrx
OP_TXRX.
struct rtio_sqe::@342363352172076106335370162240320153276337137375::@330064006263143366064036221227125351044336131221 await
OP_AWAIT.
uint32_t iodev_flags
Op iodev flags.
Definition sqe.h:311
void * ccc_payload
OP_I3C_CCC.
Definition sqe.h:377
struct rtio_sqe::@342363352172076106335370162240320153276337137375::@325336075103140057167073177100146101272354232055 tx
OP_TX.
struct rtio_sqe::@342363352172076106335370162240320153276337137375::@110162343014114265152332336213215220201374200140 rx
OP_RX.
int type
Definition sqe.h:371
uint16_t flags
Op Flags.
Definition sqe.h:309
const uint8_t * buf
Buffer to write from.
Definition sqe.h:329
void * config
Definition sqe.h:372
rtio_callback_t callback
Definition sqe.h:346
An RTIO context containing what can be viewed as a pair of queues.
Definition rtio.h:70
Header file for the Atomic operations API.
Misc utilities.