Struct multififo
Defined in File multififo.h
Struct Documentation
-
struct multififo
A FIFO which itself contains multiple child shadow FIFOs.
Useful when you want to put large packets of data into a FIFO, but have consumers pull them out in much smaller chunks, such as when you have a process which produces large packets of data which you want to send over UART without disrupting/preempting the main process. This can be easily done with this data structure and a say 1ms “tick” ISR which pulls data out of a child FIFO as it becomes available.
All data lives in the “root” FIFO; no copies are made to child FIFOs.
NOT thread safe.
Synchronization safe, as in non-concurrent asynchronous accesses are OK: FIFO provides a simple internal boolean “lock” which is taken and release during:
All other functions must be called synchronously or bad things will probably happen.
Public Members
-
uint8_t front_refmask
Bitmask indicating which child FIFOs have finished processing the current front element in multififo::root, and which haven’t. Child FIFO
i
sets bit.1 << i
-
bool locked
Super simple, non-threadsafe synchronization mechanism indicating if the multififo is currently busy doing stuff. Callers consuming data through child FIFOs should check this flag before attempting to remove any data; if it is set, then an operation is in progress and any sort of dequeueing will probably cause errors.
-
struct multififo_children_mgmt children
Management of all root and child datablocks and metadata for the multi-FIFO.
-
uint32_t flags
Run-time configuration parameters. Valid flags are:
All other flags are ignored.
-
uint8_t front_refmask