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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Software timersAdditional Information<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> keeps track of the timers by using a linked list. Once the timeout has expired, the callback routinewill be called immediately (unless the task is in a critical region or has interrupts disabled). The extended software timeris not automatically started. This has to be done explicitly by a call of OS_StartTimerEx() orOS_RetriggerTimerEx().OS_TIMER_EX_ROUTINE is defined in <strong>RTOS</strong>.h as follows:typedef void OS_TIMER_EX_ROUTINE(void*);ExampleOS_TIMER TIMER100;OS_TASK TCB_HP;void Timer100(void* pTask) {LED = LED ? 0 : 1; /* Toggle LED */if (pTask != NULL) {OS_SignalEvent(0x01, (OS_TASK*)pTask)}OS_RetriggerTimerEx(&TIMER100); /* Make timer periodical */}void InitTask(void) {/* Create Timer100, start it elsewhere later on */OS_CreateTimer(&TIMER100, Timer100, 100);}OS_StartTimerEx()DescriptionStarts an extended software timer.Prototypevoid OS_StartTimerEx (OS_TIMER_EX* pTimerEx);ParameterDescriptionpTimerExPointer to the OS_TIMER_EX data structure which contains the data of the extended softwaretimer.Table 32: OS_StartTimer() parameter listAdditional InformationOS_StartTimerEx() is used for the following reasons:●●Start an extended timer which was created by OS_CreateTimerEx(). The timer will start with its initial timervalue.Restart a timer which was stopped by calling OS_StopTimerEx(). In this case, the timer will continue with theremaining time value which was preserved by stopping the timer.ImportantThis function has no effect on running timers. It also has no effect on timers that are not running, but has expired. UseOS_RetriggerTimerEx() to restart those timers.OS_StopTimerEx()DescriptionStops an extended software timer.Prototypevoid OS_StopTimerEx (OS_TIMER_EX* pTimerEx);ParameterDescriptionpTimerExPointer to the OS_TIMER_EX data structure which contains the data of the extended softwaretimer.Table 33: OS_StopTimerEx() parameter listPP<strong>RTOS</strong>-245

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

Saved successfully!

Ooh no, something went wrong!