gonzui


Format: Advanced Search

mtkernel_3/kernel/tkernel/eventflag.hbare sourcepermlink (0.03 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    micro T-Kernel 3.00.00
    4:  *
    5:  *    Copyright (C) 2006-2019 by Ken Sakamura.
    6:  *    This software is distributed under the T-License 2.1.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by TRON Forum(http://www.tron.org) at 2019/12/11.
   10:  *
   11:  *----------------------------------------------------------------------
   12:  */
   13: 
   14: /*
   15:  *      eventflag.h
   16:  *      Event Flag
   17:  */
   18: 
   19: #ifndef _EVENTFLAG_H_
   20: #define _EVENTFLAG_H_
   21: 
   22: /*
   23:  * Event flag control block
   24:  */
   25: typedef struct eventflag_control_block {
   26:         QUEUE  wait_queue;      /* Event flag wait queue */
   27:         ID     flgid;              /* Event flag ID */
   28:         void   *exinf;           /* Extended information */
   29:         ATR    flgatr;            /* Event flag attribute */
   30:         UINT   flgptn;           /* Event flag current pattern */
   31: #if USE_OBJECT_NAME
   32:         UB     name[OBJECT_NAME_LENGTH];   /* name */
   33: #endif
   34: } FLGCB;
   35: 
   36: IMPORT FLGCB knl_flgcb_table[]; /* Event flag control block */
   37: IMPORT QUEUE knl_free_flgcb;    /* FreeQue */
   38: 
   39: #define get_flgcb(id)   ( &knl_flgcb_table[INDEX_FLG(id)] )
   40: 
   41: 
   42: /*
   43:  * Check for event flag wait release condition
   44:  */
   45: Inline BOOL knl_eventflag_cond( FLGCB *flgcb, UINT waiptn, UINT wfmode )
   46: {
   47:         if ( (wfmode & TWF_ORW) != 0 ) {
   48:                 return ( (flgcb->flgptn & waiptn) != 0 );
   49:         } else {
   50:                 return ( (flgcb->flgptn & waiptn) == waiptn );
   51:         }
   52: }
   53: 
   54: 
   55: #endif /* _EVENTFLAG_H_ */