Main Page   Modules   Data Structures   File List   Globals  

task.c File Reference

Task management and control functions. More...

#include <avr/interrupt.h>
#include <avr/io.h>
#include <string.h>
#include <avr/pgmspace.h>
#include "otos_cfg.h"
#include "otos_def.h"
#include "types.h"
#include "memory.h"
#include "hardware.h"
#include "error.h"
#include "time.h"
#include "task.h"

Go to the source code of this file.

Functions

OtosTask * otosCreateTask (void(*pFunc)(void *), void *pArg, uint8_t prio, uint16_t stacksize, uint8_t name)
 Create a task.

OtosTask * otosGetRunningTask (void)
 Get pointer to the running task.

uint8_t otosSetPriority (uint8_t prio)
 Set the priority of the running task.

OtosTask * otosCreateMainTask (uint8_t prio, uint16_t stacksize)
 Create the main task. The calling function will become the main task.

void otosDispatch (OtosTask *pOldTask, OtosTask *pNewTask)
 Switch task context from pOldTask to pNewTask.

void otosScheduler (uint8_t operation)
 Distribute CPU time.

void otosWakeup (OtosTask *pTask)
 Wake up task.

void otosInsertTaskInQueue (OtosTask *volatile *pQueue, OtosTask *pTask, uint8_t state)
 Insert task in a queue.

uint8_t otosSetPreemtive (uint8_t timeSlice)
 Enable/disable preemtive multitasking.

uint8_t otosGetPreemtive (void)
 Get status of preemtive multitasking.

 OTOS_TASK_FUNCTION (idle, pArg)
 The system idle task.

int main (void)
 C entry point.


Variables

uint8_t msgErrOutOfMem[] PROGMEM = "otOS ERR: out of mem"
OtosTask *volatile g_pReadyQueue
 All tasks that are ready to run.

OtosTask *volatile g_pBlockedQueue
 All blocked tasks.

OtosTask *volatile g_pRunningTask
 The running task.

uint8_t volatile g_performDispatch
 Total number of tasks TRUE if dispatch must be performed.

uint8_t volatile g_timeSliceTicks
 Number of timer ticks in a time slice. If 0, disable preemtive multitasking.

uint8_t volatile g_timeSliceCounter
 Time slice counter.


Detailed Description

Task management and control functions.

Definition in file task.c.


Generated on Sat Jan 25 18:41:43 2003 for otOS by doxygen1.3-rc2