Lines Matching +full:fifo +full:- +full:depth

6 A :dfn:`FIFO` is a kernel object that implements a traditional
7 first in, first out (FIFO) queue, allowing threads and ISRs
12 :depth: 2
17 Any number of FIFOs can be defined (limited only by available RAM). Each FIFO is
20 A FIFO has the following key properties:
25 A FIFO must be initialized before it can be used. This sets its queue to empty.
27 FIFO data items must be aligned on a word boundary, as the kernel reserves
36 FIFO data items are restricted to single active instance across all FIFO
37 data queues. Any attempt to re-add a FIFO data item to a queue before
41 A data item may be **added** to a FIFO by a thread or an ISR.
43 otherwise the item is added to the FIFO's queue.
46 A data item may be **removed** from a FIFO by a thread. If the FIFO's queue
48 Any number of threads may wait on an empty FIFO simultaneously.
53 The kernel does allow an ISR to remove an item from a FIFO, however
54 the ISR must not attempt to wait if the FIFO is empty.
56 If desired, **multiple data items** can be added to a FIFO in a single operation
57 if they are chained together into a singly-linked list. This capability can be
58 useful if multiple writers are adding sets of related data items to the FIFO,
60 items. Adding multiple data items to a FIFO is also more efficient than adding
68 Defining a FIFO
71 A FIFO is defined using a variable of type :c:struct:`k_fifo`.
74 The following code defines and initializes an empty FIFO.
76 .. code-block:: c
82 Alternatively, an empty FIFO can be defined and initialized at compile time
87 .. code-block:: c
91 Writing to a FIFO
94 A data item is added to a FIFO by calling :c:func:`k_fifo_put`.
96 The following code builds on the example above, and uses the FIFO
99 .. code-block:: c
102 void *fifo_reserved; /* 1st word reserved for use by FIFO */
121 Additionally, a singly-linked list of data items can be added to a FIFO
124 Finally, a data item can be added to a FIFO with :c:func:`k_fifo_alloc_put`.
129 Reading from a FIFO
132 A data item is removed from a FIFO by calling :c:func:`k_fifo_get`.
134 The following code builds on the example above, and uses the FIFO
138 .. code-block:: c
147 /* process FIFO data item */
155 Use a FIFO to asynchronously transfer data items of arbitrary size