15#ifndef ZEPHYR_INCLUDE_RTIO_CQE_H_
16#define ZEPHYR_INCLUDE_RTIO_CQE_H_
45#define RTIO_CQE_FLAG_MEMPOOL_BUFFER BIT(0)
47#define RTIO_CQE_FLAG_GET(flags) FIELD_GET(GENMASK(7, 0), (flags))
55#define RTIO_CQE_FLAG_MEMPOOL_GET_BLK_IDX(flags) FIELD_GET(GENMASK(19, 8), (flags))
63#define RTIO_CQE_FLAG_MEMPOOL_GET_BLK_CNT(flags) FIELD_GET(GENMASK(31, 20), (flags))
72#define RTIO_CQE_FLAG_PREP_MEMPOOL(blk_idx, blk_cnt) \
73 (FIELD_PREP(GENMASK(7, 0), RTIO_CQE_FLAG_MEMPOOL_BUFFER) | \
74 FIELD_PREP(GENMASK(19, 8), blk_idx) | FIELD_PREP(GENMASK(31, 20), blk_cnt))
102static inline struct rtio_cqe *rtio_cqe_pool_alloc(
struct rtio_cqe_pool *pool)
119static inline void rtio_cqe_pool_free(
struct rtio_cqe_pool *pool,
struct rtio_cqe *cqe)
129#define Z_RTIO_CQE_POOL_DEFINE(name, sz) \
130 static struct rtio_cqe CONCAT(_cqe_pool_, name)[sz]; \
131 STRUCT_SECTION_ITERABLE(rtio_cqe_pool, name) = { \
132 .free_q = MPSC_INIT((name.free_q)), \
135 .pool = CONCAT(_cqe_pool_, name), \
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 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
A wait-free intrusive multi producer single consumer (MPSC) queue using a singly linked list.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
void * memset(void *buf, int c, size_t n)
Queue member.
Definition mpsc_lockfree.h:79
MPSC Queue.
Definition mpsc_lockfree.h:86
A completion queue event.
Definition cqe.h:83
void * userdata
Associated userdata with operation.
Definition cqe.h:87
struct mpsc_node q
Definition cqe.h:84
uint32_t flags
Flags associated with the operation.
Definition cqe.h:88
int32_t result
Result from operation.
Definition cqe.h:86