48 #ifndef BSPACM_INTERNAL_UTILITY_FIFO_H
49 #define BSPACM_INTERNAL_UTILITY_FIFO_H
137 #define FIFO_DEFINE_ALLOCATION(allocation_, size_) \
140 uint8_t allocation[(size_) + sizeof(sFIFO)]; \
141 } allocation_ = { { 0, 0, sizeof(allocation_) - offsetof(sFIFO, cell) } }
150 #define FIFO_FROM_ALLOCATION(allocation_) (&(allocation_).fifo)
164 #define FIFO_ADJUST_OFFSET(fp_,v_) ((v_) % (fp_)->size)
182 uint16_t h = fp->
head;
183 uint16_t t = fp->
tail;
184 return (h - t) + ((h < t) ? fp->
size : 0U);
222 uint16_t t = fp->
tail;
223 int was_empty = (fp->
head == t);
224 int rv = was_empty ? -1 : fp->
cell[t];
225 if (force_if_empty || (! was_empty)) {
250 uint16_t h = fp->
head;
251 uint16_t t = fp->
tail;
283 uint16_t h = fp->
head;
284 uint16_t t = fp->
tail;
286 while ((bp < bpe) && (h != t)) {
static BSPACM_CORE_INLINE int fifo_full(const sFIFO *fp)
Definition: fifo.h:199
volatile uint8_t cell[]
Definition: fifo.h:121
static BSPACM_CORE_INLINE int fifo_push_head(sFIFO *fp, uint8_t v)
Definition: fifo.h:248
Common header included by all BSPACM leaf headers.
volatile uint16_t tail
Definition: fifo.h:109
#define FIFO_ADJUST_OFFSET(fp_, v_)
Definition: fifo.h:164
volatile uint16_t head
Definition: fifo.h:105
static BSPACM_CORE_INLINE void fifo_reset(sFIFO *fp)
Definition: fifo.h:169
static BSPACM_CORE_INLINE uint16_t fifo_length(const sFIFO *fp)
Definition: fifo.h:180
#define BSPACM_CORE_INLINE
Definition: core.h:65
static BSPACM_CORE_INLINE int fifo_empty(const sFIFO *fp)
Definition: fifo.h:190
static BSPACM_CORE_INLINE int fifo_pop_into_buffer(sFIFO *fp, uint8_t *bps, uint8_t *bpe)
Definition: fifo.h:279
static BSPACM_CORE_INLINE int fifo_pop_tail(sFIFO *fp, int force_if_empty)
Definition: fifo.h:219
const uint16_t size
Definition: fifo.h:117