Difference between revisions of "OCEOS/oceos inter-task communication/dataq"

From wiki
Jump to navigation Jump to search
Line 1: Line 1:
=<span style="color:#0000ff">'''Data Queue'''</span>=
=<span style="color:#0000ff">'''Data Queue'''</span>=
==<span style="color:#0000ff">Introduction</span>==
==<span style="color:#0000ff">Data Queue Introduction</span>==
These are FIFO queues of non-null void pointers ordered by arrival time. Each queue has an associated pending jobs queue, and two associated atomic operations, read and write. A size operation gives the number of pointers on the queue, and the data queue create operation sets the maximum size of the queue.
These are FIFO queues of non-null void pointers ordered by arrival time. Each queue has an associated pending jobs queue, and two associated atomic operations, read and write. A size operation gives the number of pointers on the queue, and the data queue create operation sets the maximum size of the queue.


Line 14: Line 14:
<blockquote style="background-color: #c6e2f7; border-left-style: solid; border-left-width: 3px; border-left-color: blue; "> '''Note'''<br>
<blockquote style="background-color: #c6e2f7; border-left-style: solid; border-left-width: 3px; border-left-color: blue; "> '''Note'''<br>
If timeouts are used with data queues the hardware specific timer initialization and handling must be set up by the developer please see [[OCEOS/oceos timed actions|here]].
If timeouts are used with data queues the hardware specific timer initialization and handling must be set up by the developer please see [[OCEOS/oceos timed actions|here]].
</blockquote>
==<span style="color:#0000ff">Data Queue Configuration</span>==
<blockquote>
User must define NUMBER_OF_DATAQS. If NUMBER_OF_DATAQS is zero, data queues are not used. The example can be found in OCEOS demo projects.<br>
User must create defined number of data queues before calling [[OCEOS/oceos kernel/initialisation#oceos_init_finish()|oceos_init_finish()]]
<syntaxhighlight lang="C">
    #define NUMBER_OF_DATAQS 2
    /*
    * Create the application configuration structure
    */
    struct application_configuration          app_config = {0};
    app_config.number_of_data_queues        = NUMBER_OF_DATAQS;
</syntaxhighlight>
</blockquote>
</blockquote>
[[Category:backup]]
[[Category:backup]]

Revision as of 16:49, 22 March 2022

Data Queue

Data Queue Introduction

These are FIFO queues of non-null void pointers ordered by arrival time. Each queue has an associated pending jobs queue, and two associated atomic operations, read and write. A size operation gives the number of pointers on the queue, and the data queue create operation sets the maximum size of the queue.

The read operation returns the first pointer on the queue unless the queue is empty. Unlike many other OS, the job that performs the read operation does not block if the queue is empty. Instead OCEOS provides three options for the read operation to determine what should happen in that case:

A pointer is added to the queue by write. All jobs on the pending list are moved to the ready queue and also removed from the timed actions queue if present.

The pending queue order of jobs with the same priority is preserved in the transfer. The scheduler is then activated and may pre-empt the current executing job.

In case the queue is full, the new entry can be dropped or the oldest entry overwritten, depending on an option chosen when the data queue is created. An appropriate status is returned and a log entry is made if the new entry is dropped.

Note

If timeouts are used with data queues the hardware specific timer initialization and handling must be set up by the developer please see here.

Data Queue Configuration

User must define NUMBER_OF_DATAQS. If NUMBER_OF_DATAQS is zero, data queues are not used. The example can be found in OCEOS demo projects.
User must create defined number of data queues before calling oceos_init_finish()

    #define NUMBER_OF_DATAQS 2
    /*
     * Create the application configuration structure
     */
    struct application_configuration           app_config = {0};
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;