Lazuli
lazuli.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 
16 #ifndef LAZULI_LAZULI_H
17 #define LAZULI_LAZULI_H
18 
19 #include <stdint.h>
20 
21 #include <Lazuli/common.h>
22 #include <Lazuli/config.h>
23 
25 
31 
37 
51  __LZ_SCHEDULING_POLICY_ENUM_BEGIN = -1,
52 
58  CYCLIC_RT = 0,
59 
66 
70  /*
71  * PRIORITY_RR,
72  */
73 
80  __LZ_SCHEDULING_POLICY_ENUM_END
81 
83 };
84 
88 typedef struct {
94  char const *name;
95 
99  size_t stackSize;
100 
104  enum Lz_SchedulingPolicy schedulingPolicy;
105 
111 
118 
127 
145 bool
146 Lz_RegisterTask(void (* const taskEntryPoint)(void),
147  Lz_TaskConfiguration * taskConfiguration);
148 
159 void
160 Lz_TaskConfiguration_Init(Lz_TaskConfiguration * const taskConfiguration);
161 
167 void
168 Lz_Run(void);
169 
179 void
180 Lz_Task_WaitInterrupt(uint8_t interruptCode);
181 
188 char const *
189 Lz_Task_GetName(void);
190 
200 void
201 Lz_Task_Terminate(void);
202 
211 void
213 
231 void
233 
235 
236 #endif /* LAZULI_LAZULI_H */
bool Lz_RegisterTask(void(*const taskEntryPoint)(void), Lz_TaskConfiguration *taskConfiguration)
Register a new task.
Definition: scheduler.c:758
char int8_t
Represents a signed integer type with width of exactly 8 bits.
Definition: stdint.h:27
char const * name
A pointer to an allocated const string containing the name to give to the task.
Definition: lazuli.h:94
Cyclic real-time scheduling.
Definition: lazuli.h:58
#define _EXTERN_C_DECL_BEGIN
Open C++ header file declarations.
Definition: common.h:37
Lz_SchedulingPolicy
Defines the possible scheduling policies for a Lazuli user task.
Definition: lazuli.h:44
lz_u_resolution_unit_t period
The period (T) of the task.
Definition: lazuli.h:117
Include appropriate config file.
lz_u_resolution_unit_t completion
The completion time (C) of the task (worst case execution time).
Definition: lazuli.h:125
size_t stackSize
The size of the stack needed by the task.
Definition: lazuli.h:99
void Lz_TaskConfiguration_Init(Lz_TaskConfiguration *const taskConfiguration)
Initialize an Lz_TaskConfiguration with default values for all parameters.
Definition: scheduler.c:746
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
unsigned int uint16_t
Represents a unsigned integer type with width of exactly 16 bits.
Definition: stdint.h:94
void Lz_Task_WaitInterrupt(uint8_t interruptCode)
Wait for a specific interrupt to occur.
Definition: scheduler.c:793
unsigned char uint8_t
Represents a unsigned integer type with width of exactly 8 bits.
Definition: stdint.h:89
Represents the configuration of a task.
Definition: lazuli.h:88
void Lz_WaitTimer(lz_u_resolution_unit_t units)
Set the calling task to wait for the specified number of time resolution units (time slices)...
Definition: scheduler.c:804
void Lz_Task_Terminate(void)
Terminate the calling task.
Definition: scheduler.c:815
Priority time sliced real-time scheduling.
Definition: lazuli.h:65
lz_task_priority_t priority
The priority of task.
Definition: lazuli.h:110
Basic type definitions and useful macros.
void Lz_Task_WaitActivation(void)
Set the calling task to wait for its next activation.
Definition: scheduler.c:785
char const * Lz_Task_GetName(void)
Get the name of the calling task.
Definition: scheduler.c:779
int8_t lz_task_priority_t
Represents the priority of a task, as a signed integer.
Definition: lazuli.h:30
#define _EXTERN_C_DECL_END
Close C++ header file declarations.
Definition: common.h:42
void Lz_Run(void)
Run the scheduler.
Definition: scheduler.c:765