Changeset e74dc82 in rtems


Ignore:
Timestamp:
Jul 8, 1999, 3:28:15 PM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
0f8a69e7
Parents:
2aab33e5
Message:

First draft from Xiangyang Wu <wux@…>.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/itron3.0/eventflags.t

    r2aab33e5 re74dc82  
    1111@section Introduction
    1212
    13 The
    14 eventflags manager is ...
     13The eventflag manager provides a high performance method of intertask communication and synchronization. The directives provided by the eventflag manager are:
    1514
    1615The services provided by the eventflags manager are:
     
    2928@section Background
    3029
     30@subsection Event sets
     31
     32An eventflag is used by a task (or ISR) to inform another task of the occurrence of a significant situation. Thirty-two eventflags are associated with each task. A collection of one or more eventflags is referred to as an event set. The application developer should remember the following key characteristics of event operations when utilizing the event manager:
     33
     34@itemize @bullet
     35@item Events provide a simple synchronization facility.
     36@item Events are aimed at tasks.
     37@item Tasks can wait on more than one event simultaneously.
     38@item Events are independent of one another.
     39@item Events do not hold or transport data.
     40@item Events are not queued. In other words, if an event is sent more than once to a task before being received, the second and subsequent send operations to that same task have no effect.
     41@end itemize
     42
     43A pending event is an event that has been posted but not received. An event condition is used to specify the events which the task desires to receive and the algorithm which will be used to determine when the request is satisfied. An event condition is satisfied based upon one of two algorithms which are selected by the user. The @code{TWF_ORW} algorithm states that an event condition is satisfied when at least a single requested event is posted. The @code{TWF_ANDW} algorithm states that an event condition is satisfied when every requested event is posted.
     44
     45An event set or condition is built by a bitwise OR of the desired events. If an event is not explicitly specified in the set or condition, then it is not present. Events are specifically designed to be mutually exclusive, therefore bitwise OR and addition operations are equivalent as long as each event appears exactly once in the event set list.
     46
     47@subsection T_CFLG Structure
     48
     49The T_CFLG structire is used to define the characteristics of an eventflag and passed as an argument to the @code{cre_flg} service. The structure is defined as follows:
     50
     51@example
     52
     53/*
     54 * Create Eventflags (cre_flg) Structure
     55 */
     56
     57typedef struct t_cflg @{
     58  VP exinf;     /* extended information */
     59  ATR flgatr;   /* eventflag attribute */
     60  UINT iflgptn; /* initial eventflag */
     61  /* additional information may be included depending on the implementation */
     62@} T_CFLG;
     63
     64/*
     65 *  flgatr - Eventflag Attribute Values
     66 */
     67
     68
     69/* multiple tasks are not allowed to wait (Wait Single Task)*/
     70
     71#define TA_WSGL 0x00
     72
     73/* multiple tasks are allowed to wait (Wait Multiple Task) */
     74
     75#define TA_WMUL 0x08
     76
     77/* wfmode */
     78#define TWF_ANDW 0x00 /* AND wait */
     79#define TWF_ORW 0x02 /* OR wait */
     80#define TWF_CLR 0x01 /* clear specification */
     81@end example
     82
     83where the meaning of each field is:
     84
     85@table @b
     86@item VP
     87exinf exinf may be used freely by the user for including extended information about the eventflag to be created. Information set here may be accessed by ref_flg. If a larger region is desired for including user information, or if the user wishes to change the contents of this information, the usr should allocate memory area and set the address of this memory packet to exinf.  The OS does not take care of the contents of exinf. This implementation does not use this field.
     88
     89@item ATR
     90flgatr  is the attributes for this eventflag. The lower bits of flgatr represent system attributes, while the upper bits represent implementation-dependent attributes.
     91
     92@item UINT
     93iflgptn is the initial eventflag pattern.
     94(CPU and/or implementation-dependent information may also be included)
     95@end table
     96@subsection T_RFLG Structure
     97
     98The T_RFLG structire is used to define the characteristics of an eventflag and passed as an argument to the @code{ref_flg} service. The structure is defined as follows:
     99
     100@example
     101* Reference Eventflags (ref_flg) Structure */
     102typedef struct t_rflg @{
     103 VP exinf; /* extended information */
     104 BOOL_ID wtsk; /* indicates whether or not there is a waiting task */
     105 UINT flgptn; /* eventflag bit pattern */
     106 /* additional information may be included depending on the implementation */
     107@} T_RFLG;
     108@end example
     109
     110@table @b
     111@item BOOL_ID
     112indicates whether or not there is a task waiting for the eventflag in question.  If there is no waiting task, wtsk is returned as FALSE = 0.  If there is a waiting task, wtsk is returned as a value other than 0.
     113@end table
     114
    31115@section Operations
    32116
     
    62146@subheading STATUS CODES:
    63147
    64 @code{EXXX} -
    65 
    66 @subheading DESCRIPTION:
    67 
    68 @subheading NOTES:
    69 
     148@code{E_OK}  -  Normal Completion
     149@code{E_NOMEM} -  Insufficient memory (Memory for control block cannot be allocated)
     150@code{E_ID} - Invalid ID number (flgid was invalid or could not be used)
     151@code{E_RSATR} -  Reserved attribute (flgatr was invalid or could not be used)
     152@code{E_OBJ} - Invalid object state (an eventflag of the same ID already exists)
     153@code{E_OACV} - Object access violation (A flgid less than -4 was specified from a user task.  This is implementation dependent.)
     154@code{E_PAR} - Parameter error (pk_cflg is invalid)
     155@code{EN_OBJNO} - An object number which could not be accessed on the target node is specified.
     156@code{EN_CTXID} - Specified an object on another node when the system call was issued from a task in dispatch disabled state or from a task-independent portion
     157@code{EN_PAR}- A value outside the range supported by the target node and/or transmission packet format was specified as a parameter (a value outside supported range was specified for exinf, flgatr and/or iflgptn)
     158
     159@subheading DESCRIPTION:
     160
     161This system call creates the eventflag specified by @code{flgid}.  Specifically, a control block for the eventflag to be created is allocated and the associated flag pattern is initialized using @code{iflgptn}.  A single eventflag handles one word's worth of bits of the processor in question as a group.  All operations are done in single word units.
     162
     163User eventflags have positive ID numbers, while system eventflags have negative ID numbers.  User tasks (tasks having positive task IDs) cannot access system eventflags. An @code{E_OACV} error will result if a user task issues a system call on a system eventflag, but error detection is implementation dependent.
     164
     165Eventflags having ID numbers from -4 through 0 cannot be created.  An @code{E_ID} error will result if a value in this range is specified for @code{flgid}.
     166
     167The system attribute part of flgatr may be specified as follows.
     168@example
     169        flgatr := (TA_WMUL || TA_WSGL)
     170@end example
     171        @code{TA_WSGL} Waiting for multiple tasks is not allowed (Wait Single Task)
     172        @code{TA_WMUL} Waiting for multiple tasks is allowed (Wait Multiple Tasks)
     173
     174@subheading NOTES:
     175
     176Multiprocessing is not supported. Thus none of the "@code{EN_}" status codes will be returned.
     177
     178All memory is preallocated for @code{RTEMS ITRON} objects. Thus, no dynamic memory allocation is performed by @code{cre_flg}  and the @code{E_NOMEM} error can not be returned.
    70179
    71180@c
     
    91200@subheading STATUS CODES:
    92201
    93 @code{EXXX} -
    94 
    95 @subheading DESCRIPTION:
    96 
    97 @subheading NOTES:
    98 
     202@code{E_OK} - Normal Completion
     203@code{E_ID} - Invalid ID number (flgid was invalid or could not be used)
     204@code{E_NOEXS} - Object does not exist (the eventflag specified by flgid does not exist)
     205@code{E_OACV} - Object access violation (A flgid less than -4 was specified from a user task.  This is implementation dependent.)
     206@code{EN_OBJNO} - An object number which could not be accessed on the target node is specified.
     207@code{EN_CTXID} - Specified an object on another node when the system call was issued from a task in dispatch disabled state or from a task-independent portion
     208
     209@subheading DESCRIPTION:
     210
     211This system call deletes the eventflag specified by @code{flgid}.
     212
     213Issuing this system call causes memory used for the control block of the associated eventflag to be released.  After this system call is invoked, another eventflag having the same ID number can be created.
     214
     215This system call will complete normally even if there are tasks waiting for the eventflag.  In that case, an @code{E_DLT} error will be returned to each waiting task.
     216
     217@subheading NOTES:
     218
     219Multiprocessing is not supported. Thus none of the "@code{EN_}" status codes will be returned.
     220
     221When an eventflag being waited for by more than one tasks is deleted, the order of tasks on the ready queue after the WAIT state is cleared is implementation dependent in the case of tasks having the same priority.
    99222
    100223@c
     
    121244@subheading STATUS CODES:
    122245
    123 @code{EXXX} -
    124 
    125 @subheading DESCRIPTION:
    126 
    127 @subheading NOTES:
    128 
     246@code{E_OK} - Normal Completion
     247@code{E_ID} - Invalid ID number (flgid was invalid or could not be used)
     248@code{E_NOEXS} - Object does not exist (the eventflag specified by flgid does not exist)
     249@code{E_OACV} - Object access violation (A flgid less than -4 was specified from a user task. This is implementation dependent.)
     250@code{EN_OBJNO} - An object number which could not be accessed on the target node is specified.
     251@code{EN_CTXID} - Specified an object on another node when the system call was issued from a task in dispatch disabled state or from a task-independent portion
     252@code{EN_PAR} - A value outside the range supported by the target node and/or transmission packet format was specified as a parameter (a value outside supported range was specified for setptn or clrptn)
     253
     254@subheading DESCRIPTION:
     255
     256The @code{set_flg} system call sets the bits specified by setptn of the one word eventflag specified by @code{flgid}.  In other words, a logical sum is taken for the values of the eventflag specified by flgid with the value of @code{setptn}.
     257
     258If the eventflag value is changed by @code{set_flg} and the new eventflag value satisfies the condition to release the WAIT state of the task which issued @code{wai_flg} on the eventflag, the WAIT state of that task will be  released and the task will be put into RUN or READY state (or SUSPEND state if the task was in WAIT-SUSPEND).
     259
     260Nothing will happen to the target eventflag if all bits of @code{setptn} are specified as 0 with @code{set_flg}. No error will result in either case.
     261
     262Multiple tasks can wait for a single eventflag if that eventflags has the @code{TA_WMUL} attribute. This means that even eventflags can make queues for tasks to wait on. When such eventflags are used, a single @code{set_flg} call may result in the release of multiple waiting tasks. In this case, the order of tasks on the ready queue after the WAIT state is cleared is preserved for tasks having the same priority.
     263
     264@subheading NOTES:
     265
     266Multiprocessing is not supported. Thus none of the "@code{EN_}" status codes will be returned.
    129267
    130268@c
     
    151289@subheading STATUS CODES:
    152290
    153 @code{EXXX} -
    154 
    155 @subheading DESCRIPTION:
    156 
    157 @subheading NOTES:
    158 
     291@code{E_OK} - Normal Completion
     292@code{E_ID} - Invalid ID number (flgid was invalid or could not be used)
     293@code{E_NOEXS} - Object does not exist (the eventflag specified by flgid does not exist)
     294@code{E_OACV} - Object access violation (A flgid less than -4 was specified from a user task. This is implementation dependent.)
     295@code{EN_OBJNO} - An object number which could not be accessed on the target node is specified.
     296@code{EN_CTXID} - Specified an object on another node when the system call was issued from a task in dispatch disabled state or from a task-independent portion
     297@code{EN_PAR} - A value outside the range supported by the target node and/or transmission packet format was specified as a parameter (a value outside supported range was specified for setptn or clrptn)
     298
     299@subheading DESCRIPTION:
     300
     301The @code{clr_flg} system call clears the bits of the one word eventflag based on the corresponding zero bits of @code{clrptn}.  In other words, a logical product is taken for the values of the eventflag specified by @code{flgid} with the value of @code{clrptn}.
     302
     303Issuing @code{clr_flg} never results in wait conditions being released on a task waiting for the specified eventflag.  In other words, dispatching never occurs with @code{clr_flg}.
     304
     305Nothing will happen to the target eventflag if all bits of @code{clrptn} are specified as 1 with @code{clr_flg}. No error will result.
     306
     307@subheading NOTES:
     308
     309Multiprocessing is not supported. Thus none of the "@code{EN_}" status codes will be returned.
    159310
    160311@c
     
    183334@subheading STATUS CODES:
    184335
    185 @code{EXXX} -
    186 
    187 @subheading DESCRIPTION:
    188 
    189 @subheading NOTES:
    190 
     336@code{E_OK} - Normal Completion
     337@code{E_ID} - Invalid ID number (flgid was invalid or could not be used)
     338@code{E_NOEXS} - Object does not exist (the eventflag specified by flgid does not exist)
     339@code{E_OACV} - Object access violation (A flgid less than -4 was specified from a user task.  This is implementation dependent.)
     340@code{E_PAR} - Parameter error (waiptn = 0, wfmode invalid, or tmout is -2 or less)
     341@code{E_OBJ} - Invalid object state (multiple tasks waiting for an eventflag with the TA_WSGL attribute)
     342@code{E_DLT} - The object being waited for was deleted (the specified eventflag was deleted while waiting)
     343@code{E_RLWAI} - WAIT state was forcibly released (rel_wai was received while waiting)
     344@code{E_TMOUT} - Polling failure or timeout exceeded
     345@code{E_CTX} - Context error (issued from task-independent portions or a task in dispatch disabled state)
     346@code{EN_OBJNO} - An object number which could not be accessed on the target node is specified.
     347@code{EN_PAR} - A value outside the range supported by the target node and/or transmission packet format was specified as a parameter (a value outside supported range was specified for waiptn and tmout)
     348@code{EN_RPAR} - A value outside the range supported by the requesting node and/or transmission packet format was specified as a parameter (a value exceeding the range for the requesting node was specified for flgptn)
     349
     350@subheading DESCRIPTION:
     351
     352The @code{wai_flg} system call waits for the eventflag specified by @code{flgid} to be set to satisfy the wait release condition specified by @code{wfmode}.
     353
     354If the eventflag specified by @code{flgid} already satisfies the wait release conditions given by @code{wfmode}, the issuing task will continue execution without waiting.
     355
     356@code{wfmode} may be specified as follows.
     357@example
     358        wfmode := (TWF_ANDW || TWF_ORW) | [TWF_CLR]
     359@end example
     360If @code{TWF_ORW} is specified, the issuing task will wait for any of the bits specified by @code{waiptn} to be set for the eventflag given by @code{flgid} (OR wait).  If @code{TWF_ANDW} is specified, the issuing task will wait for all of the bits specified by @code{waiptn} to be set for the eventflag given by @code{flgid} (AND wait).
     361
     362If the @code{TWF_CLR} specification is not present, the eventflag value will remain unchanged even after the wait conditions have been satisfied and the task has been released from the WAIT state.  If @code{TWF_CLR} is specified, all bits of the eventflag will be cleared to 0 once the wait conditions of the waiting task have been satisfied.
     363
     364The return parameter flgptn returns the value of the eventflag after the wait state of a task has been released due to this system call.  If @code{TWF_CLR} was specified, the value before eventflag bits were cleared is returned.  The value returned by @code{flgptn} fulfills the wait release conditions of this system call.
     365
     366The @code{pol_flg} system call has the same function as @code{wai_flg} except for the waiting feature. @code{pol_flg} polls whether or not the task should wait if @code{wai_flg} is executed.  The meanings of parameters to @code{pol_flg} are the same as for @code{wai_flg}.  The specific operations by @code{pol_flg} are as follows.
     367
     368  - If the target eventflag already satisfies the conditions for releasing wait given by @code{wfmode}, processing is the same as @code{wai_flg}: the eventflag is cleared if @code{TWF_CLR} is specified and the system call completes normally.
     369
     370  - If the target eventflag does not yet satisfy the conditions for releasing wait given by wfmode, an @code{E_TMOUT} error is returned to indicate polling failed and the system call finishes. Unlike @code{wai_flg}, the issuing task does not wait in this case. The eventflag is not cleared in this case even if @code{TWF_CLR} has been specified.
     371
     372The @code{twai_flg} system call has the same function as @code{wai_flg} with an additional timeout feature.  A maximum wait time (timeout value) can be specified using the parameter tmout.  When a timeout is specified, a timeout error, @code{E_TMOUT}, will result and the system call will finish if the period specified by tmout
     373elapses without conditions for releasing wait being satisfied.
     374
     375Specifying @code{TMO_POL = 0} to @code{twai_flg} for tmout indicates that a timeout value of 0 be used, resulting in exactly the same processing as @code{pol_flg}.  Specifying @code{TMO_FEVR = -1} to @code{twai_flg} for tmout indicates that an infinite timeout value be used, resulting in exactly the same processing as @code{wai_flg}.
     376
     377An @code{E_PAR} parameter error will result if @code{waiptn} is 0.
     378
     379A task can not execute any of @code{wai_flg, twai_flg} or @code{pol_flg} on an eventflag having the @code{TA_WSGL} attribute if another task is already waiting for that eventflag.  An @code{E_OBJ} error will be returned to a task which executes @code{wai_flg} at a later time regardless as to whether or not the task that executes @code{wai_flg} or @code{twai_flg} later will be placed in a WAIT state (conditions for releasing wait state be satisfied).  An @code{E_OBJ} error will be returned even to tasks which just execute @code{pol_flg}, again regardless as to whether or not wait release conditions for that task were satisfied.
     380
     381On the other hand, multiple tasks can wait at the same time for the same eventflag if that eventflag has the @code{TA_WMUL} attribute.  This means that event flags can make queues for tasks to wait on.  When such eventflags are used, a single @code{set_flg} call may release multiple waiting tasks.
     382
     383The following processing takes place if a queue for allowing multiple tasks to wait has been created for an eventflag with the @code{TA_WMUL} attribute.
     384
     385  - The waiting order on the queue is FIFO.  (However, depending on @code{waiptn} and @code{wfmode}, task at the head of the queue will not always be released from waiting.)
     386
     387  - If a task specifying that the eventflag be cleared is on the queue, the flag is cleared when that task is released from waiting.
     388
     389  - Since any tasks behind a task which clears the eventflag (by specifying @code{TWF_CLR}) will check the eventflag after it is cleared, they will not be released from waiting.
     390
     391If multiple tasks having the same priority are released from waiting simultaneously due to @code{set_flg}, the order of tasks on the ready queue after release will be the same as their original order on the eventflag queue.
     392
     393@subheading NOTES:
     394 
     395Multiprocessing is not supported. Thus none of the "@code{EN_}" status codes will be returned.
     396
     397@code{Pol_flg} and @code{wai_flg} represent the same processing as specifying certain values (@code{TMO_POL} or @code{TMO_FEVR}) to @code{twai_flg} for tmout.  As such, only @code{twai_flg} is implemented in the kernel; pol_flg and @code{wai_flg} should be implemented as macros which call @code{twai_flg}.
    191398
    192399@c
     
    195402
    196403@page
    197 @subsection pol_flg - Wait for Eventflag(Polling)
     404@subsection pol_flg - Wait for Eventflag (Polling)
    198405
    199406@subheading CALLING SEQUENCE:
     
    215422@subheading STATUS CODES:
    216423
    217 @code{EXXX} -
    218 
    219 @subheading DESCRIPTION:
    220 
    221 @subheading NOTES:
    222 
    223 
    224 @c
    225 @c  twai_flg
     424@code{E_OK} - Normal Completion
     425@code{E_ID} - Invalid ID number (flgid was invalid or could not be used)
     426@code{E_NOEXS} - Object does not exist (the eventflag specified by flgid does not exist)
     427@code{E_OACV} - Object access violation (A flgid less than -4 was specified from a user task.  This is implementation dependent.)
     428@code{E_PAR} - Parameter error (waiptn = 0, wfmode invalid, or tmout is -2 or less)
     429@code{E_OBJ} - Invalid object state (multiple tasks waiting for an eventflag with the TA_WSGL attribute)
     430@code{E_DLT} - The object being waited for was deleted (the specified eventflag was deleted while waiting)
     431@code{E_RLWAI} - WAIT state was forcibly released (rel_wai was received while waiting)
     432@code{E_TMOUT} - Polling failure or timeout exceeded
     433@code{E_CTX} - Context error (issued from task-independent portions or a task in dispatch disabled state)
     434@code{EN_OBJNO} - An object number which could not be accessed on the target node is specified.
     435@code{EN_PAR} - A value outside the range supported by the target node and/or transmission packet format was specified as a parameter (a value outside supported range was specified for waiptn and tmout)
     436@code{EN_RPAR} - A value outside the range supported by the requesting node and/or transmission packet format was specified as a parameter (a value exceeding the range for the requesting node was specified for flgptn)
     437
     438@subheading DESCRIPTION:
     439
     440The @code{wai_flg} system call waits for the eventflag specified by @code{flgid} to be set to satisfy the wait release condition specified by @code{wfmode}.
     441
     442If the eventflag specified by @code{flgid} already satisfies the wait release conditions given by @code{wfmode}, the issuing task will continue execution without waiting.
     443
     444@code{wfmode} may be specified as follows.
     445@example
     446        wfmode := (TWF_ANDW || TWF_ORW) | [TWF_CLR]
     447@end example
     448If @code{TWF_ORW} is specified, the issuing task will wait for any of the bits specified by @code{waiptn} to be set for the eventflag given by @code{flgid} (OR wait).  If @code{TWF_ANDW} is specified, the issuing task will wait for all of the bits specified by @code{waiptn} to be set for the eventflag given by @code{flgid} (AND wait).
     449
     450If the @code{TWF_CLR} specification is not present, the eventflag value will remain unchanged even after the wait conditions have been satisfied and the task has been released from the WAIT state.  If @code{TWF_CLR} is specified, all bits of the eventflag will be cleared to 0 once the wait conditions of the waiting task have been satisfied.
     451
     452The return parameter flgptn returns the value of the eventflag after the wait state of a task has been released due to this system call.  If @code{TWF_CLR} was specified, the value before eventflag bits were cleared is returned.  The value returned by @code{flgptn} fulfills the wait release conditions of this system call.
     453
     454The @code{pol_flg} system call has the same function as @code{wai_flg} except for the waiting feature. @code{pol_flg} polls whether or not the task should wait if @code{wai_flg} is executed.  The meanings of parameters to @code{pol_flg} are the same as for @code{wai_flg}.  The specific operations by @code{pol_flg} are as follows.
     455
     456  - If the target eventflag already satisfies the conditions for releasing wait given by @code{wfmode}, processing is the same as @code{wai_flg}: the eventflag is cleared if @code{TWF_CLR} is specified and the system call completes normally.
     457
     458  - If the target eventflag does not yet satisfy the conditions for releasing wait given by wfmode, an @code{E_TMOUT} error is returned to indicate polling failed and the system call finishes. Unlike @code{wai_flg}, the issuing task does not wait in this case. The eventflag is not cleared in this case even if @code{TWF_CLR} has been specified.
     459
     460The @code{twai_flg} system call has the same function as @code{wai_flg} with an additional timeout feature.  A maximum wait time (timeout value) can be specified using the parameter tmout.  When a timeout is specified, a timeout error, @code{E_TMOUT}, will result and the system call will finish if the period specified by tmout
     461elapses without conditions for releasing wait being satisfied.
     462
     463Specifying @code{TMO_POL = 0} to @code{twai_flg} for tmout indicates that a timeout value of 0 be used, resulting in exactly the same processing as @code{pol_flg}.  Specifying @code{TMO_FEVR = -1} to @code{twai_flg} for tmout indicates that an infinite timeout value be used, resulting in exactly the same processing as @code{wai_flg}.
     464
     465An @code{E_PAR} parameter error will result if @code{waiptn} is 0.
     466
     467A task can not execute any of @code{wai_flg, twai_flg} or @code{pol_flg} on an eventflag having the @code{TA_WSGL} attribute if another task is already waiting for that eventflag.  An @code{E_OBJ} error will be returned to a task which executes @code{wai_flg} at a later time regardless as to whether or not the task that executes @code{wai_flg} or @code{twai_flg} later will be placed in a WAIT state (conditions for releasing wait state be satisfied).  An @code{E_OBJ} error will be returned even to tasks which just execute @code{pol_flg}, again regardless as to whether or not wait release conditions for that task were satisfied.
     468
     469On the other hand, multiple tasks can wait at the same time for the same eventflag if that eventflag has the @code{TA_WMUL} attribute.  This means that event flags can make queues for tasks to wait on.  When such eventflags are used, a single @code{set_flg} call may release multiple waiting tasks.
     470
     471The following processing takes place if a queue for allowing multiple tasks to wait has been created for an eventflag with the @code{TA_WMUL} attribute.
     472
     473  - The waiting order on the queue is FIFO.  (However, depending on @code{waiptn} and @code{wfmode}, task at the head of the queue will not always be released from waiting.)
     474
     475  - If a task specifying that the eventflag be cleared is on the queue, the flag is cleared when that task is released from waiting.
     476
     477  - Since any tasks behind a task which clears the eventflag (by specifying @code{TWF_CLR}) will check the eventflag after it is cleared, they will not be released from waiting.
     478
     479If multiple tasks having the same priority are released from waiting simultaneously due to @code{set_flg}, the order of tasks on the ready queue after release will be the same as their original order on the eventflag queue.
     480
     481@subheading NOTES:
     482 
     483Multiprocessing is not supported. Thus none of the "@code{EN_}" status codes will be returned.
     484
     485@code{Pol_flg} and @code{wai_flg} represent the same processing as specifying certain values (@code{TMO_POL} or @code{TMO_FEVR}) to @code{twai_flg} for tmout.  As such, only @code{twai_flg} is implemented in the kernel; pol_flg and @code{wai_flg} should be implemented as macros which call @code{twai_flg}.
     486
     487@c
     488@c  twai_flg, 
    226489@c
    227490
     
    247510@subheading STATUS CODES:
    248511
    249 @code{EXXX} -
    250 
    251 @subheading DESCRIPTION:
    252 
    253 @subheading NOTES:
    254 
     512@code{E_OK} - Normal Completion
     513@code{E_ID} - Invalid ID number (flgid was invalid or could not be used)
     514@code{E_NOEXS} - Object does not exist (the eventflag specified by flgid does not exist)
     515@code{E_OACV} - Object access violation (A flgid less than -4 was specified from a user task.  This is implementation dependent.)
     516@code{E_PAR} - Parameter error (waiptn = 0, wfmode invalid, or tmout is -2 or less)
     517@code{E_OBJ} - Invalid object state (multiple tasks waiting for an eventflag with the TA_WSGL attribute)
     518@code{E_DLT} - The object being waited for was deleted (the specified eventflag was deleted while waiting)
     519@code{E_RLWAI} - WAIT state was forcibly released (rel_wai was received while waiting)
     520@code{E_TMOUT} - Polling failure or timeout exceeded
     521@code{E_CTX} - Context error (issued from task-independent portions or a task in dispatch disabled state)
     522@code{EN_OBJNO} - An object number which could not be accessed on the target node is specified.
     523@code{EN_PAR} - A value outside the range supported by the target node and/or transmission packet format was specified as a parameter (a value outside supported range was specified for waiptn and tmout)
     524@code{EN_RPAR} - A value outside the range supported by the requesting node and/or transmission packet format was specified as a parameter (a value exceeding the range for the requesting node was specified for flgptn)
     525
     526@subheading DESCRIPTION:
     527
     528The @code{wai_flg} system call waits for the eventflag specified by @code{flgid} to be set to satisfy the wait release condition specified by @code{wfmode}.
     529
     530If the eventflag specified by @code{flgid} already satisfies the wait release conditions given by @code{wfmode}, the issuing task will continue execution without waiting.
     531
     532@code{wfmode} may be specified as follows.
     533@example
     534        wfmode := (TWF_ANDW || TWF_ORW) | [TWF_CLR]
     535@end example
     536If @code{TWF_ORW} is specified, the issuing task will wait for any of the bits specified by @code{waiptn} to be set for the eventflag given by @code{flgid} (OR wait).  If @code{TWF_ANDW} is specified, the issuing task will wait for all of the bits specified by @code{waiptn} to be set for the eventflag given by @code{flgid} (AND wait).
     537
     538If the @code{TWF_CLR} specification is not present, the eventflag value will remain unchanged even after the wait conditions have been satisfied and the task has been released from the WAIT state.  If @code{TWF_CLR} is specified, all bits of the eventflag will be cleared to 0 once the wait conditions of the waiting task have been satisfied.
     539
     540The return parameter flgptn returns the value of the eventflag after the wait state of a task has been released due to this system call.  If @code{TWF_CLR} was specified, the value before eventflag bits were cleared is returned.  The value returned by @code{flgptn} fulfills the wait release conditions of this system call.
     541
     542The @code{pol_flg} system call has the same function as @code{wai_flg} except for the waiting feature. @code{pol_flg} polls whether or not the task should wait if @code{wai_flg} is executed.  The meanings of parameters to @code{pol_flg} are the same as for @code{wai_flg}.  The specific operations by @code{pol_flg} are as follows.
     543
     544  - If the target eventflag already satisfies the conditions for releasing wait given by @code{wfmode}, processing is the same as @code{wai_flg}: the eventflag is cleared if @code{TWF_CLR} is specified and the system call completes normally.
     545
     546  - If the target eventflag does not yet satisfy the conditions for releasing wait given by wfmode, an @code{E_TMOUT} error is returned to indicate polling failed and the system call finishes. Unlike @code{wai_flg}, the issuing task does not wait in this case. The eventflag is not cleared in this case even if @code{TWF_CLR} has been specified.
     547
     548The @code{twai_flg} system call has the same function as @code{wai_flg} with an additional timeout feature.  A maximum wait time (timeout value) can be specified using the parameter tmout.  When a timeout is specified, a timeout error, @code{E_TMOUT}, will result and the system call will finish if the period specified by tmout
     549elapses without conditions for releasing wait being satisfied.
     550
     551Specifying @code{TMO_POL = 0} to @code{twai_flg} for tmout indicates that a timeout value of 0 be used, resulting in exactly the same processing as @code{pol_flg}.  Specifying @code{TMO_FEVR = -1} to @code{twai_flg} for tmout indicates that an infinite timeout value be used, resulting in exactly the same processing as @code{wai_flg}.
     552
     553An @code{E_PAR} parameter error will result if @code{waiptn} is 0.
     554
     555A task can not execute any of @code{wai_flg, twai_flg} or @code{pol_flg} on an eventflag having the @code{TA_WSGL} attribute if another task is already waiting for that eventflag.  An @code{E_OBJ} error will be returned to a task which executes @code{wai_flg} at a later time regardless as to whether or not the task that executes @code{wai_flg} or @code{twai_flg} later will be placed in a WAIT state (conditions for releasing wait state be satisfied).  An @code{E_OBJ} error will be returned even to tasks which just execute @code{pol_flg}, again regardless as to whether or not wait release conditions for that task were satisfied.
     556
     557On the other hand, multiple tasks can wait at the same time for the same eventflag if that eventflag has the @code{TA_WMUL} attribute.  This means that event flags can make queues for tasks to wait on.  When such eventflags are used, a single @code{set_flg} call may release multiple waiting tasks.
     558
     559The following processing takes place if a queue for allowing multiple tasks to wait has been created for an eventflag with the @code{TA_WMUL} attribute.
     560
     561  - The waiting order on the queue is FIFO.  (However, depending on @code{waiptn} and @code{wfmode}, task at the head of the queue will not always be released from waiting.)
     562
     563  - If a task specifying that the eventflag be cleared is on the queue, the flag is cleared when that task is released from waiting.
     564
     565  - Since any tasks behind a task which clears the eventflag (by specifying @code{TWF_CLR}) will check the eventflag after it is cleared, they will not be released from waiting.
     566
     567If multiple tasks having the same priority are released from waiting simultaneously due to @code{set_flg}, the order of tasks on the ready queue after release will be the same as their original order on the eventflag queue.
     568
     569@subheading NOTES:
     570 
     571Multiprocessing is not supported. Thus none of the "@code{EN_}" status codes will be returned.
     572
     573@code{Pol_flg} and @code{wai_flg} represent the same processing as specifying certain values (@code{TMO_POL} or @code{TMO_FEVR}) to @code{twai_flg} for tmout.  As such, only @code{twai_flg} is implemented in the kernel; pol_flg and @code{wai_flg} should be implemented as macros which call @code{twai_flg}.
    255574
    256575@c
     
    277596@subheading STATUS CODES:
    278597
    279 @code{EXXX} -
    280 
    281 @subheading DESCRIPTION:
    282 
    283 @subheading NOTES:
    284 
     598@code{E_OK} - Normal Completion
     599@code{E_ID} - Invalid ID number (flgid was invalid or could not be used)
     600@code{E_NOEXS} - Object does not exist (the eventflag specified by flgid does not exist)
     601@code{E_OACV} - Object access violation (A flgid less than -4 was specified from a user task.  This is implementation dependent.)
     602@code{E_PAR} - Parameter error (the packet address for the return parameters could not be used)
     603@code{EN_OBJNO} - An object number which could not be accessed on the target node is specified.
     604@code{EN_CTXID} - Specified an object on another node when the system call was issued from a task in dispatch disabled state or from a task-independent portion
     605@code{EN_RPAR} - A value outside the range supported by the requesting node and/or transmission packet format was returned as a parameter (a value outside supported range was specified for exinf, wtsk and/or flgptn)
     606
     607@subheading DESCRIPTION:
     608
     609This system call refers to the state of the eventflag specified by @code{flgid}, and returns its current flag pattern (@code{flgptn}), waiting task information (@code{wtsk}), and its extended information (@code{exinf}).
     610
     611Depending on the implementation, @code{wtsk} may be returned as the ID (non-zero) of the task waiting for the eventflag.  If there are multiple tasks waiting for the eventflag (only when attribute is @code{TA_WMUL}),
     612the ID of the task at the head of the queue is returned.
     613
     614An @code{E_NOEXS} error will result if the eventflag specified to @code{ref_flg} does not exist.
     615
     616@subheading NOTES:
     617
     618Multiprocessing is not supported. Thus none of the "@code{EN_}" status codes will be returned.
     619
     620Although both @code{ref_flg} and @code{pol_flg} can be used to find an eventflag's pattern (@code{flgptn}) without causing the issuing task to wait, @code{ref_flg} simply reads the eventflag's pattern (@code{flgptn}) while @code{pol_flg} functions is identical to @code{wai_flg} when wait release conditions are satisfied (it clears the eventflag if @code{TWF_CLR} is specified).
     621
     622Depending on the implementation, additional information besides @code{wtsk} and @code{flgptn} (such as eventflag attributes, @code{flgatr}) may also be referred.
     623
Note: See TracChangeset for help on using the changeset viewer.