16#define SPSC_BARRIER() __asm volatile ("dmb" ::: "memory")
18#define SPSC_BARRIER() __sync_synchronize()
29#define SPSC_DEFINE(name, type, n) \
30 static uint8_t name##_buf[(n) * sizeof(type)]; \
31 static spsc_t name = { 0u, 0u, (n) - 1u, sizeof(type), name##_buf }
37 const uint32_t h = q->
head;
38 if (h - q->
tail > q->
mask)
return -1;
47 const uint32_t t = q->
tail;
48 if (q->
head == t)
return 0;
static int spsc_push(spsc_t *q, const void *it)
static void spsc_reset(spsc_t *q)
static uint32_t spsc_count(const spsc_t *q)
static int spsc_pop(spsc_t *q, void *it)
volatile uint32_t tail
written by the consumer only
volatile uint32_t head
written by the producer only