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.

Task eventsIntroductionTask events are another way of communication between tasks. In contrast to semaphores and mailboxes, task eventsare messages to a single, specified recipient. In other words, a task event is sent to a specified task.The purpose of a task event is to enable a task to wait for a particular event (or for one of several events) to occur. Thistask can be kept inactive until the event is signaled by another task, a S/W timer or an interrupt handler. The event canconsist of anything that the software has been made aware of in any way. For example, the change of an input signal,the expiration of a timer, a key press, the reception of a character, or a complete command.Every task has a 1-byte (8-bit) mask, which means that 8 different events can be signaled to and distinguished by everytask. By calling OS_WaitEvent(), a task waits for one of the events specified as a bitmask. As soon as one of theevents occurs, this task must be signaled by calling OS_SignalEvent(). The waiting task will then be put in theREADY state immediately. It will be activated according to the rules of the scheduler as soon as it becomes the taskwith the highest priority of all the tasks in the READY state.Events API function overviewRoutineOS_WaitEvent()OS_WaitSingleEvent()OS_WaitEventTimed()OS_WaitSingleEventTimed()OS_SignalEvent()OS_GetEventsOccurred()OS_ClearEvents()Table 81: Events API overviewOS_WaitEvent()DescriptionWaits for one of the events specified in the bitmask and clears the event memory after an event occurs.Prototypechar OS_WaitEvent (char EventMask);ParameterDescriptionEventMaskTable 82: OS_WaitEvent() parameter listReturn valueAll events that have actually occurred.DescriptionWaits for one of the events specified in the bitmask and clears the eventmemory after an event occurs.Waits for one of the events specified as bitmask and clears only that eventafter it occurs.Waits for the specified events for a given time, and clears the event memoryafter an event occurs.Waits for the specified events for a given time; after an event occurs, only thatevent is cleared.Signals event(s) to a specified task.Returns a list of events that have occurred for a specified task.Returns the actual state of events and then clears the events of a specifiedtask.The events that the task will be waiting for.PP<strong>RTOS</strong>-2 77

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

Saved successfully!

Ooh no, something went wrong!