Lazuli
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs
task.h File Reference

Base task definition and context description. More...

#include <stdint.h>
#include <Lazuli/common.h>
#include <Lazuli/lazuli.h>
#include <Lazuli/list.h>

Go to the source code of this file.

Data Structures

struct  Task
 Represents a task. More...
 
struct  TaskContextLayout
 Represents the layout of the stack when saving the context of a task. More...
 

Macros

#define NO_MESSAGE   ((lz_task_to_scheduler_message_t)0U)
 No message has to be passed to the scheduler.
 
#define WAIT_ACTIVATION   ((lz_task_to_scheduler_message_t)1U)
 Set the task to wait for its next activation.
 
#define WAIT_INTERRUPT   ((lz_task_to_scheduler_message_t)2U)
 Set the task to wait for an interrupt.
 
#define TERMINATE_TASK   ((lz_task_to_scheduler_message_t)3U)
 Terminate the task.
 
#define WAIT_MUTEX   ((lz_task_to_scheduler_message_t)4U)
 Wait for a mutex to be unlocked.
 
#define WAIT_SOFTWARE_TIMER   ((lz_task_to_scheduler_message_t)5U)
 Set the task to wait for the specified number of time resolution units, using the software timer.
 
#define ABORT_TASK   ((lz_task_to_scheduler_message_t)6U)
 Abort the curent running task.
 

Typedefs

typedef u_read_write_atomic_t lz_task_to_scheduler_message_t
 Defines the type used to contain a message that a Task can pass to the scheduler after its time slice has expired.
 
typedef void(* FuncVoidVoid) (void)
 This type definition is needed to exclude confusion with the 'volatile' type qualifier used in the struct declaration below.
 

Detailed Description

Base task definition and context description.

Describes all types and functions related to tasks.

Definition in file task.h.

Macro Definition Documentation

◆ NO_MESSAGE

#define NO_MESSAGE   ((lz_task_to_scheduler_message_t)0U)

No message has to be passed to the scheduler.

Definition at line 40 of file task.h.

◆ WAIT_ACTIVATION

#define WAIT_ACTIVATION   ((lz_task_to_scheduler_message_t)1U)

Set the task to wait for its next activation.

i.e. It finished its work without consuming all of its completion time.

Definition at line 46 of file task.h.

◆ WAIT_INTERRUPT

#define WAIT_INTERRUPT   ((lz_task_to_scheduler_message_t)2U)

Set the task to wait for an interrupt.

A parameter representing the interrupt number must accompany this message.

Definition at line 52 of file task.h.

◆ TERMINATE_TASK

#define TERMINATE_TASK   ((lz_task_to_scheduler_message_t)3U)

Terminate the task.

This handles the case of a normal termination of a task.

Definition at line 57 of file task.h.

◆ WAIT_MUTEX

#define WAIT_MUTEX   ((lz_task_to_scheduler_message_t)4U)

Wait for a mutex to be unlocked.

A parameter pointing to the mutex must accompany this message.

Definition at line 63 of file task.h.

◆ WAIT_SOFTWARE_TIMER

#define WAIT_SOFTWARE_TIMER   ((lz_task_to_scheduler_message_t)5U)

Set the task to wait for the specified number of time resolution units, using the software timer.

A parameter pointing to the specified number of units must accompany this message.

Definition at line 71 of file task.h.

◆ ABORT_TASK

#define ABORT_TASK   ((lz_task_to_scheduler_message_t)6U)

Abort the curent running task.

Called by the kernel if some unrecoverable error occured (e.g. A division by zero).

Definition at line 77 of file task.h.

Typedef Documentation

◆ lz_task_to_scheduler_message_t

Defines the type used to contain a message that a Task can pass to the scheduler after its time slice has expired.

This type is declared read/write atomic because in the definition of struct Task a message can come along with data, pointed by taskToSchedulerMessageParameter. By writing the pointer first, then writing the message code, we can ensure the integrity of the full message (i.e.: message code + data), assuming the execution is "in-order".

Definition at line 35 of file task.h.

◆ FuncVoidVoid

typedef void(* FuncVoidVoid) (void)

This type definition is needed to exclude confusion with the 'volatile' type qualifier used in the struct declaration below.

Definition at line 194 of file task.h.