Lazuli
Loading...
Searching...
No Matches
task.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-3.0-only
3 * This file is part of Lazuli.
4 */
5
14#ifndef LAZULI_SYS_TASK_H
15#define LAZULI_SYS_TASK_H
16
17#include <stdint.h>
18
19#include <Lazuli/common.h>
20#include <Lazuli/lazuli.h>
21#include <Lazuli/list.h>
22
24
36
40#define NO_MESSAGE ((lz_task_to_scheduler_message_t)0U)
41
46#define WAIT_ACTIVATION ((lz_task_to_scheduler_message_t)1U)
47
52#define WAIT_INTERRUPT ((lz_task_to_scheduler_message_t)2U)
53
57#define TERMINATE_TASK ((lz_task_to_scheduler_message_t)3U)
58
63#define WAIT_MUTEX ((lz_task_to_scheduler_message_t)4U)
64
71#define WAIT_SOFTWARE_TIMER ((lz_task_to_scheduler_message_t)5U)
72
77#define ABORT_TASK ((lz_task_to_scheduler_message_t)6U)
78
189
194typedef void (*FuncVoidVoid)(void);
195
209typedef struct {
211 volatile uint8_t sreg;
212
214 volatile uint8_t r0;
215
217 volatile uint8_t r1;
218
220 volatile uint8_t r2;
221
223 volatile uint8_t r3;
224
226 volatile uint8_t r4;
227
229 volatile uint8_t r5;
230
232 volatile uint8_t r6;
233
235 volatile uint8_t r7;
236
238 volatile uint8_t r8;
239
241 volatile uint8_t r9;
242
244 volatile uint8_t r10;
245
247 volatile uint8_t r11;
248
250 volatile uint8_t r12;
251
253 volatile uint8_t r13;
254
256 volatile uint8_t r14;
257
259 volatile uint8_t r15;
260
262 volatile uint8_t r16;
263
265 volatile uint8_t r17;
266
268 volatile uint8_t r18;
269
271 volatile uint8_t r19;
272
274 volatile uint8_t r20;
275
277 volatile uint8_t r21;
278
280 volatile uint8_t r22;
281
283 volatile uint8_t r23;
284
286 volatile uint8_t r24;
287
289 volatile uint8_t r25;
290
292 volatile uint8_t r26;
293
295 volatile uint8_t r27;
296
298 volatile uint8_t r28;
299
301 volatile uint8_t r29;
302
304 volatile uint8_t r30;
305
307 volatile uint8_t r31;
308
310 volatile FuncVoidVoid pc;
311
320
322
323#endif /* LAZULI_SYS_TASK_H */
unsigned char uint8_t
Represents a unsigned integer type with width of exactly 8 bits.
Definition stdint.h:89
Basic type definitions and useful macros.
#define _EXTERN_C_DECL_BEGIN
Open C++ header file declarations.
Definition common.h:39
#define _EXTERN_C_DECL_END
Close C++ header file declarations.
Definition common.h:44
uint8_t u_read_write_atomic_t
Represents an unsigned integer that can be read and written atomically.
Definition common.h:109
The public API of the Lazuli kernel.
uint8_t lz_scheduling_policy_t
Represents the type used for scheduling policies of a Lazuli user task.
Definition lazuli.h:41
int8_t lz_task_priority_t
Represents the priority of a task, as a signed integer.
Definition lazuli.h:30
uint16_t lz_u_resolution_unit_t
Represents the type used for the system clock resolution unit, as an unsigned integer.
Definition lazuli.h:36
Doubly linked lists interface.
Represents the layout of the stack when saving the context of a task.
Definition task.h:209
volatile uint8_t r2
Register 2.
Definition task.h:220
volatile uint8_t r23
Register 23.
Definition task.h:283
volatile uint8_t r16
Register 16.
Definition task.h:262
volatile uint8_t r24
Register 24.
Definition task.h:286
volatile uint8_t r5
Register 5.
Definition task.h:229
volatile uint8_t r22
Register 22.
Definition task.h:280
volatile uint8_t r9
Register 9.
Definition task.h:241
volatile uint8_t r20
Register 20.
Definition task.h:274
volatile FuncVoidVoid pc
Program counter for the task.
Definition task.h:310
volatile uint8_t r12
Register 12.
Definition task.h:250
volatile uint8_t r18
Register 18.
Definition task.h:268
volatile uint8_t r17
Register 17.
Definition task.h:265
volatile uint8_t r27
Register 27.
Definition task.h:295
volatile uint8_t r13
Register 13.
Definition task.h:253
volatile uint8_t r21
Register 21.
Definition task.h:277
volatile uint8_t r25
Register 25.
Definition task.h:289
volatile uint8_t r28
Register 28.
Definition task.h:298
volatile uint8_t r19
Register 19.
Definition task.h:271
volatile uint8_t r10
Register 10.
Definition task.h:244
volatile uint8_t r11
Register 11.
Definition task.h:247
volatile uint8_t r14
Register 14.
Definition task.h:256
volatile uint8_t r1
Register 1.
Definition task.h:217
volatile uint8_t sreg
State register.
Definition task.h:211
volatile FuncVoidVoid terminationCallback
Callback to the scheduler to manage task termination.
Definition task.h:318
volatile uint8_t r15
Register 15.
Definition task.h:259
volatile uint8_t r8
Register 8.
Definition task.h:238
volatile uint8_t r29
Register 29.
Definition task.h:301
volatile uint8_t r4
Register 4.
Definition task.h:226
volatile uint8_t r6
Register 6.
Definition task.h:232
volatile uint8_t r7
Register 7.
Definition task.h:235
volatile uint8_t r3
Register 3.
Definition task.h:223
volatile uint8_t r31
Register 31.
Definition task.h:307
volatile uint8_t r0
Register 0.
Definition task.h:214
volatile uint8_t r30
Register 30.
Definition task.h:304
volatile uint8_t r26
Register 26.
Definition task.h:292
Represents a task.
Definition task.h:82
const char * name
The name of the task.
Definition task.h:88
size_t stackSize
The stack size of the task.
Definition task.h:115
void * taskToSchedulerMessageParameter
A parameter that can accompany a taskToSchedulerMessage.
Definition task.h:187
lz_u_resolution_unit_t period
The period (T) of the task, expressed as an integer number of time units.
Definition task.h:136
lz_scheduling_policy_t schedulingPolicy
The scheduling policy.
Definition task.h:125
lz_u_resolution_unit_t timeUntilTimerExpiration
The number of time units until the software timer expires for the task.
Definition task.h:165
void * stackPointer
The saved stack pointer of the task.
Definition task.h:120
volatile lz_task_to_scheduler_message_t taskToSchedulerMessage
The message the task has to pass to the scheduler for the next scheduling operation (i....
Definition task.h:180
lz_u_resolution_unit_t completion
The completion time (C) of the task (worst case execution time), expressed as an integer number of ti...
Definition task.h:143
lz_task_priority_t priority
The task priority.
Definition task.h:160
void * stackOrigin
The bottom of the allocated stack for the task.
Definition task.h:108
Lz_LinkedListElement stateQueue
The scheduling queue on which the task is stored.
Definition task.h:130
lz_u_resolution_unit_t timeUntilCompletion
The number of time units until the task will complete its execution.
Definition task.h:149
lz_u_resolution_unit_t timeUntilActivation
The number of time units until the task will be activated.
Definition task.h:155
Represents an element of a doubly linked list.
Definition list.h:25
void(* FuncVoidVoid)(void)
This type definition is needed to exclude confusion with the 'volatile' type qualifier used in the st...
Definition task.h:194
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...
Definition task.h:35