11.07.2015 Views

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ImportantThe stack that you define has to reside in an area that the CPU can actually use as stack. Most CPUs cannot use theentire memory area as stack.Most CPUs require alignment of stack in multiples of bytes. This is automatically done, when the task stack is definedas an array of integers.Example/* Demo-program to illustrate the use of OS_CreateTask */OS_STACKPTR int StackMain[100], StackClock[50];OS_TASK TaskMain,TaskClock;OS_SEMA SemaLCD;void Clock(void) {while(1) {/* Code to update the clock */}}void Main(void) {while (1) {/* Your code */}}void InitTask(void) {OS_CreateTask(&TaskMain, NULL, 50, Main, StackMain, sizeof(StackMain), 2);OS_CreateTask(&TaskClock, NULL, 100, Clock,StackClock,sizeof(StackClock),2);}OS_CREATETASK_EX()DescriptionCreates a task and passes a parameter to the task.Prototypevoid OS_CREATETASK_EX (OS_TASK* pTask,char*pName,void*pRoutine,unsigned char Priority,void*pStack,void*pContext);ParameterDescriptionpTaskpNamepRoutinePrioritypStackpContextTable 6: OS_CREATETASK_EX() parameter listAdditional InformationPointer to a data structure of type OS_TASK which will be used as task control block (andreference) for this task.Pointer to the name of the task. Can be NULL (or 0) if not used.Pointer to a routine that should run as a task.Priority of the task. Must be within the following range:1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!