gonzui


Format: Advanced Search

mtkernel_3/kernel/tkernel/mempool.hbare sourcepermlink (0.02 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:  *      mempool.h
   16:  *      Variable Size Memory Pool
   17:  */
   18: 
   19: #ifndef _MEMPOOL_H_
   20: #define _MEMPOOL_H_
   21: 
   22: /*
   23:  * Variable size memory pool control block
   24:  *      'areaque' connects memory blocks in address ascending order
   25:  *      'freeque' connects memory blocks in size increasing order
   26:  *
   27:  *  Order of members must not be changed because a part of members
   28:  *  are used with casting to IMACB.
   29:  */
   30: typedef struct memorypool_control_block {
   31:         QUEUE  wait_queue;      /* Memory pool wait queue */
   32:         ID     mplid;              /* Variable size memory pool ID */
   33:         void   *exinf;           /* Extended information */
   34:         ATR    mplatr;            /* Memory pool attribute */
   35:         W      mplsz;               /* Whole memory pool size */
   36:         QUEUE  areaque; /* Queue connecting all blocks */
   37:         QUEUE  freeque; /* Queue connecting free blocks */
   38:         QUEUE  areaque_end;     /* the last element of areaque */
   39:         void   *mempool; /* Top address of memory pool */
   40: #if USE_OBJECT_NAME
   41:         UB     name[OBJECT_NAME_LENGTH];   /* name */
   42: #endif
   43: } MPLCB;
   44: 
   45: IMPORT MPLCB knl_mplcb_table[]; /* Variable size memory pool control block */
   46: IMPORT QUEUE knl_free_mplcb;    /* FreeQue */
   47: 
   48: #define get_mplcb(id)   ( &knl_mplcb_table[INDEX_MPL(id)] )
   49: 
   50: 
   51: /*
   52:  * Maximum free area size
   53:  */
   54: Inline W knl_MaxFreeSize( MPLCB *mplcb )
   55: {
   56:         if ( isQueEmpty(&mplcb->freeque) ) {
   57:                 return 0;
   58:         }
   59:         return FreeSize(mplcb->freeque.prev);
   60: }
   61: 
   62: /*
   63:  * Definition of variable size memory pool wait specification
   64:  */
   65: IMPORT void knl_mpl_wakeup( MPLCB *mplcb );
   66: 
   67: #endif /* _MEMPOOL_H_ */