Class Hierarchy   Compound List   File List   Compound Members   File Members  

tm.c File Reference

Task management. More...

Functions

Variables


Detailed Description

Task management.

Author(s):
Markus L. Noga <noga@inrialpes.fr>

Contains the multitasking switcher and scheduler as well as library functions relating to task management.


Function Documentation

void tm_switcher (void)

the task switcher.

saves active context and passes sp to scheduler then restores new context from returned sp

size_t * tm_scheduler (size_t * old_sp)

the process scheduler.

Parameters:
old_sp - current task's current stack pointer
Returns:
new task's current stack pointer

actual context switches performed by tm_switcher (assembler wrapper)

void yield (void)

yield the rest of the current timeslice.

doesn't speed up the system clock.

int tm_idle_task (void)

the idle task.

infinite sleep instruction to conserve power.

void tm_init (void)

init task management.

called in single tasking mode before task setup.

void tm_start (void)

start task management.

called in single tasking mode after task setup

pid_t execi (int(* code_start)(void), priority_t priority, size_t stack_size)

execute a memory image.

Parameters:
code_start - start address of code to execute
priority - new task's priority
stack_size - stack size for new process
Returns:
-1: fail, else pid.

will return to caller in any case.

void exit (int code)

exit task, returning code.

Parameters:
code - The return code

FIXME: for now, scrap the code.

wakeup_t wait_event (wakeup_t(* wakeup)(wakeup_t), wakeup_t data)

suspend process until wakeup function is non-null.

Parameters:
wakeup - the wakeup function. called in task scheduler context.
data - argument passed to wakeup function by scheduler
Returns:
return value passed on from wakeup

wakeup_t tm_sleep_wakeup (wakeup_t data)

wakeup function for sleep.

Parameters:
data - time to wakeup encoded as a wakeup_t

void kill (pid_t pid)

kill a process.

Parameters:
pid - must be valid process ID, or undefined behaviour will result!

legOS-0.1.7 is released under Mozilla Public License. Original code © 1998-1999 by Markus L. Noga.