📄 eventlib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/eventLib.html - generated by refgen from eventLib.c --> <title> eventLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference : OS Libraries</i></a></p></blockquote><h1>eventLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>eventLib</strong> - VxWorks events library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./eventLib.html#eventReceive">eventReceive</a>( )</b> - Wait for event(s)<br><b><a href="./eventLib.html#eventSend">eventSend</a>( )</b> - Send event(s)<br><b><a href="./eventLib.html#eventClear">eventClear</a>( )</b> - Clear all events for current task.<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>Events are a means of communication between tasks and interrupt routines,based on a synchronous model. Only tasks can receive events, and both tasksand ISRs can send them.<p>Events are similar to signals in that they are directed at one task but differin the fact that they are synchronous in nature. Thus, the receiving task mustpend when waiting for events to occur. Also, unlike signals, a handler is notneeded since, when wanted events are received, the pending task continues itsexecution (like after a call to <b><a href="./msgQLib.html#msgQReceive">msgQReceive</a>( )</b> or <b><a href="./semLib.html#semTake">semTake</a>( )</b>).<p>Each task has its own events field that can be filled by having tasks (evenitself) and/or ISRs sending events to the task. Each event's meaning isdifferent for every task. Event X when received can be interpreted differentlyby separate tasks. Also, it should be noted that events are not accumulated.If the same event is received several times, it counts as if it were receivedonly once. It is not possible to track how many times each event has been sent to a task.<p>There are some VxWorks objects that can send events when they become available.They are referred to as <b>resources</b> in the context of events. They includesemaphores and message queues. For example, when a semaphore becomes free,events can be sent to a task that asked for it.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>eventLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./taskLib.html#top">taskLib</a></b>, <b><a href="./semLib.html#top">semLib</a></b>, <b><a href="./semBLib.html#top">semBLib</a></b>, <b><a href="./semCLib.html#top">semCLib</a></b>, <b><a href="./semMLib.html#top">semMLib</a></b>, <b><a href="./msgQLib.html#top">msgQLib</a></b>,<i>VxWorks Programmer's Guide: Basic OS</i><hr><a name="eventReceive"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>eventReceive( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>eventReceive( )</strong> - Wait for event(s)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS eventReceive ( UINT32 events, /* events task is waiting to occur */ UINT8 options, /* user options */ int timeout, /* ticks to wait */ UINT32 * pEventsReceived /* events occured are returned through this */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>Pends task until one or all specified <i>events</i> have occurred. Whenthey have,<i>pEventsReceived</i> will be filled with those that did occur.<p>The <i>options</i> parameter is used for three user options. Firstly, it is used to specify if the task is going to wait for all events to occur or only one of them. One of the following has to be selected:<dl><dt><b>EVENTS_WAIT_ANY</b> (0x1)<dd>only one event has to occur<dt><b>EVENTS_WAIT_ALL</b> (0x0)<dd>will wait until all events occur.</dl>Secondly, it is used to specify if the events returned in <i>pEventsReceived</i>will be only those received and wanted, or all events received (even theones received before <b><a href="./eventLib.html#eventReceive">eventReceive</a>( )</b> was called). By default it returnsonly the events wanted. Performing a bitwise-OR of the following: <dl><dt><b>EVENTS_RETURN_ALL</b> (0x2)<dd>causes the function to return received events, both wanted and unwanted.</dl>Thirdly, it can be used to retrieve what events have been received by thecurrent task. If the option<dl><dt><b>EVENTS_FETCH</b> (0x80)<dd>is chosen by the user, then <i>pEventsReceived</i> will be filled with the eventsthat have already been received and will return immediately. In this case,the parameters <i>events</i> and <i>timeout</i>, as well as all the other options, areignored. Also, events are not cleared, allowing to get a peek at the eventsthat have already been received.</dl><p>The <i>timeout</i> parameter specifies the number of ticks to wait for wantedevents to be sent to the waiting task. It can also have the following special values:<dl><dt><b>NO_WAIT</b> (0)<dd>return immediately, even if no events have arrived.<dt><b>WAIT_FOREVER</b> (-1)<dd>never time out.</dl><p>It must also be noted that events sent to the receiving task are clearedprior to returning, as if a call to <b><a href="./eventLib.html#eventClear">eventClear</a>( )</b> was done.<p>The parameter <i>pEventsReceived</i> is always filled with the events receivedeven when the function returns an error, except if a value of NULL waspassed.<p></blockquote><h4>WARNING</h4><blockquote><p>This routine may not be used from interrupt level.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK on success or ERROR.<p></blockquote><h4>ERRNO</h4><blockquote><p><dl><dt><b>S_eventLib_TIMEOUT</b><dd>Wanted events not received before specified time expired.<dt><b>S_eventLib_NOT_ALL_EVENTS</b><dd>Specified <b>NO_WAIT</b> as the timeout parameter and wanted events were not alreadyreceived when the routine was called.<dt><b>S_objLib_OBJ_DELETED</b><dd>Task is waiting for some events from a resource that is subsequently deleted.<dt><b>S_intLib_NOT_ISR_CALLABLE</b><dd>Function has been called from ISR.<dt><b>S_eventLib_ZERO_EVENTS</b><dd>The <i>events</i> parameter has been passed a value of 0.</dl></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./eventLib.html#top">eventLib</a></b>, <b><a href="./semEvLib.html#top">semEvLib</a></b>, <b><a href="./msgQEvLib.html#top">msgQEvLib</a></b>, <b><a href="./eventLib.html#eventSend">eventSend</a>( )</b><hr><a name="eventSend"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>eventSend( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>eventSend( )</strong> - Send event(s)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS eventSend ( int taskId, /* task events will be sent to */ UINT32 events /* events to send */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>Sends specified event(s) to specified task. Passing a taskId of NULL sends events to the calling task.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK on success or ERROR.<p></blockquote><h4>ERRNO</h4><blockquote><p><dl><dt><b>S_objLib_OBJ_ID_ERROR</b><dd>Task ID is invalid.<dt><b>S_eventLib_NULL_TASKID_AT_INT_LEVEL</b><dd>Routine was called from ISR with a taskId of NULL.</dl></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./eventLib.html#top">eventLib</a></b>, <b><a href="./eventLib.html#eventReceive">eventReceive</a>( )</b><hr><a name="eventClear"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>eventClear( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>eventClear( )</strong> - Clear all events for current task.</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS eventClear (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function clears all received events for the calling task.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK on success or ERROR.<p></blockquote><h4>ERRNO</h4><blockquote><p><dl><dt><b>S_intLib_NOT_ISR_CALLABLE</b><dd>Routine has been called from interrupt level.</dl></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./eventLib.html#top">eventLib</a></b>, </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -