IAR PowerPac RTOS User Guide
IAR PowerPac RTOS User Guide IAR PowerPac RTOS User Guide
Prototypevoid OS_StartTimer (OS_TIMER* pTimer);ParameterDescriptionpTimerPointer to the OS_TIMER data structure which contains the data of the timer.Table 22: OS_StartTimer() parameter listAdditional InformationOS_StartTimer() is used for the following reasons:●●Start a timer which was created by OS_CreateTimer(). The timer will start with its initial timer value.Restart a timer which was stopped by calling OS_StopTimer(). 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_RetriggerTimer() to restart those timers.OS_StopTimer()DescriptionStops a specified timer.Prototypevoid OS_StopTimer (OS_TIMER* pTimer);ParameterDescriptionpTimerTable 23: OS_StopTimer() parameter listAdditional InformationThe actual value of the timer (the time until expiration) is kept until OS_StartTimer() lets the timer continue.OS_RetriggerTimer()DescriptionRestarts a specified timer with its initial time value.Prototypevoid OS_RetriggerTimer (OS_TIMER* pTimer);ParameterDescriptionpTimerTable 24: OS_RetriggerTimer() parameter listAdditional InformationOS_RetriggerTimer() restarts the timer using the initial time value programmed at creation of the timer or with thefunction OS_SetTimerPeriod().ExampleOS_TIMER TIMERCursor;BOOL CursorOn;Pointer to the OS_TIMER data structure which contains the data of the timer.Pointer to the OS_TIMER data structure which contains the data of the timer.void TimerCursor(void) {if (CursorOn) ToggleCursor(); /* Invert character at cursor-position */OS_RetriggerTimer(&TIMERCursor); /* Make timer periodical */}void InitTask(void) {/* Create and start TimerCursor */OS_CREATETIMER(&TIMERCursor, TimerCursor, 500);}40IAR PowerPac RTOSfor ARM CoresPPRTOS-2
Software timersOS_SetTimerPeriod()DescriptionSets a new timer reload value for a specified timer.Prototypevoid OS_SetTimerPeriod (OS_TIMER* pTimer,OS_TIME Period);ParameterDescriptionpTimerPeriodTable 25: OS_SetTimerPeriod() parameter listAdditional InformationOS_SetTimerPeriod() sets the initial time value of the specified timer. Period is the reload value of the timer to beused as initial value when the timer is retriggered by OS_RetriggerTimer().ExampleOS_TIMER TIMERPulse;BOOL CursorOn;void TimerPulse(void) {if TogglePulseOutput(); /* Toggle output */OS_RetriggerTimer(&TIMERCursor); /* Make timer periodical */}void InitTask(void) {/* Create and start Pulse Timer with first pulse = 500ms */OS_CREATETIMER(&TIMERPulse, TimerPulse, 500);/* Set timer period to 200 ms for further pulses */OS_SetTimerPeriod(&TIMERPulse, 200);}OS_DeleteTimer()DescriptionStops and deletes a specified timer.Prototypevoid OS_DeleteTimer (OS_TIMER* pTimer);ParameterDescriptionpTimerTable 26: OS_DeleteTimer() parameter listAdditional InformationThe timer is stopped and therefore removed out of the linked list of running timers. In debug builds of IAR PowerPacRTOS, the timer is also marked as invalid.OS_GetTimerPeriod()DescriptionReturns the current reload value of a specified timer.PrototypePointer to the OS_TIMER data structure which contains the data of the timer.Timer period in basic IAR PowerPac RTOS time units (nominal ms):The data type OS_TIME defaults to an integer, therefore valid values are1
- Page 1 and 2: IAR PowerPac RTOSUser GuidePPRTOS-2
- Page 3 and 4: PrefaceWelcome to the IAR PowerPac
- Page 5 and 6: ContentsPreface ...................
- Page 7 and 8: ContentsOS_WaitCSema() ............
- Page 9 and 10: ContentsOS_LeaveInterrupt() .......
- Page 11 and 12: Introduction to IAR PowerPacRTOSWha
- Page 13 and 14: Basic conceptsTasksIn this context,
- Page 15 and 16: Basic conceptsPREEMPTIVES MULTITASK
- Page 17 and 18: Basic conceptsMAILBOXES AND QUEUESA
- Page 19 and 20: Basic conceptsThe active task may b
- Page 21 and 22: Basic conceptsThe flowchart below i
- Page 23 and 24: Basic conceptsLIST OF LIBRARIESIn y
- Page 25 and 26: Task routinesIntroductionA task tha
- Page 27 and 28: Task routinesOS_CREATETASK() can be
- Page 29 and 30: Task routinesExampleThe following e
- Page 31 and 32: Task routinesExampleint sec,min;voi
- Page 33 and 34: Task routinesAdditional Information
- Page 35 and 36: Task routinesReturn valueOS_TASKID:
- Page 37 and 38: Software timersSoftware timerA soft
- Page 39: Software timers#define OS_CREATETIM
- Page 43 and 44: Software timersAdditional Informati
- Page 45 and 46: Software timersAdditional Informati
- Page 47 and 48: Software timersExampleOS_TIMER TIME
- Page 49 and 50: Resource semaphoresIntroductionReso
- Page 51 and 52: Resource semaphoresResource semapho
- Page 53 and 54: Resource semaphoresOS_Request()Desc
- Page 55 and 56: Counting SemaphoresIntroductionCoun
- Page 57 and 58: Counting SemaphoresPrototypevoid OS
- Page 59 and 60: Counting SemaphoresReturn value0: I
- Page 61 and 62: MailboxesWhy mailboxes?In the prece
- Page 63 and 64: MailboxesMailboxes API function ove
- Page 65 and 66: MailboxesExampleSingle-byte mailbox
- Page 67 and 68: MailboxesPrototypevoid OS_GetMail (
- Page 69 and 70: MailboxesOS_WaitMail()DescriptionWa
- Page 71 and 72: QueuesWhy queues?In the preceding c
- Page 73 and 74: QueuesReturn valueThe size of the r
- Page 75 and 76: QueuesExamplestatic void MemoryTask
- Page 77 and 78: Task eventsIntroductionTask events
- Page 79 and 80: Task eventsExampleOS_WaitEventTimed
- Page 81 and 82: Task eventsPrototypechar OS_ClearEv
- Page 83 and 84: Event objectsIntroductionEvent obje
- Page 85 and 86: Event objectsExampleif (OS_EVENT_Wa
- Page 87 and 88: Event objectsExampleOS_EVENT_Reset(
- Page 89 and 90: Heap type memory managementANSI C o
Prototypevoid OS_StartTimer (OS_TIMER* pTimer);ParameterDescriptionpTimerPointer to the OS_TIMER data structure which contains the data of the timer.Table 22: OS_StartTimer() parameter listAdditional InformationOS_StartTimer() is used for the following reasons:●●Start a timer which was created by OS_CreateTimer(). The timer will start with its initial timer value.Restart a timer which was stopped by calling OS_StopTimer(). 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_RetriggerTimer() to restart those timers.OS_StopTimer()DescriptionStops a specified timer.Prototypevoid OS_StopTimer (OS_TIMER* pTimer);ParameterDescriptionpTimerTable 23: OS_StopTimer() parameter listAdditional InformationThe actual value of the timer (the time until expiration) is kept until OS_StartTimer() lets the timer continue.OS_RetriggerTimer()DescriptionRestarts a specified timer with its initial time value.Prototypevoid OS_RetriggerTimer (OS_TIMER* pTimer);ParameterDescriptionpTimerTable 24: OS_RetriggerTimer() parameter listAdditional InformationOS_RetriggerTimer() restarts the timer using the initial time value programmed at creation of the timer or with thefunction OS_SetTimerPeriod().ExampleOS_TIMER TIMERCursor;BOOL CursorOn;Pointer to the OS_TIMER data structure which contains the data of the timer.Pointer to the OS_TIMER data structure which contains the data of the timer.void TimerCursor(void) {if (CursorOn) ToggleCursor(); /* Invert character at cursor-position */OS_RetriggerTimer(&TIMERCursor); /* Make timer periodical */}void InitTask(void) {/* Create and start TimerCursor */OS_CREATETIMER(&TIMERCursor, TimerCursor, 500);}40<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>for ARM CoresPP<strong>RTOS</strong>-2