Lazuli
|
The public API of the Lazuli kernel. More...
Go to the source code of this file.
Data Structures | |
struct | Lz_TaskConfiguration |
Represents the configuration of a task. More... | |
Typedefs | |
typedef int8_t | lz_task_priority_t |
Represents the priority of a task, as a signed integer. More... | |
typedef uint16_t | lz_u_resolution_unit_t |
Represents the type used for the system clock resolution unit, as an unsigned integer. | |
Enumerations | |
enum | Lz_SchedulingPolicy { CYCLIC_RT = 0, PRIORITY_RT } |
Defines the possible scheduling policies for a Lazuli user task. More... | |
Functions | |
bool | Lz_RegisterTask (void(*const taskEntryPoint)(void), Lz_TaskConfiguration *taskConfiguration) |
Register a new task. More... | |
void | Lz_TaskConfiguration_Init (Lz_TaskConfiguration *const taskConfiguration) |
Initialize an Lz_TaskConfiguration with default values for all parameters. More... | |
void | Lz_Run (void) |
Run the scheduler. More... | |
void | Lz_Task_WaitInterrupt (uint8_t interruptCode) |
Wait for a specific interrupt to occur. More... | |
char const * | Lz_Task_GetName (void) |
Get the name of the calling task. More... | |
void | Lz_Task_Terminate (void) |
Terminate the calling task. More... | |
void | Lz_Task_WaitActivation (void) |
Set the calling task to wait for its next activation. More... | |
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), using the software timer. More... | |
The public API of the Lazuli kernel.
This file describes the public (user) API of the Lazuli kernel. It defines public types and functions that can by used by user main code and tasks.
Definition in file lazuli.h.
typedef int8_t lz_task_priority_t |
enum Lz_SchedulingPolicy |
Defines the possible scheduling policies for a Lazuli user task.
Enumerator | |
---|---|
CYCLIC_RT | Cyclic real-time scheduling. |
PRIORITY_RT | Priority time sliced real-time scheduling. Equivalent to POSIX SCHED_RR. |
bool Lz_RegisterTask | ( | void(*)(void) | taskEntryPoint, |
Lz_TaskConfiguration * | taskConfiguration | ||
) |
Register a new task.
If an error occured during registration of the task false is returned and the task is not included in the set of tasks that will be run.
taskEntryPoint | The entry point of the task to register. i.e. A pointer to the function representing the task. |
taskConfiguration | A pointer to an Lz_TaskConfiguration containing the configuration of the task being registered. If NULL is passed, then default values are applied for all parameters. |
Definition at line 758 of file scheduler.c.
void Lz_TaskConfiguration_Init | ( | Lz_TaskConfiguration *const | taskConfiguration | ) |
Initialize an Lz_TaskConfiguration with default values for all parameters.
No function is provided for allocating a new Lz_TaskConfiguration. So it is strongly advised to allocate the Lz_TaskConfiguration parameter on the stack before calling this function.
taskConfiguration | A pointer to the Lz_TaskConfiguration to initialize. |
Definition at line 746 of file scheduler.c.
void Lz_Run | ( | void | ) |
void Lz_Task_WaitInterrupt | ( | uint8_t | interruptCode | ) |
Wait for a specific interrupt to occur.
Puts the calling task to sleep until the specified interrupt occurs.
interruptCode | The code of the interrupt to wait for. |
Definition at line 793 of file scheduler.c.
char const* Lz_Task_GetName | ( | void | ) |
Get the name of the calling task.
Definition at line 779 of file scheduler.c.
void Lz_Task_Terminate | ( | void | ) |
Terminate the calling task.
The context of the task will be saved on its stack.
Calling this function has the same effect than returning from the task's main function.
The terminated task will never be scheduled again.
Definition at line 815 of file scheduler.c.
void Lz_Task_WaitActivation | ( | void | ) |
Set the calling task to wait for its next activation.
May be used if the task finnished its work without consuming all of its completion time.
Definition at line 785 of file scheduler.c.
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), using the software timer.
As Lazuli is a time sliced operating system, the effective waiting will start at the end of the current time slice. This means that the real waiting time starting from the calling of this function will be:
units / clock resolution frequency <= waiting time AND waiting time < (units + 1) / clock resolution frequency
See the configuration option LZ_CONFIG_SYSTEM_CLOCK_RESOLUTION_FREQUENCY.
units | The number of time slices to wait. |
Definition at line 804 of file scheduler.c.