Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
|
RTIO Single Producer Single Consumer (SPSC) Queue API. More...
Files | |
file | rtio_spsc.h |
A lock-free and type safe power of 2 fixed sized single producer single consumer (SPSC) queue using a ringbuffer and atomics to ensure coherency. | |
Macros | |
#define | RTIO_SPSC_INITIALIZER(sz, buf) |
Statically initialize an rtio_spsc. | |
#define | RTIO_SPSC_DECLARE(name, type) |
Declare an anonymous struct type for an rtio_spsc. | |
#define | RTIO_SPSC_DEFINE(name, type, sz) |
Define an rtio_spsc with a fixed size. | |
#define | rtio_spsc_size(spsc) ((spsc)->_spsc.mask + 1) |
Size of the SPSC queue. | |
#define | rtio_spsc_reset(spsc) |
Initialize/reset a spsc such that its empty. | |
#define | rtio_spsc_acquire(spsc) |
Acquire an element to produce from the SPSC. | |
#define | rtio_spsc_produce(spsc) |
Produce one previously acquired element to the SPSC. | |
#define | rtio_spsc_produce_all(spsc) |
Produce all previously acquired elements to the SPSC. | |
#define | rtio_spsc_drop_all(spsc) |
Drop all previously acquired elements. | |
#define | rtio_spsc_consume(spsc) |
Consume an element from the spsc. | |
#define | rtio_spsc_release(spsc) |
Release a consumed element. | |
#define | rtio_spsc_release_all(spsc) |
Release all consumed elements. | |
#define | rtio_spsc_acquirable(spsc) |
Count of acquirable in spsc. | |
#define | rtio_spsc_consumable(spsc) ({ (spsc)->_spsc.in - (spsc)->_spsc.out - (spsc)->_spsc.consume; }) |
Count of consumables in spsc. | |
#define | rtio_spsc_peek(spsc) |
Peek at the first available item in queue. | |
#define | rtio_spsc_next(spsc, item) |
Peek at the next item in the queue from a given one. | |
#define | rtio_spsc_prev(spsc, item) |
Get the previous item in the queue from a given one. | |
RTIO Single Producer Single Consumer (SPSC) Queue API.
#define rtio_spsc_acquirable | ( | spsc | ) |
#include <zephyr/rtio/rtio_spsc.h>
Count of acquirable in spsc.
spsc | SPSC to get item count for |
#define rtio_spsc_acquire | ( | spsc | ) |
#include <zephyr/rtio/rtio_spsc.h>
Acquire an element to produce from the SPSC.
spsc | SPSC to acquire an element from for producing |
#define rtio_spsc_consumable | ( | spsc | ) | ({ (spsc)->_spsc.in - (spsc)->_spsc.out - (spsc)->_spsc.consume; }) |
#include <zephyr/rtio/rtio_spsc.h>
Count of consumables in spsc.
spsc | SPSC to get item count for |
#define rtio_spsc_consume | ( | spsc | ) |
#include <zephyr/rtio/rtio_spsc.h>
Consume an element from the spsc.
spsc | Spsc to consume from |
#define RTIO_SPSC_DECLARE | ( | name, | |
type | |||
) |
#include <zephyr/rtio/rtio_spsc.h>
Declare an anonymous struct type for an rtio_spsc.
name | Name of the spsc symbol to be provided |
type | Type stored in the spsc |
#define RTIO_SPSC_DEFINE | ( | name, | |
type, | |||
sz | |||
) |
#include <zephyr/rtio/rtio_spsc.h>
Define an rtio_spsc with a fixed size.
name | Name of the spsc symbol to be provided |
type | Type stored in the spsc |
sz | Size of the spsc, must be power of 2 (ex: 2, 4, 8) |
#define rtio_spsc_drop_all | ( | spsc | ) |
#include <zephyr/rtio/rtio_spsc.h>
Drop all previously acquired elements.
This makes all previous acquired elements available to be acquired again
spsc | SPSC to drop all previously acquired elements or do nothing |
#define RTIO_SPSC_INITIALIZER | ( | sz, | |
buf | |||
) |
#include <zephyr/rtio/rtio_spsc.h>
Statically initialize an rtio_spsc.
sz | Size of the spsc, must be power of 2 (ex: 2, 4, 8) |
buf | Buffer pointer |
#define rtio_spsc_next | ( | spsc, | |
item | |||
) |
#include <zephyr/rtio/rtio_spsc.h>
Peek at the next item in the queue from a given one.
spsc | SPSC to peek at |
item | Pointer to an item in the queue |
#define rtio_spsc_peek | ( | spsc | ) |
#include <zephyr/rtio/rtio_spsc.h>
Peek at the first available item in queue.
spsc | Spsc to peek into |
#define rtio_spsc_prev | ( | spsc, | |
item | |||
) |
#include <zephyr/rtio/rtio_spsc.h>
Get the previous item in the queue from a given one.
spsc | SPSC to peek at |
item | Pointer to an item in the queue |
#define rtio_spsc_produce | ( | spsc | ) |
#include <zephyr/rtio/rtio_spsc.h>
Produce one previously acquired element to the SPSC.
This makes one element available to the consumer immediately
spsc | SPSC to produce the previously acquired element or do nothing |
#define rtio_spsc_produce_all | ( | spsc | ) |
#include <zephyr/rtio/rtio_spsc.h>
Produce all previously acquired elements to the SPSC.
This makes all previous acquired elements available to the consumer immediately
spsc | SPSC to produce all previously acquired elements or do nothing |
#define rtio_spsc_release | ( | spsc | ) |
#include <zephyr/rtio/rtio_spsc.h>
Release a consumed element.
spsc | SPSC to release consumed element or do nothing |
#define rtio_spsc_release_all | ( | spsc | ) |
#include <zephyr/rtio/rtio_spsc.h>
Release all consumed elements.
spsc | SPSC to release consumed elements or do nothing |
#define rtio_spsc_reset | ( | spsc | ) |
#include <zephyr/rtio/rtio_spsc.h>
Initialize/reset a spsc such that its empty.
Note that this is not safe to do while being used in a producer/consumer situation with multiple calling contexts (isrs/threads).
spsc | SPSC to initialize/reset |
#define rtio_spsc_size | ( | spsc | ) | ((spsc)->_spsc.mask + 1) |