Main Page   Modules   Data Structures   File List   Globals  

Internal Task Management Functions
[Task Management]


Functions

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.


Detailed Description

Used internally by otOS, not intended to be called by otOS applications.

Function Documentation

int main void   
 

C entry point.

Initializes task handling and finally calls otosMain(), which is a function supplied by the otOS application.

Note:
Used internally by otOS, not intended to be called by otOS applications.

Definition at line 594 of file task.c.

References otosCreateMainTask(), otosCreateTask(), otosGetTicks(), otosInitHardware(), and otosSetRamBank().

OTOS_TASK_FUNCTION idle   ,
pArg   
 

The system idle task.

This task is executed when there is no other task ready to run. This task must always be READY. It must have priority 0.

Note:
Used internally by otOS, not intended to be called by otOS applications.

Definition at line 575 of file task.c.

References otosScheduler().

OtosTask* otosCreateMainTask uint8_t    prio,
uint16_t    stacksize
 

Create the main task. The calling function will become the main task.

Note:
Used internally by otOS, not intended to be called by otOS applications.
Parameters:
prio Task priority [1..250]
stacksize Size of task's stack in bytes
Returns:
Pointer to the created task structure

Definition at line 257 of file task.c.

References g_pRunningTask, otosAllocate(), and otosError_P().

Referenced by main().

void otosDispatch OtosTask *    pOldTask,
OtosTask *    pNewTask
 

Switch task context from pOldTask to pNewTask.

Note:
Used internally by otOS, not intended to be called by otOS applications.
Parameters:
pOldTask The running task
pNewTask The task to switch to

Definition at line 344 of file task.c.

Referenced by otosScheduler().

uint8_t otosGetPreemtive void    [inline]
 

Get status of preemtive multitasking.

Returns:
Status of preemptive multitasking \
  • 0: No preemtive multitasking
  • n: Use time slice of n timer ticks

Definition at line 560 of file task.c.

References g_timeSliceTicks.

void otosInsertTaskInQueue OtosTask *volatile *    pQueue,
OtosTask *    pTask,
uint8_t    state
 

Insert task in a queue.

The otOS task queues are sorted in order of descending priority, i.e. tasks with higher priority are inserted before tasks with lower priority. If more tasks have the same priority, a newly inserted task is inserted after all other tasks of the same priority.

Note:
Used internally by otOS, not intended to be called by otOS applications.
Parameters:
queue Pointer to queue
pTask Task to be inserted in queue
state New task state

Definition at line 499 of file task.c.

Referenced by otosCreateTask(), otosScheduler(), and otosWakeup().

void otosScheduler uint8_t    operation
 

Distribute CPU time.

Note:
Used internally by otOS, not intended to be called by otOS applications.
Parameters:
operation 
  • SCHED_BLOCK: Block running task
  • SCHED_NORM: Normal task switch

Definition at line 368 of file task.c.

References g_performDispatch, g_pReadyQueue, g_pRunningTask, otosDispatch(), otosError(), otosGetTickDiff(), otosGetTicks(), and otosInsertTaskInQueue().

Referenced by OTOS_TASK_FUNCTION(), otosCreateTask(), otosSendEvent(), otosSendMessage(), otosSetPriority(), otosSleep(), otosUnlockMutex(), and SIGNAL().

uint8_t otosSetPreemtive uint8_t    timeSlice
 

Enable/disable preemtive multitasking.

Parameters:
timeSlice: 
  • 0: No preemtive multitasking
  • n: Use time slice of n timer ticks
Returns:
Old setting

Definition at line 533 of file task.c.

References g_timeSliceCounter, and g_timeSliceTicks.

void otosWakeup OtosTask *    pTask
 

Wake up task.

Move pTask from blocked queue to ready queue. No task switch will occur.

Note:
Used internally by otOS, not intended to be called by otOS applications.
Parameters:
pTask Task to wake up

Definition at line 456 of file task.c.

References g_pBlockedQueue, otosError_P(), and otosInsertTaskInQueue().

Referenced by otosSendEventToOneTask(), otosSendMessage(), otosUnlockMutex(), and SIGNAL().


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