home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / os-include / hardware / cia.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  6KB  |  197 lines

  1. #ifndef    HARDWARE_CIA_H
  2. #define    HARDWARE_CIA_H
  3. /*
  4. **    $VER: cia.h 39.1 (18.9.92)
  5. **    Includes Release 40.15
  6. **
  7. **    registers and bits in the Complex Interface Adapter (CIA) chip
  8. **
  9. **    (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13.  
  14. #ifndef EXEC_TYPES_H
  15. #include "exec/types.h"
  16. #endif /* EXEC_TYPES_H */
  17.  
  18.  
  19.  
  20. /*
  21.  * ciaa is on an ODD address (e.g. the low byte) -- $bfe001
  22.  * ciab is on an EVEN address (e.g. the high byte) -- $bfd000
  23.  *
  24.  * do this to get the definitions:
  25.  *    extern struct CIA ciaa, ciab;
  26.  */
  27.  
  28.  
  29. struct CIA {
  30.     UBYTE   ciapra;
  31.     UBYTE   pad0[0xff];
  32.     UBYTE   ciaprb;
  33.     UBYTE   pad1[0xff];
  34.     UBYTE   ciaddra;
  35.     UBYTE   pad2[0xff];
  36.     UBYTE   ciaddrb;
  37.     UBYTE   pad3[0xff];
  38.     UBYTE   ciatalo;
  39.     UBYTE   pad4[0xff];
  40.     UBYTE   ciatahi;
  41.     UBYTE   pad5[0xff];
  42.     UBYTE   ciatblo;
  43.     UBYTE   pad6[0xff];
  44.     UBYTE   ciatbhi;
  45.     UBYTE   pad7[0xff];
  46.     UBYTE   ciatodlow;
  47.     UBYTE   pad8[0xff];
  48.     UBYTE   ciatodmid;
  49.     UBYTE   pad9[0xff];
  50.     UBYTE   ciatodhi;
  51.     UBYTE   pad10[0xff];
  52.     UBYTE   unusedreg;
  53.     UBYTE   pad11[0xff];
  54.     UBYTE   ciasdr;
  55.     UBYTE   pad12[0xff];
  56.     UBYTE   ciaicr;
  57.     UBYTE   pad13[0xff];
  58.     UBYTE   ciacra;
  59.     UBYTE   pad14[0xff];
  60.     UBYTE   ciacrb;
  61. };
  62.  
  63.  
  64. /* interrupt control register bit numbers */
  65. #define CIAICRB_TA    0
  66. #define CIAICRB_TB    1
  67. #define CIAICRB_ALRM    2
  68. #define CIAICRB_SP    3
  69. #define CIAICRB_FLG    4
  70. #define CIAICRB_IR    7
  71. #define CIAICRB_SETCLR    7
  72.  
  73. /* control register A bit numbers */
  74. #define CIACRAB_START    0
  75. #define CIACRAB_PBON    1
  76. #define CIACRAB_OUTMODE 2
  77. #define CIACRAB_RUNMODE 3
  78. #define CIACRAB_LOAD    4
  79. #define CIACRAB_INMODE    5
  80. #define CIACRAB_SPMODE    6
  81. #define CIACRAB_TODIN    7
  82.  
  83. /* control register B bit numbers */
  84. #define CIACRBB_START    0
  85. #define CIACRBB_PBON    1
  86. #define CIACRBB_OUTMODE 2
  87. #define CIACRBB_RUNMODE 3
  88. #define CIACRBB_LOAD    4
  89. #define CIACRBB_INMODE0 5
  90. #define CIACRBB_INMODE1 6
  91. #define CIACRBB_ALARM    7
  92.  
  93. /* interrupt control register masks */
  94. #define CIAICRF_TA    (1L<<CIAICRB_TA)
  95. #define CIAICRF_TB    (1L<<CIAICRB_TB)
  96. #define CIAICRF_ALRM    (1L<<CIAICRB_ALRM)
  97. #define CIAICRF_SP    (1L<<CIAICRB_SP)
  98. #define CIAICRF_FLG    (1L<<CIAICRB_FLG)
  99. #define CIAICRF_IR    (1L<<CIAICRB_IR)
  100. #define CIAICRF_SETCLR    (1L<<CIAICRB_SETCLR)
  101.  
  102. /* control register A register masks */
  103. #define CIACRAF_START    (1L<<CIACRAB_START)
  104. #define CIACRAF_PBON    (1L<<CIACRAB_PBON)
  105. #define CIACRAF_OUTMODE (1L<<CIACRAB_OUTMODE)
  106. #define CIACRAF_RUNMODE (1L<<CIACRAB_RUNMODE)
  107. #define CIACRAF_LOAD    (1L<<CIACRAB_LOAD)
  108. #define CIACRAF_INMODE    (1L<<CIACRAB_INMODE)
  109. #define CIACRAF_SPMODE    (1L<<CIACRAB_SPMODE)
  110. #define CIACRAF_TODIN    (1L<<CIACRAB_TODIN)
  111.  
  112. /* control register B register masks */
  113. #define CIACRBF_START    (1L<<CIACRBB_START)
  114. #define CIACRBF_PBON    (1L<<CIACRBB_PBON)
  115. #define CIACRBF_OUTMODE (1L<<CIACRBB_OUTMODE)
  116. #define CIACRBF_RUNMODE (1L<<CIACRBB_RUNMODE)
  117. #define CIACRBF_LOAD    (1L<<CIACRBB_LOAD)
  118. #define CIACRBF_INMODE0 (1L<<CIACRBB_INMODE0)
  119. #define CIACRBF_INMODE1 (1L<<CIACRBB_INMODE1)
  120. #define CIACRBF_ALARM    (1L<<CIACRBB_ALARM)
  121.  
  122. /* control register B INMODE masks */
  123. #define CIACRBF_IN_PHI2 0
  124. #define CIACRBF_IN_CNT    (CIACRBF_INMODE0)
  125. #define CIACRBF_IN_TA    (CIACRBF_INMODE1)
  126. #define CIACRBF_IN_CNT_TA  (CIACRBF_INMODE0|CIACRBF_INMODE1)
  127.  
  128. /*
  129.  * Port definitions -- what each bit in a cia peripheral register is tied to
  130.  */
  131.  
  132. /* ciaa port A (0xbfe001) */
  133. #define CIAB_GAMEPORT1    (7)   /* gameport 1, pin 6 (fire button*) */
  134. #define CIAB_GAMEPORT0    (6)   /* gameport 0, pin 6 (fire button*) */
  135. #define CIAB_DSKRDY    (5)   /* disk ready* */
  136. #define CIAB_DSKTRACK0    (4)   /* disk on track 00* */
  137. #define CIAB_DSKPROT    (3)   /* disk write protect* */
  138. #define CIAB_DSKCHANGE    (2)   /* disk change* */
  139. #define CIAB_LED    (1)   /* led light control (0==>bright) */
  140. #define CIAB_OVERLAY    (0)   /* memory overlay bit */
  141.  
  142. /* ciaa port B (0xbfe101) -- parallel port */
  143.  
  144. /* ciab port A (0xbfd000) -- serial and printer control */
  145. #define CIAB_COMDTR    (7)   /* serial Data Terminal Ready* */
  146. #define CIAB_COMRTS    (6)   /* serial Request to Send* */
  147. #define CIAB_COMCD    (5)   /* serial Carrier Detect* */
  148. #define CIAB_COMCTS    (4)   /* serial Clear to Send* */
  149. #define CIAB_COMDSR    (3)   /* serial Data Set Ready* */
  150. #define CIAB_PRTRSEL    (2)   /* printer SELECT */
  151. #define CIAB_PRTRPOUT    (1)   /* printer paper out */
  152. #define CIAB_PRTRBUSY    (0)   /* printer busy */
  153.  
  154. /* ciab port B (0xbfd100) -- disk control */
  155. #define CIAB_DSKMOTOR    (7)   /* disk motorr* */
  156. #define CIAB_DSKSEL3    (6)   /* disk select unit 3* */
  157. #define CIAB_DSKSEL2    (5)   /* disk select unit 2* */
  158. #define CIAB_DSKSEL1    (4)   /* disk select unit 1* */
  159. #define CIAB_DSKSEL0    (3)   /* disk select unit 0* */
  160. #define CIAB_DSKSIDE    (2)   /* disk side select* */
  161. #define CIAB_DSKDIREC    (1)   /* disk direction of seek* */
  162. #define CIAB_DSKSTEP    (0)   /* disk step heads* */
  163.  
  164. /* ciaa port A (0xbfe001) */
  165. #define CIAF_GAMEPORT1    (1L<<7)
  166. #define CIAF_GAMEPORT0    (1L<<6)
  167. #define CIAF_DSKRDY    (1L<<5)
  168. #define CIAF_DSKTRACK0    (1L<<4)
  169. #define CIAF_DSKPROT    (1L<<3)
  170. #define CIAF_DSKCHANGE    (1L<<2)
  171. #define CIAF_LED    (1L<<1)
  172. #define CIAF_OVERLAY    (1L<<0)
  173.  
  174. /* ciaa port B (0xbfe101) -- parallel port */
  175.  
  176. /* ciab port A (0xbfd000) -- serial and printer control */
  177. #define CIAF_COMDTR    (1L<<7)
  178. #define CIAF_COMRTS    (1L<<6)
  179. #define CIAF_COMCD    (1L<<5)
  180. #define CIAF_COMCTS    (1L<<4)
  181. #define CIAF_COMDSR    (1L<<3)
  182. #define CIAF_PRTRSEL    (1L<<2)
  183. #define CIAF_PRTRPOUT    (1L<<1)
  184. #define CIAF_PRTRBUSY    (1L<<0)
  185.  
  186. /* ciab port B (0xbfd100) -- disk control */
  187. #define CIAF_DSKMOTOR    (1L<<7)
  188. #define CIAF_DSKSEL3    (1L<<6)
  189. #define CIAF_DSKSEL2    (1L<<5)
  190. #define CIAF_DSKSEL1    (1L<<4)
  191. #define CIAF_DSKSEL0    (1L<<3)
  192. #define CIAF_DSKSIDE    (1L<<2)
  193. #define CIAF_DSKDIREC    (1L<<1)
  194. #define CIAF_DSKSTEP    (1L<<0)
  195.  
  196. #endif    /* HARDWARE_CIA_H */
  197.