gonzui


Format: Advanced Search

mtkernel_3/kernel/tkernel/rendezvous.hbare sourcepermlink (0.01 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:  *      rendezvous.h
   16:  *      Rendezvous
   17:  */
   18: 
   19: #ifndef _RENDEZVOUS_H_
   20: #define _RENDEZVOUS_H_
   21: 
   22: /*
   23:  * Rendezvous port control block
   24:  */
   25: typedef struct port_control_block {
   26:         QUEUE  call_queue;      /* Port call wait queue */
   27:         ID     porid;              /* Port ID */
   28:         void   *exinf;           /* Extended information */
   29:         ATR    poratr;            /* Port attribute */
   30:         QUEUE  accept_queue;    /* Port accept wait queue */
   31:         INT    maxcmsz;   /* Maximum length of call message */
   32:         INT    maxrmsz;   /* Maximum length of reply message */
   33: #if USE_OBJECT_NAME
   34:         UB     name[OBJECT_NAME_LENGTH];   /* name */
   35: #endif
   36: } PORCB;
   37: /** [END Common Definitions] */
   38: 
   39: IMPORT PORCB knl_porcb_table[]; /* Rendezvous port control block */
   40: IMPORT QUEUE knl_free_porcb;    /* FreeQue */
   41: 
   42: #define get_porcb(id)   ( &knl_porcb_table[INDEX_POR(id)] )
   43: 
   44: #if USE_LEGACY_API
   45: 
   46: #define RDVNO_SHIFT     (sizeof(RNO)*8/2)
   47: 
   48: /*
   49:  * Create rendezvous number
   50:  */
   51: Inline RNO knl_gen_rdvno( TCB *tcb )
   52: {
   53:         RNO    rdvno;
   54: 
   55:         rdvno = tcb->wrdvno;
   56:         tcb->wrdvno += (1U << RDVNO_SHIFT);
   57: 
   58:         return rdvno;
   59: }
   60: 
   61: /*
   62:  * Get task ID from rendezvous number 
   63:  */
   64: Inline ID knl_get_tskid_rdvno( RNO rdvno )
   65: {
   66:         return (ID)((UINT)rdvno & ((1U << RDVNO_SHIFT) - 1));
   67: }
   68: 
   69: /*
   70:  * Check validity of rendezvous number
   71:  */
   72: #define CHECK_RDVNO(rdvno) {                                    \
   73:         if ( !CHK_TSKID(knl_get_tskid_rdvno(rdvno)) ) {                \
   74:                 return E_OBJ;                                 \
   75:         }                                                      \
   76: }
   77: 
   78: #endif  /* USE_LEGACY_API */
   79: 
   80: /*
   81:  * Definition of rendezvous wait specification
   82:  */
   83: IMPORT CONST WSPEC knl_wspec_cal_tfifo;
   84: IMPORT CONST WSPEC knl_wspec_cal_tpri;
   85: IMPORT CONST WSPEC knl_wspec_rdv;
   86: 
   87: 
   88: #endif /* _RENDEZVOUS_H_ */