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.

Event objectsIntroductionEvent objects are another type of communication and synchronization objects. In contrast to task-events, event objectsare standalone objects which are not owned by any task.The purpose of an event object is to enable one or multiple tasks to wait for a particular event to occur. The tasks canbe kept suspended until the event is set by another task, a S/W timer, or an interrupt handler. The event can be anythingthat the software is made aware of in any way. Examples include the change of an input signal, the expiration of a timer,a key press, the reception of a character, or a complete command.Compared to a task event, the signalling function does not need to know which task is waiting for the event to occur.Event object API function overviewRoutineOS_EVENT_Create()OS_EVENT_Wait()OS_EVENT_WaitTimed()OS_EVENT_Set()OS_EVENT_Reset()OS_EVENT_Pulse()OS_EVENT_Get()OS_EVENT_Delete()Table 89: Event object API overviewOS_EVENT_Create()DescriptionCreates an event object and resets the event.Prototypevoid OS_EVENT_Create (OS_EVENT* pEvent)ParameterDescriptionpEventTable 90: OS_EVENT_Create() parameter listAdditional InformationBefore the event object can be used, it has to be created once by a call of OS_EVENT_Create(). On creation, theevent is set in non-signaled state, and the list of waiting tasks is deleted. Therefore, OS_EVENT_Create() must notbe called for an event object which was already created before. The debug version of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> checkswhether the specified event object was already created and calls OS_Error() with error codeOS_ERR_2USE_EVENTOBJ, if the event object was already created before the call of OS_EVENT_Create().ExampleDescriptionCreates an event object. Has to be called before the event object can be used.Waits for an event and resets the event after it occurs.Waits for an event with timeout and resets the event after it occurs.Sets the events, or resumes waiting tasks.Clears for example resets the event to un-signaled state.Sets the event, resumes waiting tasks, if any, and then resets the event.Returns the state of an event object.Deletes the specified event object.Pointer to an event object data structure.OS_EVENT _HW_Event;OS_EVENT_Create(&HW_Event); /* Create and initialize event object */PP<strong>RTOS</strong>-2 83

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

Saved successfully!

Ooh no, something went wrong!