@DATABASE "pExec/Memory.h"
@MASTER   "Work2:AD/IInc/pExec/Memory.h"
@REMARK   This file was created by ADtoHT 2.0 on 11-Mär-97  13:34:27
@REMARK   Do not edit
@REMARK   ADtoHT is © 1993-1995 Christian Stieber

@NODE MAIN "pExec/Memory.h"
@TOC "__pOS_Dev.guide/MAIN"

@{"pExec/Memory.h" LINK File}


@{b}Structures@{ub}

@{"pOS_MemChunk" LINK "pExec/Memory.h/File" 18}  @{"pOS_MemEntry" LINK "pExec/Memory.h/File" 44}  @{"pOS_MemHeader" LINK "pExec/Memory.h/File" 28}  @{"pOS_MemList" LINK "pExec/Memory.h/File" 62}  @{"pOS_MemPool" LINK "pExec/Memory.h/File" 74}

@ENDNODE
@NODE File "pExec/Memory.h"
#ifndef __INC_POS_PEXEC_MEMORY_H
#define __INC_POS_PEXEC_MEMORY_H
/*******************************************************************
 Includes Release 24
 (C) Copyright 1995-1997 proDAD
     All Rights Reserved

 $AUT Holger Burkarth
 $DAT >>Memory.h<<   09 Jan 1997    09:25:25 - (C) ProDAD
*******************************************************************/
#ifndef __INC_POS_PEXEC_LIST_H
#include <@{"pExec/List.h" LINK "pExec/List.h/File"}>
#endif


/*----------------------------------
-----------------------------------*/
struct pOS_MemChunk
{
  struct pOS_MemChunk *mc_Next;  /* pointer to next chunk */
  @{"size_t" LINK "pExec/Types.h/File" 113}               mc_Bytes;  /* chunk byte size */
};



/*----------------------------------
-----------------------------------*/
struct pOS_MemHeader
{
  @{"struct pOS_ExNode" LINK "pExec/List.h/File" 37}    mh_Node;
  @{"UWORD" LINK "pExec/Types.h/File" 93}                mh_Attributes;      /* characteristics of this region */
  @{"struct pOS_MemChunk" LINK File 18} *mh_First;          /* first free region            */
  @{"APTR" LINK "pExec/Types.h/File" 87}                 mh_Lower;           /* lower memory bound           */
  @{"APTR" LINK "pExec/Types.h/File" 87}                 mh_Upper;           /* upper memory bound+1 */
  @{"size_t" LINK "pExec/Types.h/File" 113}               mh_Free;            /* total number of free bytes   */

  @{"UBYTE" LINK "pExec/Types.h/File" 95} mh_Reserved[16];
};



/*----------------------------------
-----------------------------------*/
struct pOS_MemEntry
{
  union
    @{"ULONG" LINK "pExec/Types.h/File" 91}   meu_Reqs;   /* the AllocMem requirements */
    @{"APTR" LINK "pExec/Types.h/File" 87}    meu_Addr;   /* the address of this memory region */
  } me_Un;
  @{"size_t" LINK "pExec/Types.h/File" 113}   me_Length;   /* the length of this memory region */

#define me_Addr  me_Un.meu_Addr
#define me_Reqs  me_Un.meu_Reqs
};




/* Note: sizeof(struct MemList) includes the size of the first MemEntry! */
/*----------------------------------
-----------------------------------*/
struct pOS_MemList
{
  @{"struct pOS_ExNode" LINK "pExec/List.h/File" 37}   ml_Node;
  @{"UWORD" LINK "pExec/Types.h/File" 93}               ml_NumEntries;  /* number of entries in this struct */
  @{"struct pOS_MemEntry" LINK "pExec/Memory.h/File" 44} ml_ME[1];       /* the first entry      */
};




/*----------------------------------
-----------------------------------*/
struct pOS_MemPool
{
  @{"struct pOS_ExList" LINK "pExec/List.h/File" 50} mpl_List;      /* Liste der pOS_MemHeaders */
  @{"size_t" LINK "pExec/Types.h/File" 113}            mpl_SegmSize;  /* standard-size eines Segmentes */
  @{"ULONG" LINK "pExec/Types.h/File" 91}             mpl_SegmFlags; /* Alloc-Flags (enum pOS_MemoryFlag) */

  @{"__ARID__" LINK "pExec/Types.h/File" 155} @{"struct pOS_MemHeader" LINK File 28}* (*mpl_Alloc)(@{"_R_LB" LINK "pExec/Types.h/File" 35} struct pOS_ExecBase*,_R_A0 struct pOS_MemPool*,_R_D0 size_t);
  @{"VOID" LINK "pExec/Types.h/File" 83}                           (*mpl_Free)(@{"_R_LB" LINK "pExec/Types.h/File" 35} struct pOS_ExecBase*,_R_A0 struct pOS_MemPool*,_R_A1 __ARID__ struct pOS_MemHeader*);

  @{"UBYTE" LINK "pExec/Types.h/File" 95}      mpl_Reserved[16];
};





enum pOS_MemoryFlag
{
  MEMF_ANY     =0x00,       /* Any type of memory will do */
  MEMF_PUBLIC  =0x01,

  MEMF_LOCAL   =0x0100,     /* Memory that does not go away at RESET */
  MEMF_VMEM    =0x0200,     /* Virtual-Memory-Manager may be swap memoryblock */

  MEMF_CLEAR   =0x010000,   /* @{"pOS_AllocMem" LINK "pExecD/pOS_AllocMem"}: @{"NULL" LINK "pExec/Types.h/File" 117} out area before return */
  MEMF_LARGEST =0x020000,   /* @{"pOS_AvailMem" LINK "pExecD/pOS_AvailMem"}: return the largest chunk size */
  MEMF_REVERSE =0x040000,   /* @{"pOS_AllocMem" LINK "pExecD/pOS_AllocMem"}: allocate from the top down */
  MEMF_TOTAL   =0x080000,   /* @{"pOS_AvailMem" LINK "pExecD/pOS_AvailMem"}: return total size of memory */

  MEMF_NO_EXPUNGE =0x80000000, /* @{"pOS_AllocMem" LINK "pExecD/pOS_AllocMem"}: Do not cause expunge on failure */

/*----- Current alignment rules for memory blocks (may increase) -----*/
  MEM_BLOCKSIZE  = 8,
  MEM_BLOCKMASK  = (MEM_BLOCKSIZE-1),


  MEMF_CHIP=   0x02,
  MEMF_FAST=   0x04,
};


/** pOS_TypeOfMem(,,enum pOS_TypeOfMemoryMode) **/
enum pOS_TypeOfMemoryMode
{
  TOMEMMD_Physics =0, /* Result: MEMF_FAST or MEMF_CHIP, @{"NULL" LINK "pExec/Types.h/File" 117} => error (wrong address) */
};






#endif
@ENDNODE
