34#ifndef _FREERTOS_DRIVERS_COMMON_FIXEDQUEUE_HXX_
35#define _FREERTOS_DRIVERS_COMMON_FIXEDQUEUE_HXX_
69 size_t size() {
return __atomic_load_n(&
count_, __ATOMIC_SEQ_CST); }
81 __atomic_fetch_add(&
count_, -1, __ATOMIC_SEQ_CST);
94 __atomic_fetch_add(&
count_, 1, __ATOMIC_SEQ_CST);
112 if (
full())
return false;
114 if (++new_index >= SIZE) new_index = 0;
121 __atomic_fetch_add(&
count_, 1, __ATOMIC_SEQ_CST);
This structure is safe to use from an interrupt context and a regular context at the same time,...
void increment_front()
Removes the head of the FIFO from the queue.
T storage_[SIZE]
Payload of elements stored.
uint8_t rdIndex_
The index of the element to return next upon a read.
bool has_noncommit_space()
void increment_back()
Commits the element at back() into the queue.
void commit_back()
Commits the oldest entry reserved by noncommit_back.
T & front()
Returns the head of the FIFO (next element to read).
T & back()
Returns the space to write the next element to.
uint8_t wrIndex_
The index of the element where to write the next input to.
void noncommit_back()
Increments the back pointer without committing the entry into the queue.
volatile uint8_t count_
How many elements are there in the queue.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.