home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD1.3 / Includes / libraries / configregs.h next >
Encoding:
C/C++ Source or Header  |  1992-09-12  |  7.0 KB  |  233 lines

  1. #ifndef LIBRARIES_CONFIGREGS_H
  2. #define LIBRARIES_CONFIGREGS_H
  3. /*
  4. **    $Filename: libraries/configregs.h $
  5. **    $Release: 1.3 $
  6. **
  7. **    register and bit definitions for expansion boards 
  8. **
  9. **    (C) Copyright 1986,1987,1988 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include "exec/types.h"
  15. #endif    !EXEC_TYPES_H
  16.  
  17. /*
  18. ** Expansion boards are actually organized such that only one nibble per
  19. ** word (16 bits) are valid information.  This table is structured
  20. ** as LOGICAL information.  This means that it never corresponds
  21. ** exactly with a physical implementation.
  22. **
  23. ** The expansion space is logically split into two regions:
  24. ** a rom portion and a control portion.     The rom portion is
  25. ** actually stored in one's complement form (except for the
  26. ** er_type field).
  27. */
  28.  
  29.  
  30. struct ExpansionRom {
  31.     UBYTE    er_Type;
  32.     UBYTE    er_Product;
  33.     UBYTE    er_Flags;
  34.     UBYTE    er_Reserved03;
  35.     UWORD    er_Manufacturer;
  36.     ULONG    er_SerialNumber;
  37.     UWORD    er_InitDiagVec;
  38.     UBYTE    er_Reserved0c;
  39.     UBYTE    er_Reserved0d;
  40.     UBYTE    er_Reserved0e;
  41.     UBYTE    er_Reserved0f;
  42. };
  43.  
  44. struct ExpansionControl {
  45.     UBYTE    ec_Interrupt;        /* interrupt control register */
  46.     UBYTE    ec_Reserved11;
  47.     UBYTE    ec_BaseAddress;        /* set new config address */
  48.     UBYTE    ec_Shutup;        /* don't respond, pass config out */
  49.     UBYTE    ec_Reserved14;
  50.     UBYTE    ec_Reserved15;
  51.     UBYTE    ec_Reserved16;
  52.     UBYTE    ec_Reserved17;
  53.     UBYTE    ec_Reserved18;
  54.     UBYTE    ec_Reserved19;
  55.     UBYTE    ec_Reserved1a;
  56.     UBYTE    ec_Reserved1b;
  57.     UBYTE    ec_Reserved1c;
  58.     UBYTE    ec_Reserved1d;
  59.     UBYTE    ec_Reserved1e;
  60.     UBYTE    ec_Reserved1f;
  61. };
  62.  
  63. /*
  64. ** many of the constants below consist of a triplet of equivalent
  65. ** definitions: xxMASK is a bit mask of those bits that matter.
  66. ** xxBIT is the starting bit number of the field.  xxSIZE is the
  67. ** number of bits that make up the definition.    This method is
  68. ** used when the field is larger than one bit.
  69. **
  70. ** If the field is only one bit wide then the xxB_xx and xxF_xx convention
  71. ** is used (xxB_xx is the bit number, and xxF_xx is mask of the bit).
  72. */
  73.  
  74. /* manifest constants */
  75. #define E_SLOTSIZE        0x10000
  76. #define E_SLOTMASK        0xffff
  77. #define E_SLOTSHIFT        16
  78.  
  79. /* these define the two free regions of Zorro memory space.
  80. ** THESE MAY WELL CHANGE FOR FUTURE PRODUCTS!
  81. */
  82. #define E_EXPANSIONBASE        0xe80000
  83. #define E_EXPANSIONSIZE        0x080000
  84. #define E_EXPANSIONSLOTS    8
  85.  
  86. #define E_MEMORYBASE        0x200000
  87. #define E_MEMORYSIZE        0x800000
  88. #define E_MEMORYSLOTS        128
  89.  
  90.  
  91.  
  92. /****** ec_Type definitions */
  93.  
  94. /* board type -- ignore "old style" boards */
  95. #define ERT_TYPEMASK        0xc0
  96. #define ERT_TYPEBIT        6
  97. #define ERT_TYPESIZE        2
  98. #define ERT_NEWBOARD        0xc0
  99.  
  100.  
  101. /* type field memory size */
  102. #define ERT_MEMMASK        0x07
  103. #define ERT_MEMBIT        0
  104. #define ERT_MEMSIZE        3
  105.  
  106.  
  107. /* other bits defined in type field */
  108. #define ERTB_CHAINEDCONFIG    3
  109. #define ERTB_DIAGVALID        4
  110. #define ERTB_MEMLIST        5
  111.  
  112. #define ERTF_CHAINEDCONFIG    (1<<3)
  113. #define ERTF_DIAGVALID        (1<<4)
  114. #define ERTF_MEMLIST        (1<<5)
  115.  
  116.  
  117. /* er_Flags byte -- for those things that didn't fit into the type byte */
  118. #define ERFB_MEMSPACE        7    /* wants to be in 8 meg space.    Also
  119.                     ** implies that board is moveable
  120.                     */
  121. #define ERFB_NOSHUTUP        6    /* board can't be shut up.  Must not
  122.                     ** be a board.    Must be a box that
  123.                     ** does not pass on the bus.
  124.                     */
  125.  
  126. #define ERFF_MEMSPACE        (1<<7)
  127. #define ERFF_NOSHUTUP        (1<<6)
  128.  
  129.  
  130. /* figure out amount of memory needed by this box/board */
  131. #define ERT_MEMNEEDED(t)    \
  132.     (((t)&ERT_MEMMASK)? 0x10000 << (((t)&ERT_MEMMASK) -1) : 0x800000 )
  133.  
  134. /* same as ERT_MEMNEEDED, but return number of slots */
  135. #define ERT_SLOTSNEEDED(t)    \
  136.     (((t)&ERT_MEMMASK)? 1 << (((t)&ERT_MEMMASK)-1) : 0x80 )
  137.  
  138. /* interrupt control register */
  139. #define ECIB_INTENA        1
  140. #define ECIB_RESET        3
  141. #define ECIB_INT2PEND        4
  142. #define ECIB_INT6PEND        5
  143. #define ECIB_INT7PEND        6
  144. #define ECIB_INTERRUPTING    7
  145.  
  146. #define ECIF_INTENA        (1<<1)
  147. #define ECIF_RESET        (1<<3)
  148. #define ECIF_INT2PEND        (1<<4)
  149. #define ECIF_INT6PEND        (1<<5)
  150. #define ECIF_INT7PEND        (1<<6)
  151. #define ECIF_INTERRUPTING    (1<<7)
  152.  
  153.  
  154. /* convert a expantion slot number into a memory address */
  155. #define EC_MEMADDR(slot)        ((slot) << (E_SLOTSHIFT) )
  156.  
  157. /* a kludge to get the byte offset of a structure */
  158. #define EROFFSET(er)    ((int)&((struct ExpansionRom *)0)->er)
  159. #define ECOFFSET(ec)    \
  160.  (sizeof(struct ExpansionRom)+((int)&((struct ExpansionControl *)0)->ec))
  161.  
  162.  
  163. /***************************************************************************
  164. **
  165. ** these are the specifications for the diagnostic area.  If the Diagnostic
  166. ** Address Valid bit is set in the Board Type byte (the first byte in
  167. ** expansion space) then the Diag Init vector contains a valid offset.
  168. **
  169. ** The Diag Init vector is actually a word offset from the base of the
  170. ** board.  The resulting address points to the base of the DiagArea
  171. ** structure.  The structure may be physically implemented either four,
  172. ** eight, or sixteen bits wide.     The code will be copied out into
  173. ** ram first before being called.
  174. **
  175. ** The da_Size field, and both code offsets (da_DiagPoint and da_BootPoint)
  176. ** are offsets from the diag area AFTER it has been copied into ram, and
  177. ** "de-nibbleized" (if needed).     Inotherwords, the size is the size of
  178. ** the actual information, not how much address space is required to
  179. ** store it.
  180. **
  181. ** All bits are encoded with uninverted logic (e.g. 5 volts on the bus
  182. ** is a logic one).
  183. **
  184. ** If your board is to make use of the boot facility then it must leave
  185. ** its config area available even after it has been configured.     Your
  186. ** boot vector will be called AFTER your board's final address has been
  187. ** set.
  188. **
  189. ****************************************************************************/
  190.  
  191. struct DiagArea {
  192.     UBYTE    da_Config;    /* see below for definitions */
  193.     UBYTE    da_Flags;    /* see below for definitions */
  194.     UWORD    da_Size;    /* the size (in bytes) of the total diag area */
  195.     UWORD    da_DiagPoint;    /* where to start for diagnostics, or zero */
  196.     UWORD    da_BootPoint;    /* where to start for booting */
  197.     UWORD    da_Name;    /* offset in diag area where a string */
  198.                 /*   identifier can be found (or zero if no */
  199.                 /*   identifier is present). */
  200.  
  201.     UWORD    da_Reserved01;    /* two words of reserved data.    must be zero. */
  202.     UWORD    da_Reserved02;
  203. };
  204.  
  205. /* da_Config definitions */
  206. #define DAC_BUSWIDTH    0xC0    /* two bits for bus width */
  207. #define DAC_NIBBLEWIDE    0x00
  208. #define DAC_BYTEWIDE    0x40
  209. #define DAC_WORDWIDE    0x80
  210.  
  211. #define DAC_BOOTTIME    0x30    /* two bits for when to boot */
  212. #define DAC_NEVER    0x00    /* obvious */
  213. #define DAC_CONFIGTIME    0x10    /* call da_BootPoint when first configing the */
  214.                 /*   the device */
  215. #define DAC_BINDTIME    0x20    /* run when binding drivers to boards */
  216.  
  217. /*
  218. ** These are the calling conventions for Diag or Boot area
  219. **
  220. ** A7 -- points to at least 2K of stack
  221. ** A6 -- ExecBase
  222. ** A5 -- ExpansionBase
  223. ** A3 -- your board's ConfigDev structure
  224. ** A2 -- Base of diag/init area that was copied
  225. ** A0 -- Base of your board
  226. **
  227. ** Your board should return a value in D0.  If this value is NULL, then
  228. ** the diag/init area that was copied in will be returned to the free
  229. ** memory pool.
  230. */
  231.  
  232. #endif    /* LIBRARIES_CONFIGREGS_H */
  233.