|##########|
|#MAGIC   #|CLABLNEO
|#PROJECT #|""
|#PATHS   #|"StdProject"
|#FLAGS   #|xx-x-x--x---x-x-----------------
|#USERSW  #|--------------------------------
|#USERMASK#|--------------------------------
|#SWITCHES#|x-xx-x----------
|##########|
DEFINITION MODULE DiskResource;
(* $A- *)

|2.0-Version 01.10.1992

FROM Exec       IMPORT Interrupt,Resource, ResourcePtr,LibraryPtr,List,
                       Message,TaskPtr;
FROM System     IMPORT Regs;


TYPE
  DiscResourceUnit       = RECORD OF Message;
                             discBlock : Interrupt;
                             discSync  : Interrupt;
                             index     : Interrupt
                            END;
  DiscResourceUnitPtr     = POINTER TO DiscResourceUnit;

  DiscResourceFlags       = (alloc0,alloc1,alloc2,alloc3,drf4,drf5,drf6,
                             active);
  DiscResourceFlagSet     = SET OF DiscResourceFlags;

  DiscResource            = RECORD OF Resource;
                              current     : DiscResourceUnitPtr;
                              flags       : DiscResourceFlagSet;
                              pad         : SHORTCARD;
                              sysLib      : LibraryPtr;
                              ciaResource : ResourcePtr;
                              unitId      : ARRAY [alloc0..alloc3] OF LONGCARD;
                              waiting     : List;
                              discBlock   : Interrupt;
                              discSync    : Interrupt;
                              index       : Interrupt;
                              task        : TaskPtr;
                            END;
  DiscResourcePtr         = POINTER TO DiscResource;

CONST
  |Hardware magic
  dskDmaOff     = $4000;

  |Resource-spezifische Kommandos


  |Drive Types
  amiga         = 0;
  drt37422D2S   = $55555555;
  empty         = $FFFFFFFF;
  drt150RPM     = $AAAAAAAA;

VAR
  DiskBase   : DiscResourcePtr;

LIBRARY  DiskBase  BY -6
  PROCEDURE AllocUnit(unitNum  IN D0  : LONGINT):BOOLEAN;

LIBRARY  DiskBase  BY -12
  PROCEDURE FreeUnit(unitNum  IN D0  : LONGINT):LONGINT;

LIBRARY  DiskBase  BY -18
  PROCEDURE GetUnit(unitPointer IN A1 : DiscResourceUnitPtr):DiscResourceUnitPtr;

LIBRARY  DiskBase  BY -30
  PROCEDURE GetUnitID(unitNum  IN D0  : LONGINT):LONGCARD;

LIBRARY  DiskBase  BY -24
  PROCEDURE GiveUnit;

GROUP
  All     = DiscResourceUnit,DiscResourceUnitPtr,DiscResourceFlags,
            DiscResourceFlagSet,DiscResource,DiscResourcePtr,dskDmaOff,
            amiga,drt37422D2S,empty,AllocUnit,FreeUnit,GetUnit,GetUnitID,
            GiveUnit;

END DiskResource.
