doc: Edit microkernel_fifos for consistent .rst style and formatting.
Making all the files in this section consistent with :dfn: in the intro paragraph, API headings, present-tense verbs in APIs, parallel wording. Change-Id: I5259c443076b1ac6602352dab42d35d5aca6e5b5 Signed-off-by: L.S. Cook <leonax.cook@intel.com>
This commit is contained in:
parent
fd2c760593
commit
9b1bd225ec
1 changed files with 28 additions and 23 deletions
|
@ -6,27 +6,29 @@ FIFOs
|
||||||
Concepts
|
Concepts
|
||||||
********
|
********
|
||||||
|
|
||||||
The microkernel's FIFO object type is an implementation of a traditional
|
The microkernel's :dfn:`FIFO` object type is an implementation of a traditional
|
||||||
first in, first out queue.
|
first in, first out queue.
|
||||||
|
|
||||||
A FIFO allows tasks to asynchronously send and receive fixed-size data items.
|
A FIFO allows tasks to asynchronously send and receive fixed-size data items.
|
||||||
Each FIFO has an associated ring buffer for holding data items that have been
|
Each FIFO has an associated ring buffer used to hold data items that have been
|
||||||
sent but not yet received.
|
sent but not yet received.
|
||||||
|
|
||||||
Any number of FIFOs can be defined in a microkernel system. Each FIFO has a
|
Any number of FIFOs can be defined in a microkernel system. Each FIFO needs:
|
||||||
name that uniquely identifies it. In addition, a FIFO defines the size of
|
|
||||||
the data items it handles and the maximum number of data items that can be
|
* A **name** that uniquely identifies it.
|
||||||
queued in its ring buffer, both of which must be greater than zero.
|
* A **maximum quantity** of data items that can be queued in its ring buffer.
|
||||||
|
* The **data item size**, measured in bytes, of each data item it can handle.
|
||||||
|
|
||||||
|
|
||||||
A task sends a data item by specifying a pointer to an area containing the data
|
A task sends a data item by specifying a pointer to an area containing the data
|
||||||
to be sent; the size of the data area must equal the FIFO's data item size.
|
to be sent; the size of the data area must equal the FIFO's data item size.
|
||||||
The data is given directly to a receiving task (if one is waiting) or copied
|
The data is either given directly to a receiving task (if one is waiting), or
|
||||||
to the FIFO's ring buffer (if space is available). When a FIFO is full
|
copied to the FIFO's ring buffer (if space is available). When a FIFO is full,
|
||||||
the sending task may choose to wait for space to become available.
|
the sending task can wait for space to become available.
|
||||||
|
|
||||||
Any number of tasks may wait on a full FIFO simultaneously; when space for
|
Any number of tasks may wait on a full FIFO simultaneously; when space for
|
||||||
a data item becomes available it is given to the highest priority task that
|
a data item becomes available, that space is given to the highest-priority
|
||||||
has waited the longest.
|
task that has waited the longest.
|
||||||
|
|
||||||
A task receives a data item by specifying a pointer to an area to receive
|
A task receives a data item by specifying a pointer to an area to receive
|
||||||
the data; the size of the receiving area must equal the FIFO's data item size.
|
the data; the size of the receiving area must equal the FIFO's data item size.
|
||||||
|
@ -50,7 +52,7 @@ anonymous manner.
|
||||||
copying the data. The microkernel's memory map and memory pool object
|
copying the data. The microkernel's memory map and memory pool object
|
||||||
types can be helpful for data transfers of this sort.
|
types can be helpful for data transfers of this sort.
|
||||||
|
|
||||||
A synchronous transfer can be achieved using the microkernel's mailbox
|
A synchronous transfer can be achieved by using the microkernel's mailbox
|
||||||
object type.
|
object type.
|
||||||
|
|
||||||
A non-anonymous transfer can be achieved by having the sending task
|
A non-anonymous transfer can be achieved by having the sending task
|
||||||
|
@ -81,7 +83,8 @@ The following parameters must be defined:
|
||||||
Public FIFO
|
Public FIFO
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Define the FIFO in the application's .MDEF file using the following syntax:
|
Define the FIFO in the application's :file:`.MDEF` file with the
|
||||||
|
following syntax:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
|
@ -114,7 +117,7 @@ For example, the following code defines a private FIFO named ``PRIV_FIFO``.
|
||||||
|
|
||||||
DEFINE_FIFO(PRIV_FIFO, 10, 12);
|
DEFINE_FIFO(PRIV_FIFO, 10, 12);
|
||||||
|
|
||||||
To utilize this FIFO from a different source file use the following syntax:
|
To access this FIFO from a different source file, use the following syntax:
|
||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
|
@ -150,8 +153,8 @@ can't keep up, throw away all existing data so newer data can be saved.
|
||||||
Example: Reading from a FIFO
|
Example: Reading from a FIFO
|
||||||
============================
|
============================
|
||||||
|
|
||||||
This code uses a FIFO to process data items from generated by
|
This code uses a FIFO to process data items generated by one or more
|
||||||
one or more producing tasks.
|
producing tasks.
|
||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
|
@ -171,18 +174,20 @@ one or more producing tasks.
|
||||||
APIs
|
APIs
|
||||||
****
|
****
|
||||||
|
|
||||||
The following APIs for a microkernel FIFO are provided by
|
FIFO APIs provided by :file:`microkernel.h`
|
||||||
:file:`microkernel.h`:
|
===========================================
|
||||||
|
|
||||||
:c:func:`task_fifo_put()`
|
:c:func:`task_fifo_put()`
|
||||||
Writes item to a FIFO, or wait for a specified time period if it is full.
|
Write item to a FIFO, or wait for a specified time period if the FIFO is
|
||||||
|
full.
|
||||||
|
|
||||||
:c:func:`task_fifo_get()`
|
:c:func:`task_fifo_get()`
|
||||||
Reads item from a FIFO, or wait for a specified time period if it is empty.
|
Read item from a FIFO, or wait for a specified time period if the FIFO is
|
||||||
|
empty.
|
||||||
|
|
||||||
:c:func:`task_fifo_purge()`
|
:c:func:`task_fifo_purge()`
|
||||||
Discards all items in a FIFO and unblock any tasks
|
Discard all items in a FIFO and unblock any tasks waiting to read or write
|
||||||
waiting to read or write an item.
|
an item.
|
||||||
|
|
||||||
:c:func:`task_fifo_size_get()`
|
:c:func:`task_fifo_size_get()`
|
||||||
Reads the number of items currently in a FIFO.
|
Read the number of items currently in a FIFO.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue