Lazuli
Loading...
Searching...
No Matches
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
34void
35(*ReverseBytesOfFunctionPointer(void (* const pointer)(void)))(void);
36
41void
42Scheduler_Init(void);
43
49void
51
52/*
53 * TODO: Maybe rename interruptCode and eventCode to xxxxxId or something like
54 * that...
55 */
63void
64Scheduler_HandleInterrupt(const uint8_t interruptCode);
65
73void
74Scheduler_HandleClockTick(void * const sp);
75
84void
85Scheduler_WaitEvent(void * const sp, const uint8_t eventCode);
86
92void
94
100Task*
102
106void
108
110
111#endif /* LAZULI_SYS_SCHEDULER_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
The public API of the Lazuli kernel.
Mutexes interface.
void Scheduler_HandleInterrupt(const uint8_t interruptCode)
This function is called by arch-specific interrupt handling routine.
Definition scheduler.c:663
Task * Scheduler_GetCurrentTask(void)
Get a pointer to the current running task.
Definition scheduler.c:726
void Scheduler_AbortTask(void)
Abort the current running task.
Definition scheduler.c:651
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(*)(void) ReverseBytesOfFunctionPointer(void(*const pointer)(void))
Reverse the bytes of a function pointer.
Definition scheduler.h:35
void Scheduler_SleepUntilEndOfTimeSlice(void)
Put the current task to sleep until the end of its time slice.
Definition scheduler.c:732
void Scheduler_Init(void)
Initialize the scheduler prior to running it.
Definition scheduler.c:632
void Scheduler_HandleClockTick(void *const sp)
This function is called when a clock tick occurred, catch by the interrupt handler.
Definition scheduler.c:686
void Scheduler_WakeupTasksWaitingMutex(Lz_Mutex *const mutex)
Wake up all tasks waiting for a mutex.
Definition scheduler.c:700
Represents a mutex.
Definition mutex.h:28
Represents a task.
Definition task.h:82
Base task definition and context description.