ArvernOS
Loading...
Searching...
No Matches
task.h File Reference
#include <arch/task.h>
#include <stdint.h>
Include dependency graph for task.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  task_t
 

Macros

#define MAX_TASKS   64
 

Functions

void task_init (const char *init_name)
 
void task_schedule ()
 
void task_schedule_on_timer_tick ()
 
void task_exit (int code)
 
task_ttask_get_current ()
 
int task_create (const char *name, uint64_t clone_flags, uintptr_t entrypoint)
 
void task_print_info ()
 

Detailed Description

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

Macro Definition Documentation

◆ MAX_TASKS

#define MAX_TASKS   64
Todo
Get rid of this limitation.

Function Documentation

◆ task_create()

int task_create ( const char * name,
uint64_t clone_flags,
uintptr_t entrypoint )

Creates a new task.

Parameters
namethe name of the task to create
clone_flagsconfiguration flags
entrypointthe entrypoint of the task
Returns
0 on success, -1 otherwise

◆ task_exit()

void task_exit ( int code)

Terminates the current task.

Parameters
codethe status code

◆ task_get_current()

task_t * 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_namethe name of the initial task.

◆ task_print_info()

void task_print_info ( )

Prints information about the tasks on the standard output.

◆ task_schedule()

void task_schedule ( )

Schedules a new task.

◆ 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