Difference between revisions of "OCEOS/oceos kernel/task"

From wiki
Jump to navigation Jump to search
Line 25: Line 25:
|-
|-
| [[OCEOS/oceos kernel/task#()| oceos_init()]]                                  || Initialize fixed data            || *    ||      ||  
| [[OCEOS/oceos kernel/task#()| oceos_init()]]                                  || Initialize fixed data            || *    ||      ||  
|}
===<span style="color:#0000ff">oceos_task_create()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''initialisation.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>
<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
{| class="wikitable"
|-
! Parameter !! Description
|-
|  ||
|}
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns enum DIRECTIVE_STATUS.<br>
{| class="wikitable"
|-
! enum DIRECTIVE_STATUS !! Description
|-
| INCORRECT_STATE || If system Meta pointer is NULL or
                    Init pointer is NULL or
                    Start up phase check fail or
                    Fixed data checksum failed (check log)
|-
| INVALID_NAME    || If Start Sentinel for fixed area is corrupt or
                    Start Sentinel for dynamic area is corrupt
|-
| INVALID_NUMBER  || If Configuration and actual parameters do not match
                    (In configuration file was defined 5 tasks, but created less)
|-
| SUCCESSFUL    || If All OK
|}
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
   
</syntaxhighlight>
</blockquote>
===<span style="color:#0000ff">oceos_task_start()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''initialisation.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>
<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
{| class="wikitable"
|-
! Parameter !! Description
|-
|  ||
|}
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns enum DIRECTIVE_STATUS.<br>
{| class="wikitable"
|-
! enum DIRECTIVE_STATUS !! Description
|-
| INCORRECT_STATE || If system Meta pointer is NULL or
                    Init pointer is NULL or
                    Start up phase check fail or
                    Fixed data checksum failed (check log)
|-
| INVALID_NAME    || If Start Sentinel for fixed area is corrupt or
                    Start Sentinel for dynamic area is corrupt
|-
| INVALID_NUMBER  || If Configuration and actual parameters do not match
                    (In configuration file was defined 5 tasks, but created less)
|-
| SUCCESSFUL    || If All OK
|}
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
   
</syntaxhighlight>
</blockquote>
===<span style="color:#0000ff">oceos_task_disable()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''initialisation.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>
<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
{| class="wikitable"
|-
! Parameter !! Description
|-
|  ||
|}
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns enum DIRECTIVE_STATUS.<br>
{| class="wikitable"
|-
! enum DIRECTIVE_STATUS !! Description
|-
| INCORRECT_STATE || If system Meta pointer is NULL or
                    Init pointer is NULL or
                    Start up phase check fail or
                    Fixed data checksum failed (check log)
|-
| INVALID_NAME    || If Start Sentinel for fixed area is corrupt or
                    Start Sentinel for dynamic area is corrupt
|-
| INVALID_NUMBER  || If Configuration and actual parameters do not match
                    (In configuration file was defined 5 tasks, but created less)
|-
| SUCCESSFUL    || If All OK
|}
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
   
</syntaxhighlight>
</blockquote>
===<span style="color:#0000ff">oceos_task_enable()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''initialisation.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>
<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
{| class="wikitable"
|-
! Parameter !! Description
|-
|  ||
|}
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns enum DIRECTIVE_STATUS.<br>
{| class="wikitable"
|-
! enum DIRECTIVE_STATUS !! Description
|-
| INCORRECT_STATE || If system Meta pointer is NULL or
                    Init pointer is NULL or
                    Start up phase check fail or
                    Fixed data checksum failed (check log)
|-
| INVALID_NAME    || If Start Sentinel for fixed area is corrupt or
                    Start Sentinel for dynamic area is corrupt
|-
| INVALID_NUMBER  || If Configuration and actual parameters do not match
                    (In configuration file was defined 5 tasks, but created less)
|-
| SUCCESSFUL    || If All OK
|}
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
   
</syntaxhighlight>
</blockquote>
===<span style="color:#0000ff">oceos_task_self()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''initialisation.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>
<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
{| class="wikitable"
|-
! Parameter !! Description
|-
|  ||
|}
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns enum DIRECTIVE_STATUS.<br>
{| class="wikitable"
|-
! enum DIRECTIVE_STATUS !! Description
|-
| INCORRECT_STATE || If system Meta pointer is NULL or
                    Init pointer is NULL or
                    Start up phase check fail or
                    Fixed data checksum failed (check log)
|-
| INVALID_NAME    || If Start Sentinel for fixed area is corrupt or
                    Start Sentinel for dynamic area is corrupt
|-
| INVALID_NUMBER  || If Configuration and actual parameters do not match
                    (In configuration file was defined 5 tasks, but created less)
|-
| SUCCESSFUL    || If All OK
|}
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
   
</syntaxhighlight>
</blockquote>
===<span style="color:#0000ff">oceos_task_get_priority()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''initialisation.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>
<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
{| class="wikitable"
|-
! Parameter !! Description
|-
|  ||
|}
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns enum DIRECTIVE_STATUS.<br>
{| class="wikitable"
|-
! enum DIRECTIVE_STATUS !! Description
|-
| INCORRECT_STATE || If system Meta pointer is NULL or
                    Init pointer is NULL or
                    Start up phase check fail or
                    Fixed data checksum failed (check log)
|-
| INVALID_NAME    || If Start Sentinel for fixed area is corrupt or
                    Start Sentinel for dynamic area is corrupt
|-
| INVALID_NUMBER  || If Configuration and actual parameters do not match
                    (In configuration file was defined 5 tasks, but created less)
|-
| SUCCESSFUL    || If All OK
|}
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
   
</syntaxhighlight>
</blockquote>
===<span style="color:#0000ff">oceos_task_get_status()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''initialisation.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>
<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
{| class="wikitable"
|-
! Parameter !! Description
|-
|  ||
|}
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns enum DIRECTIVE_STATUS.<br>
{| class="wikitable"
|-
! enum DIRECTIVE_STATUS !! Description
|-
| INCORRECT_STATE || If system Meta pointer is NULL or
                    Init pointer is NULL or
                    Start up phase check fail or
                    Fixed data checksum failed (check log)
|-
| INVALID_NAME    || If Start Sentinel for fixed area is corrupt or
                    Start Sentinel for dynamic area is corrupt
|-
| INVALID_NUMBER  || If Configuration and actual parameters do not match
                    (In configuration file was defined 5 tasks, but created less)
|-
| SUCCESSFUL    || If All OK
|}
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
   
</syntaxhighlight>
</blockquote>
===<span style="color:#0000ff">oceos_task_kill()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''initialisation.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>


<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
{| class="wikitable"
|-
! Parameter !! Description
|-
|  ||
|}
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns enum DIRECTIVE_STATUS.<br>
{| class="wikitable"
|-
! enum DIRECTIVE_STATUS !! Description
|-
| INCORRECT_STATE || If system Meta pointer is NULL or
                    Init pointer is NULL or
                    Start up phase check fail or
                    Fixed data checksum failed (check log)
|-
| INVALID_NAME    || If Start Sentinel for fixed area is corrupt or
                    Start Sentinel for dynamic area is corrupt
|-
| INVALID_NUMBER  || If Configuration and actual parameters do not match
                    (In configuration file was defined 5 tasks, but created less)
|-
| SUCCESSFUL    || If All OK
|}
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
   
</syntaxhighlight>
</blockquote>
===<span style="color:#0000ff">oceos_task_get_info()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''initialisation.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>
<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
{| class="wikitable"
|-
! Parameter !! Description
|-
|  ||
|}
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns enum DIRECTIVE_STATUS.<br>
{| class="wikitable"
|-
! enum DIRECTIVE_STATUS !! Description
|-
| INCORRECT_STATE || If system Meta pointer is NULL or
                    Init pointer is NULL or
                    Start up phase check fail or
                    Fixed data checksum failed (check log)
|-
| INVALID_NAME    || If Start Sentinel for fixed area is corrupt or
                    Start Sentinel for dynamic area is corrupt
|-
| INVALID_NUMBER  || If Configuration and actual parameters do not match
                    (In configuration file was defined 5 tasks, but created less)
|-
| SUCCESSFUL    || If All OK
|}
|}
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
   
</syntaxhighlight>
</blockquote>

Revision as of 12:52, 14 March 2022

OCEOS Task

Introduction

In OCEOS all tasks are defined before scheduling begins and each task assigned a fixed priority, a pre-emption threshold, a current jobs limit, a maximum start to completion time, and an expected minimum inter start request time. A task’s pre-emption threshold limits the tasks that can pre-empt it to those with higher priority than this threshold. Tasks with short run times can use this to avoid context switch overheads. Each task has two main states, enabled or disabled. OCEOS provides system calls to change task state. The state is usually enabled when the task is created, but can be initially disabled. A disabled task will not be executed, and any attempt to start it will be logged and the system state variable updated.
A request to start an enabled task creates an execution instance of the task, a ‘job’. A count is kept for each task of the number of times it has been started, i.e. total number of jobs created. Multiple jobs of the same task can be in existence simultaneously. A limit for the maximum number of these current jobs is set when a task is created, the ‘current jobs limit’. Each task has a current jobs count. This increments each time a task is started and decrements on job completion unless completion creates a further job from this task. A further execution instance of a task is not created if the current jobs count has reached the current jobs limit. Such job creation failures are logged and the system state updated. For each task a record is kept of the shortest time between attempts to create a new job, and a record of the maximum time between these attempts. For each task a record is kept also of the maximum time a job was waiting before starting, the minimum execution time, the maximum execution time, the maximum time from job creation to completion, and the maximum number of job pre-emptions. The system state variable is updated if necessary.
Task chaining is supported. A job can create a new job and pass this to the scheduler or place it on the timed actions queue.
Tasks provide a start address for a termination routine for use if task execution must be abandoned.

Note

All Tasks must be created before oceos_init_finish() is called.

API Functions

API Functions
Directive Description main task IRQ handler
oceos_init() Initialize fixed data *

oceos_task_create()

Header File
initialisation.h

Description

Prototype

Parameters

Parameter Description

Returns
This function returns enum DIRECTIVE_STATUS.

enum DIRECTIVE_STATUS Description
INCORRECT_STATE If system Meta pointer is NULL or

Init pointer is NULL or Start up phase check fail or Fixed data checksum failed (check log)

INVALID_NAME If Start Sentinel for fixed area is corrupt or

Start Sentinel for dynamic area is corrupt

INVALID_NUMBER If Configuration and actual parameters do not match

(In configuration file was defined 5 tasks, but created less)

SUCCESSFUL If All OK

Example Usage

oceos_task_start()

Header File
initialisation.h

Description

Prototype

Parameters

Parameter Description

Returns
This function returns enum DIRECTIVE_STATUS.

enum DIRECTIVE_STATUS Description
INCORRECT_STATE If system Meta pointer is NULL or

Init pointer is NULL or Start up phase check fail or Fixed data checksum failed (check log)

INVALID_NAME If Start Sentinel for fixed area is corrupt or

Start Sentinel for dynamic area is corrupt

INVALID_NUMBER If Configuration and actual parameters do not match

(In configuration file was defined 5 tasks, but created less)

SUCCESSFUL If All OK

Example Usage

oceos_task_disable()

Header File
initialisation.h

Description

Prototype

Parameters

Parameter Description

Returns
This function returns enum DIRECTIVE_STATUS.

enum DIRECTIVE_STATUS Description
INCORRECT_STATE If system Meta pointer is NULL or

Init pointer is NULL or Start up phase check fail or Fixed data checksum failed (check log)

INVALID_NAME If Start Sentinel for fixed area is corrupt or

Start Sentinel for dynamic area is corrupt

INVALID_NUMBER If Configuration and actual parameters do not match

(In configuration file was defined 5 tasks, but created less)

SUCCESSFUL If All OK

Example Usage

oceos_task_enable()

Header File
initialisation.h

Description

Prototype

Parameters

Parameter Description

Returns
This function returns enum DIRECTIVE_STATUS.

enum DIRECTIVE_STATUS Description
INCORRECT_STATE If system Meta pointer is NULL or

Init pointer is NULL or Start up phase check fail or Fixed data checksum failed (check log)

INVALID_NAME If Start Sentinel for fixed area is corrupt or

Start Sentinel for dynamic area is corrupt

INVALID_NUMBER If Configuration and actual parameters do not match

(In configuration file was defined 5 tasks, but created less)

SUCCESSFUL If All OK

Example Usage

oceos_task_self()

Header File
initialisation.h

Description

Prototype

Parameters

Parameter Description

Returns
This function returns enum DIRECTIVE_STATUS.

enum DIRECTIVE_STATUS Description
INCORRECT_STATE If system Meta pointer is NULL or

Init pointer is NULL or Start up phase check fail or Fixed data checksum failed (check log)

INVALID_NAME If Start Sentinel for fixed area is corrupt or

Start Sentinel for dynamic area is corrupt

INVALID_NUMBER If Configuration and actual parameters do not match

(In configuration file was defined 5 tasks, but created less)

SUCCESSFUL If All OK

Example Usage

oceos_task_get_priority()

Header File
initialisation.h

Description

Prototype

Parameters

Parameter Description

Returns
This function returns enum DIRECTIVE_STATUS.

enum DIRECTIVE_STATUS Description
INCORRECT_STATE If system Meta pointer is NULL or

Init pointer is NULL or Start up phase check fail or Fixed data checksum failed (check log)

INVALID_NAME If Start Sentinel for fixed area is corrupt or

Start Sentinel for dynamic area is corrupt

INVALID_NUMBER If Configuration and actual parameters do not match

(In configuration file was defined 5 tasks, but created less)

SUCCESSFUL If All OK

Example Usage

oceos_task_get_status()

Header File
initialisation.h

Description

Prototype

Parameters

Parameter Description

Returns
This function returns enum DIRECTIVE_STATUS.

enum DIRECTIVE_STATUS Description
INCORRECT_STATE If system Meta pointer is NULL or

Init pointer is NULL or Start up phase check fail or Fixed data checksum failed (check log)

INVALID_NAME If Start Sentinel for fixed area is corrupt or

Start Sentinel for dynamic area is corrupt

INVALID_NUMBER If Configuration and actual parameters do not match

(In configuration file was defined 5 tasks, but created less)

SUCCESSFUL If All OK

Example Usage

oceos_task_kill()

Header File
initialisation.h

Description

Prototype

Parameters

Parameter Description

Returns
This function returns enum DIRECTIVE_STATUS.

enum DIRECTIVE_STATUS Description
INCORRECT_STATE If system Meta pointer is NULL or

Init pointer is NULL or Start up phase check fail or Fixed data checksum failed (check log)

INVALID_NAME If Start Sentinel for fixed area is corrupt or

Start Sentinel for dynamic area is corrupt

INVALID_NUMBER If Configuration and actual parameters do not match

(In configuration file was defined 5 tasks, but created less)

SUCCESSFUL If All OK

Example Usage

oceos_task_get_info()

Header File
initialisation.h

Description

Prototype

Parameters

Parameter Description

Returns
This function returns enum DIRECTIVE_STATUS.

enum DIRECTIVE_STATUS Description
INCORRECT_STATE If system Meta pointer is NULL or

Init pointer is NULL or Start up phase check fail or Fixed data checksum failed (check log)

INVALID_NAME If Start Sentinel for fixed area is corrupt or

Start Sentinel for dynamic area is corrupt

INVALID_NUMBER If Configuration and actual parameters do not match

(In configuration file was defined 5 tasks, but created less)

SUCCESSFUL If All OK

Example Usage