home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / DC-POS24.LZX / pOS / IncPOS.lzx / pExec / Memory.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-18  |  3.5 KB  |  127 lines

  1. #ifndef __INC_POS_PEXEC_MEMORY_H
  2. #define __INC_POS_PEXEC_MEMORY_H
  3. /*******************************************************************
  4.  Includes Release 24
  5.  (C) Copyright 1995-1997 proDAD
  6.      All Rights Reserved
  7.  
  8.  $AUT Holger Burkarth
  9.  $DAT >>Memory.h<<   09 Jan 1997    09:25:25 - (C) ProDAD
  10. *******************************************************************/
  11. #ifndef __INC_POS_PEXEC_LIST_H
  12. #include <pExec/List.h>
  13. #endif
  14.  
  15.  
  16. /*----------------------------------
  17. -----------------------------------*/
  18. struct pOS_MemChunk
  19. {
  20.   struct pOS_MemChunk *mc_Next;  /* pointer to next chunk */
  21.   size_t               mc_Bytes;  /* chunk byte size */
  22. };
  23.  
  24.  
  25.  
  26. /*----------------------------------
  27. -----------------------------------*/
  28. struct pOS_MemHeader
  29. {
  30.   struct pOS_ExNode    mh_Node;
  31.   UWORD                mh_Attributes;      /* characteristics of this region */
  32.   struct pOS_MemChunk *mh_First;          /* first free region            */
  33.   APTR                 mh_Lower;           /* lower memory bound           */
  34.   APTR                 mh_Upper;           /* upper memory bound+1 */
  35.   size_t               mh_Free;            /* total number of free bytes   */
  36.  
  37.   UBYTE mh_Reserved[16];
  38. };
  39.  
  40.  
  41.  
  42. /*----------------------------------
  43. -----------------------------------*/
  44. struct pOS_MemEntry
  45. {
  46.   union {
  47.     ULONG   meu_Reqs;   /* the AllocMem requirements */
  48.     APTR    meu_Addr;   /* the address of this memory region */
  49.   } me_Un;
  50.   size_t   me_Length;   /* the length of this memory region */
  51.  
  52. #define me_Addr  me_Un.meu_Addr
  53. #define me_Reqs  me_Un.meu_Reqs
  54. };
  55.  
  56.  
  57.  
  58.  
  59. /* Note: sizeof(struct MemList) includes the size of the first MemEntry! */
  60. /*----------------------------------
  61. -----------------------------------*/
  62. struct pOS_MemList
  63. {
  64.   struct pOS_ExNode   ml_Node;
  65.   UWORD               ml_NumEntries;  /* number of entries in this struct */
  66.   struct pOS_MemEntry ml_ME[1];       /* the first entry      */
  67. };
  68.  
  69.  
  70.  
  71.  
  72. /*----------------------------------
  73. -----------------------------------*/
  74. struct pOS_MemPool
  75. {
  76.   struct pOS_ExList mpl_List;      /* Liste der pOS_MemHeaders */
  77.   size_t            mpl_SegmSize;  /* standard-size eines Segmentes */
  78.   ULONG             mpl_SegmFlags; /* Alloc-Flags (enum pOS_MemoryFlag) */
  79.  
  80.   __ARID__ struct pOS_MemHeader* (*mpl_Alloc)(_R_LB struct pOS_ExecBase*,_R_A0 struct pOS_MemPool*,_R_D0 size_t);
  81.   VOID                           (*mpl_Free)(_R_LB struct pOS_ExecBase*,_R_A0 struct pOS_MemPool*,_R_A1 __ARID__ struct pOS_MemHeader*);
  82.  
  83.   UBYTE      mpl_Reserved[16];
  84. };
  85.  
  86.  
  87.  
  88.  
  89.  
  90. enum pOS_MemoryFlag
  91. {
  92.   MEMF_ANY     =0x00,       /* Any type of memory will do */
  93.   MEMF_PUBLIC  =0x01,
  94.  
  95.   MEMF_LOCAL   =0x0100,     /* Memory that does not go away at RESET */
  96.   MEMF_VMEM    =0x0200,     /* Virtual-Memory-Manager may be swap memoryblock */
  97.  
  98.   MEMF_CLEAR   =0x010000,   /* pOS_AllocMem: NULL out area before return */
  99.   MEMF_LARGEST =0x020000,   /* pOS_AvailMem: return the largest chunk size */
  100.   MEMF_REVERSE =0x040000,   /* pOS_AllocMem: allocate from the top down */
  101.   MEMF_TOTAL   =0x080000,   /* pOS_AvailMem: return total size of memory */
  102.  
  103.   MEMF_NO_EXPUNGE =0x80000000, /* pOS_AllocMem: Do not cause expunge on failure */
  104.  
  105. /*----- Current alignment rules for memory blocks (may increase) -----*/
  106.   MEM_BLOCKSIZE  = 8,
  107.   MEM_BLOCKMASK  = (MEM_BLOCKSIZE-1),
  108.  
  109.  
  110.   MEMF_CHIP=   0x02,
  111.   MEMF_FAST=   0x04,
  112. };
  113.  
  114.  
  115. /** pOS_TypeOfMem(,,enum pOS_TypeOfMemoryMode) **/
  116. enum pOS_TypeOfMemoryMode
  117. {
  118.   TOMEMMD_Physics =0, /* Result: MEMF_FAST or MEMF_CHIP, NULL => error (wrong address) */
  119. };
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126. #endif
  127.