Lazuli
scheduler.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_SCHEDULER_H
15 #define LAZULI_SYS_SCHEDULER_H
16 
17 #include <stdint.h>
18 
19 #include <Lazuli/common.h>
20 #include <Lazuli/lazuli.h>
21 #include <Lazuli/mutex.h>
22 
23 #include <Lazuli/sys/task.h>
24 
26 
34 void
35 (*ReverseBytesOfFunctionPointer(void (* const pointer)(void)))(void);
36 
41 void
42 Scheduler_Init(void);
43 
49 void
50 Scheduler_AbortTask(void * const sp);
51 
52 /*
53  * TODO: Maybe rename interruptCode and eventCode to xxxxxId or something like
54  * that...
55  */
63 void
64 Scheduler_HandleInterrupt(const uint8_t interruptCode);
65 
73 void
74 Scheduler_HandleClockTick(void * const sp);
75 
84 void
85 Scheduler_WaitEvent(void * const sp, const uint8_t eventCode);
86 
92 void
94 
100 Task*
102 
106 void
108 
110 
111 #endif /* LAZULI_SYS_SCHEDULER_H */
void Scheduler_HandleClockTick(void *const sp)
This function is called when a clock tick occured, catch by the interrupt handler.
Definition: scheduler.c:680
#define _EXTERN_C_DECL_BEGIN
Open C++ header file declarations.
Definition: common.h:37
Task * Scheduler_GetCurrentTask(void)
Get a pointer to the current running task.
Definition: scheduler.c:720
void Scheduler_WaitEvent(void *const sp, const uint8_t eventCode)
This function is called from arch-specific Wait routine in order to get the current running task wait...
void Scheduler_WakeupTasksWaitingMutex(Lz_Mutex *const mutex)
Wake up all tasks waiting for a mutex.
Definition: scheduler.c:694
void Scheduler_AbortTask(void *const sp)
Call the appropriate scheduler to abort the curent running task.
Definition: scheduler.c:632
The public API of the Lazuli kernel.
unsigned char uint8_t
Represents a unsigned integer type with width of exactly 8 bits.
Definition: stdint.h:89
Mutexes interface.
Base task definition and context description.
void Scheduler_HandleInterrupt(const uint8_t interruptCode)
This function is called by arch-specific interrupt handling routine.
Definition: scheduler.c:657
void Scheduler_SleepUntilEndOfTimeSlice(void)
Put the current task to sleep until the end of its time slice.
Definition: scheduler.c:726
Basic type definitions and useful macros.
Represents a mutex.
Definition: mutex.h:28
#define _EXTERN_C_DECL_END
Close C++ header file declarations.
Definition: common.h:42
Represents a task.
Definition: task.h:76
void Scheduler_Init(void)
Initialize the scheduler prior to running it.
Definition: scheduler.c:613
void(*)(void) ReverseBytesOfFunctionPointer(void(*const pointer)(void))
Reverse the bytes of a function pointer.
Definition: scheduler.h:35