home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D3.DMS / in.adf / Interfaces / Expansion.mod < prev    next >
Encoding:
Text File  |  1993-05-22  |  6.4 KB  |  137 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                                                                         *)
  3. (*  Amiga Oberon Interface Module:                    Date: 02-Nov-92      *)
  4. (*                                                                         *)
  5. (*   © 1992 by Fridtjof Siebert                                            *)
  6. (*                                                                         *)
  7. (*-------------------------------------------------------------------------*)
  8.  
  9. MODULE Expansion;
  10.  
  11. IMPORT e * := Exec,
  12.        d * := Dos,
  13.        c * := Config;
  14.  
  15. CONST
  16.   expansionName * = "expansion.library";
  17.  
  18. (* flags for the AddDosNode() call *)
  19.   startProc * = 0;
  20.  
  21. TYPE
  22.  
  23. (* BootNodes are scanned by dos.library at startup.  Items found on the
  24.    list are started by dos. BootNodes are added with the AddDosNode() or
  25.    the V36 AddBootNode() calls. *)
  26.  
  27.   BootNodePtr * = UNTRACED POINTER TO BootNode;
  28.   BootNode * = STRUCT (node* : e.Node)
  29.     flags * : SET;
  30.     deviceNode* : e.NodePtr;
  31.   END;
  32.  
  33.  
  34. (* expansion.library has functions to manipulate most of the information in
  35.    ExpansionBase.  Direct access is not permitted.  Use FindConfigDev()
  36.    to scan the board list. *)
  37.  
  38.   ExpansionBasePtr * = UNTRACED POINTER TO ExpansionBase;
  39.   ExpansionBase * = STRUCT (libNode * : e.Library)
  40.     flags * : SHORTSET;             (* read only (see below) *)
  41.     private01 * : e.BYTE;           (* private *)
  42.     private02 * : LONGINT;          (* private *)
  43.     private03 * : LONGINT;          (* private *)
  44.     private04 * : c.CurrentBinding; (* private *)
  45.     private05 * : e.List;           (* private *)
  46.     mountList * : e.List;           (* contains struct BootNode entries *)
  47.     (* private *)
  48.   END;
  49.  
  50. CONST
  51.  
  52. (* error codes *)
  53.   ok          * = 0;
  54.   lastBoard   * = 40;  (* could not shut him up *)
  55.   noExpansion * = 41;  (* not enough expansion mem; board shut up *)
  56.   noMemory    * = 42;  (* not enough normal memory *)
  57.   noBoard     * = 43;  (* no board at that address *)
  58.   badMem      * = 44;  (* tried to add bad memory card *)
  59.  
  60. (* Flags *)
  61.   ebClogged    * = 0;       (* someone could not be shutup *)
  62.   ebShortMem   * = 1;       (* ran out of expansion mem *)
  63.   ebBadMem     * = 2;       (* tried to add bad memory card *)
  64.   ebDosFlag    * = 3;       (* reserved for use by AmigaDOS *)
  65.   ebKickBack33 * = 4;       (* reserved for use by AmigaDOS *)
  66.   ebKickBack36 * = 5;       (* reserved for use by AmigaDOS *)
  67. (* If the following flag is set by a floppy's bootblock code, the initial
  68.    open of the initial shell window will be delayed until the first output
  69.    to that shell.  Otherwise the 1.3 compatible behavior applies. *)
  70.   ebSilentStart* = 6;
  71.  
  72.  
  73. VAR
  74.   base * : ExpansionBasePtr;
  75.  
  76. (*--- functions in V33 or higher (distributed as Release 1.2) ---*)
  77. PROCEDURE AddConfigDev        *{base,- 30}(configDev{8}      : c.ConfigDevPtr);
  78. (* ---   functions in V36 or higher  (distributed as Release 2.0)   --- *)
  79. (* --- REMEMBER: You are to check the version BEFORE you use this ! --- *)
  80. PROCEDURE AddBootNode         *{base,- 36}(bootPri{0}        : LONGINT;
  81.                                            flags{1}          : LONGSET;
  82.                                            deviceNode{8}     : d.DeviceNodePtr;
  83.                                            configDev{9}      : c.ConfigDevPtr): BOOLEAN;
  84. (*--- functions in V33 or higher (distributed as Release 1.2) ---*)
  85. PROCEDURE AllocBoardMem       *{base,- 42}(slotSpec{0}       : LONGINT);
  86. PROCEDURE AllocConfigDev      *{base,- 48}(): c.ConfigDevPtr;
  87. PROCEDURE AllocExpansionMem   *{base,- 54}(numSlots{0}       : LONGINT;
  88.                                            slotAlign{1}      : LONGINT): e.APTR;
  89. PROCEDURE ConfigBoard         *{base,- 60}(board{8}          : e.APTR;
  90.                                            configDev{9}      : c.ConfigDevPtr);
  91. PROCEDURE ConfigChain         *{base,- 66}(baseAddr{8}       : e.APTR);
  92. PROCEDURE FindConfigDev       *{base,- 72}(oldConfigDev{8}   : c.ConfigDevPtr;
  93.                                            manufacturer{0}   : LONGINT;
  94.                                            product{1}        : LONGINT): c.ConfigDevPtr;
  95. PROCEDURE FreeBoardMem        *{base,- 78}(startSlot{0}      : LONGINT;
  96.                                            slotSepc{1}       : LONGINT);
  97. PROCEDURE FreeConfigDev       *{base,- 84}(configDev{8}      : c.ConfigDevPtr);
  98. PROCEDURE FreeExpansionMem    *{base,- 90}(startSlot{0}      : LONGINT;
  99.                                            numSlots{1}       : LONGINT);
  100. PROCEDURE ReadExpansionByte   *{base,- 96}(board{8}          : e.APTR;
  101.                                            offset{0}         : LONGINT): e.BYTE;
  102. PROCEDURE ReadExpansionRom    *{base,-102}(board{8}          : e.APTR;
  103.                                            configDev{9}      : c.ConfigDevPtr);
  104. PROCEDURE RemConfigDev        *{base,-108}(configDev{8}      : c.ConfigDevPtr);
  105. PROCEDURE WriteExpansionByte  *{base,-114}(board{8}          : e.APTR;
  106.                                            offset{0}         : LONGINT;
  107.                                            byte{1}           : e.BYTE);
  108. PROCEDURE ObtainConfigBinding *{base,-120}();
  109. PROCEDURE ReleaseConfigBinding*{base,-126}();
  110. PROCEDURE SetCurrentBinding   *{base,-132}(currentBinding{8} : c.CurrentBindingPtr;
  111.                                            size{0}           : LONGINT);
  112. PROCEDURE GetCurrentBinding   *{base,-138}(currentBinding{8} : c.CurrentBindingPtr;
  113.                                            bindingSize{0}    : LONGINT): LONGINT;
  114. PROCEDURE MakeDosNode         *{base,-144}(parmPacket{8}     : e.APTR): d.DeviceNodePtr;
  115. PROCEDURE AddDosNode          *{base,-150}(bootPri{0}        : LONGINT;
  116.                                            flags{1}          : LONGSET;
  117.                                            deviceNode{8}     : d.DeviceNodePtr): BOOLEAN;
  118. (* ---   functions in V36 or higher  (distributed as Release 2.0)   --- *)
  119. (* --- REMEMBER: You are to check the version BEFORE you use this ! --- *)
  120. PROCEDURE ExpansionResrved26  *{base,-156}();
  121. PROCEDURE WriteExpansionWord  *{base,-162}(board{8}          : e.APTR;
  122.                                            offset{0}         : LONGINT;
  123.                                            word{1}           : INTEGER);
  124.  
  125.  
  126. (* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
  127.  
  128. BEGIN
  129.   base :=   e.OpenLibrary(expansionName,33);
  130.   IF base = NIL THEN HALT(0) END;
  131.  
  132. CLOSE
  133.   IF base#NIL THEN e.CloseLibrary(base) END;
  134.  
  135. END Expansion.
  136.  
  137.