AutosarOS
Task.c File Reference

Implementation of task management. More...

#include "Task.h"
#include "OS.h"
#include "assert.h"
#include "Resource.h"
#include <util/atomic.h>
Include dependency graph for Task.c:

Go to the source code of this file.

Functions

StatusType Task_ActivateTask (TaskType TaskID)
 Activate a task. More...
 
StatusType Task_ChainTask (TaskType TaskID)
 Chain task. More...
 
StatusType Task_TerminateTask (void)
 Terminate active task. More...
 
StatusType Task_Schedule (void)
 Reschedule current task. More...
 
StatusType Task_GetTaskID (TaskRefType TaskID)
 Return the ID of the task currently running. More...
 
StatusType Task_GetTaskState (TaskType TaskID, TaskStateRefType State)
 Return the state of a task. More...
 
void Task_startup (void)
 Startup function for task management. More...
 

Detailed Description

Implementation of task management.

Date
2019-09-02
Author
Pascal Romahn

Definition in file Task.c.

Function Documentation

◆ Task_ActivateTask()

StatusType Task_ActivateTask ( TaskType  TaskID)

Activate a task.

The task is transferred from the suspended state into the ready state.

Note
ActivateTask will not immediately change the state of the task in case of multiple activation requests. If the task is not suspended, the activation will only be recorded and performed later.
Parameters
TaskIDID of the task to be activated
Returns
E_OK No error
E_OS_LIMIT Too many activations of the task
E_OS_ID TaskID is invalid

Definition at line 21 of file Task.c.

Here is the call graph for this function:

◆ Task_ChainTask()

StatusType Task_ChainTask ( TaskType  TaskID)

Chain task.

The current is transferred from the running state into the suspended state. The specified task will be transferred into the ready state. The specified task may be identical to the current task.

Parameters
TaskIDID of the task to be chained
Returns
E_OK No error
E_OS_LIMIT Too many activations of the task
E_OS_ID TaskID is invalid
E_OS_RESOURCE Task still occupies resources
E_OS_CALLLEVEL Call at interrupt level

Definition at line 54 of file Task.c.

Here is the call graph for this function:

◆ Task_GetTaskID()

StatusType Task_GetTaskID ( TaskRefType  TaskID)

Return the ID of the task currently running.

Parameters
TaskIDReference of the task currently running. INVALID_TASK if no task is in running state.
Returns
E_OK No error
E_OS_PARAM_POINTER Pointer parameter is invalid

Definition at line 188 of file Task.c.

◆ Task_GetTaskState()

StatusType Task_GetTaskState ( TaskType  TaskID,
TaskStateRefType  State 
)

Return the state of a task.

Parameters
TaskIDID of the task to return the state for
StateReference of the specified tasks state
Returns
E_OK No error
E_OS_ID TaskID is invalid

Definition at line 200 of file Task.c.

◆ Task_Schedule()

StatusType Task_Schedule ( void  )

Reschedule current task.

If a higher priority task is ready it will be executed. Otherwise the calling task is continued. This allows a processor assignment to other tasks with lower or equal priority than the ceiling priority of the current task.

This service has no influence on preemptive tasks with no internal resource.

Returns
E_OK No error
E_OS_RESOURCE Task still occupies resources
E_OS_CALLLEVEL Call at interrupt level

Definition at line 157 of file Task.c.

Here is the call graph for this function:

◆ Task_startup()

void Task_startup ( void  )

Startup function for task management.

Definition at line 228 of file Task.c.

◆ Task_TerminateTask()

StatusType Task_TerminateTask ( void  )

Terminate active task.

The calling task is transferred from the running state into the suspended state.

Returns
E_OS_RESOURCE Task still occupies resources
E_OS_CALLLEVEL Call at interrupt level

Definition at line 115 of file Task.c.

Here is the call graph for this function: