#include <arch/task.h>
#include <stdint.h>
This module implements multi-tasking and it is based on Sergey Matyukevich's work (specifically the scheduler implemented in RPi OS), released under a MIT license. See: https://s-matyukevich.github.io/raspberry-pi-os/docs/lesson04/rpi-os.html
◆ MAX_TASKS
- Todo
- Get rid of this limitation.
◆ task_create()
| int task_create |
( |
const char * | name, |
|
|
uint64_t | clone_flags, |
|
|
uintptr_t | entrypoint ) |
Creates a new task.
- Parameters
-
| name | the name of the task to create |
| clone_flags | configuration flags |
| entrypoint | the entrypoint of the task |
- Returns
0 on success, -1 otherwise
◆ task_exit()
| void task_exit |
( |
int | code | ) |
|
Terminates the current task.
- Parameters
-
◆ task_get_current()
Returns the current task.
- Returns
- the current task if it exists,
NULL otherwise
◆ task_init()
| void task_init |
( |
const char * | init_name | ) |
|
Initializes the scheduler.
- Parameters
-
| init_name | the name of the initial task. |
◆ task_print_info()
Prints information about the tasks on the standard output.
◆ task_schedule()
◆ task_schedule_on_timer_tick()
| void task_schedule_on_timer_tick |
( |
| ) |
|
Schedules a new task.
This is similar to task_schedule() but designed to be automatically called at regular interval.
- Todo
- Enable interrupts before
task_do_schedule() and disable them after when we want tasks to be blocked when waiting for an event/interrupt to