16#ifndef ZEPHYR_INCLUDE_RTIO_CQE_H_
17#define ZEPHYR_INCLUDE_RTIO_CQE_H_
46#define RTIO_CQE_FLAG_MEMPOOL_BUFFER BIT(0)
54#define RTIO_CQE_FLAG_GET(flags) FIELD_GET(GENMASK(7, 0), (flags))
62#define RTIO_CQE_FLAG_MEMPOOL_GET_BLK_IDX(flags) FIELD_GET(GENMASK(19, 8), (flags))
70#define RTIO_CQE_FLAG_MEMPOOL_GET_BLK_CNT(flags) FIELD_GET(GENMASK(31, 20), (flags))
79#define RTIO_CQE_FLAG_PREP_MEMPOOL(blk_idx, blk_cnt) \
80 (FIELD_PREP(GENMASK(7, 0), RTIO_CQE_FLAG_MEMPOOL_BUFFER) | \
81 FIELD_PREP(GENMASK(19, 8), blk_idx) | FIELD_PREP(GENMASK(31, 20), blk_cnt))
103struct rtio_cqe_pool {
111static inline struct rtio_cqe *rtio_cqe_pool_alloc(
struct rtio_cqe_pool *pool)
128static inline void rtio_cqe_pool_free(
struct rtio_cqe_pool *pool,
struct rtio_cqe *cqe)
138#define Z_RTIO_CQE_POOL_DEFINE(name, sz) \
139 static struct rtio_cqe CONCAT(_cqe_pool_, name)[sz]; \
140 STRUCT_SECTION_ITERABLE(rtio_cqe_pool, name) = { \
141 .free_q = MPSC_INIT((name.free_q)), \
144 .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
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:90
void * userdata
Associated userdata with operation.
Definition cqe.h:96
uint32_t flags
Flags associated with the operation.
Definition cqe.h:97
int32_t result
Result from operation.
Definition cqe.h:95
Iterable sections helpers.