home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / i8237A.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  12.0 KB  |  272 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ident    "@(#)/usr/include/sys/i8237A.h.sl 1.1 4.0 12/08/90 10972 AT&T-USL"
  11.  
  12. #ifndef _SYS_I8237A_H
  13. #define    _SYS_I8237A_H
  14.  
  15. #define D37A_MAX_CHAN   8
  16. #define D37A_DFR_ALIGN  0xf
  17. #define D37A_MIN_CHAN   0x0
  18.  
  19. /*
  20.  * Defines for PC AT DMA controllers.
  21.  * The PC AT has two intel 8237A-5 dma controllers with page registers
  22.  * for each channel, allowing access to the entire 16M address space.
  23.  */
  24.  
  25. #define DMACH0PG        0x87    /* port address for dma chan. 0 page reg. */
  26. #define DMACH1PG        0x83    /* port address for dma chan. 1 page reg. */
  27. #define DMACH2PG        0x81    /* port address for dma chan. 2 page reg. */
  28. #define DMACH3PG        0x82    /* port address for dma chan. 3 page reg. */
  29. #define DMACH4PG        0x00    /* dummy address for dma chan. 4 page reg. */
  30. #define DMACH5PG        0x8b    /* port address for dma chan. 5 page reg. */
  31. #define DMACH6PG        0x89    /* port address for dma chan. 6 page reg. */
  32. #define DMACH7PG        0x8a    /* port address for dma chan. 7 page reg. */
  33.  
  34. /*
  35.  * The EISA has a high page address register giving access to the
  36.  *      full 32-bit address space
  37.  */
  38.  
  39. #define DMACH0HPG       0x487   /* port address for dma chan. 0 high page reg */
  40. #define DMACH1HPG       0x483   /* port address for dma chan. 1 high page reg */
  41. #define DMACH2HPG       0x481   /* port address for dma chan. 2 high page reg */
  42. #define DMACH3HPG       0x482   /* port address for dma chan. 3 high page reg */
  43. #define DMACH4HPG       0x000   /* dumy address for dma chan. 4 high page reg */
  44. #define DMACH5HPG       0x48b   /* port address for dma chan. 5 high page reg */
  45. #define DMACH6HPG       0x489   /* port address for dma chan. 6 high page reg */
  46. #define DMACH7HPG       0x48a   /* port address for dma chan. 7 high page reg */
  47.  
  48. /*
  49.  * I/O port addresses for controller 1 programming.
  50.  */
  51. #define DMA1BCA0        0x00    /* chan. 0 base and current address */
  52. #define DMA1BCWC0       0x01    /* chan. 0 base and current word count */
  53. #define DMA1BCA1        0x02    /* chan. 1 base and current address */
  54. #define DMA1BCWC1       0x03    /* chan. 1 base and current word count */
  55. #define DMA1BCA2        0x04    /* chan. 2 base and current address */
  56. #define DMA1BCWC2       0x05    /* chan. 2 base and current word count */
  57. #define DMA1BCA3        0x06    /* chan. 3 base and current address */
  58. #define DMA1BCWC3       0x07    /* chan. 3 base and current word count */
  59. #define DMA1RSWWCR      0x08    /* read status reg/write command reg */
  60. #define DMA1WRR         0x09    /* write request register */
  61. #define DMA1WSMR        0x0a    /* write single mask register bit */
  62. #define DMA1WMR         0x0b    /* write mode register */
  63. #define DMA1CBPFF       0x0c    /* clear byte pointer flip flop */
  64. #define DMA1RTRWMC      0x0d    /* read temp reg/write master clear */
  65. #define DMA1CMR         0x0e    /* clear mask register */
  66. #define DMA1WAMRB       0x0f    /* write all mask register bits */
  67.  
  68. /*
  69.  * I/O port addresses for controller 2 programming.
  70.  */
  71. #define DMA2BCA0        0xc0    /* chan. 0 base and current address */
  72. #define DMA2BCWC0       0xc2    /* chan. 0 base and current word count */
  73. #define DMA2BCA1        0xc4    /* chan. 1 base and current address */
  74. #define DMA2BCWC1       0xc6    /* chan. 1 base and current word count */
  75. #define DMA2BCA2        0xc8    /* chan. 2 base and current address */
  76. #define DMA2BCWC2       0xca    /* chan. 2 base and current word count */
  77. #define DMA2BCA3        0xcc    /* chan. 3 base and current address */
  78. #define DMA2BCWC3       0xce    /* chan. 3 base and current word count */
  79. #define DMA2RSWWCR      0xd0    /* read status reg/write command reg */
  80. #define DMA2WRR         0xd2    /* write request register */
  81. #define DMA2WSMR        0xd4    /* write single mask register bit */
  82. #define DMA2WMR         0xd6    /* write mode register */
  83. #define DMA2CBPFF       0xd8    /* clear byte pointer flip flop */
  84. #define DMA2RTRWMC      0xda    /* read temp reg/write master clear */
  85. #define DMA2CMR         0xdc    /* clear mask register */
  86. #define DMA2WAMRB       0xde    /* write all mask register bits */
  87.  
  88. /*
  89.  * defines for XENIX compatibility
  90.  */
  91.  
  92. /*
  93.  * Intel 8237 DMA Controller.
  94.  */
  95.  
  96. /*
  97.  * DMA I/O Port Assignments.
  98.  */
  99. /* 8 bit channel specific registers on controller 1 */
  100. #define DMA_0ADR        0x00    /* Channel  address register */
  101. #define DMA_0WCNT       0x01    /* Channel  word count */
  102. #define DMA_1ADR        0x02    /* Channel  address register */
  103. #define DMA_1WCNT       0x03    /* Channel  word count */
  104. #define DMA_2ADR        0x04    /* Channel  address register */
  105. #define DMA_2WCNT       0x05    /* Channel  word count */
  106. #define DMA_3ADR        0x06    /* Channel  address register */
  107. #define DMA_3WCNT       0x07    /* Channel  word count */
  108.  
  109. #define DMACH0CCH       0x401   /* chan. 0 base and current count high */
  110. #define DMACH1CCH       0x403   /* chan. 1 base and current count high */
  111. #define DMACH2CCH       0x405   /* chan. 2 base and current count high */
  112. #define DMACH3CCH       0x407   /* chan. 3 base and current count high */
  113.  
  114.  
  115. /* 16 bit channel specific registers on controller 1.
  116.  * Chip A0 connected to bus A1, etc. so even address 
  117.  * increments generated by this controller.  Hence, 
  118.  * 16 bit dma, and only even i/o addresses. Channel 4
  119.  * used to cascade controllers.
  120.  */
  121. #define DMA_4ADR        0xC0    /* (RESERVED) Channel  address register */
  122. #define DMA_4WCNT       0xC2    /* (RESERVED) Channel  word count */
  123. #define DMA_5ADR        0xC4    /* Channel  address register */
  124. #define DMA_5WCNT       0xC6    /* Channel  word count */
  125. #define DMA_6ADR        0xC8    /* Channel  address register */
  126. #define DMA_6WCNT       0xCA    /* Channel  word count */
  127. #define DMA_7ADR        0xCC    /* Channel  address register */
  128. #define DMA_7WCNT       0xCE    /* Channel  word count */
  129.  
  130. #define DMACH4CCH       0x000   /* dummy chan. 0 base and current count high */
  131. #define DMACH5CCH       0x4c6   /* chan. 1 base and current count high */
  132. #define DMACH6CCH       0x4ca   /* chan. 2 base and current count high */
  133. #define DMACH7CCH       0x4ce   /* chan. 3 base and current count high */
  134.  
  135. /* DMA controller 1, 8 bit channels */
  136. #define CTL1_CMD        0x08    /* Command reg */
  137. #define CTL1_REQ        0x09    /* request reg */
  138. #define CTL1_STAT       0x08    /* Status reg */
  139. #define CTL1_MASK       0x0A    /* Mask set/reset register */
  140. #define CTL1_MODE       0x0B    /* Mode reg */
  141. #define CTL1_CLFF       0x0C    /* Clear byte pointer first/last flip-flop */
  142. #define CTL1_ALLMASK    0x0F    /* Mask all registers */
  143.  
  144. #define EISA_DMAIS      0x40a   /* interrupt status regiser */
  145. #define CTL1_SCM        0x40a   /* set chain mode */
  146. #define CTL1_EWM        0x40b   /* extended write mode */
  147.  
  148. /* DMA controller 2, 16 bit channels */
  149. #define CTL2_CMD        0xD0    /* Command reg */
  150. #define CTL2_REQ        0xD2    /* request reg */
  151. #define CTL2_STAT       0xD0    /* Status reg */
  152. #define CTL2_MASK       0xD4    /* Mask set/reset register */
  153. #define CTL2_MODE       0xD6    /* Mode reg */
  154. #define CTL2_CLFF       0xD8    /* Clear byte pointer first/last flip-flop */
  155. #define CTL2_ALLMASK    0xDE    /* Mask all registers */
  156.  
  157. #define CTL2_SCM        0x40a   /* set chain mode */
  158. #define CTL2_EWM        0x40b   /* extended write mode */
  159.  
  160. /* 8 bit channels */
  161. #define DMA_0XADR       0x87    /* Channel 0 address extension reg */
  162. #define DMA_1XADR       0x83    /* Channel 1 address extension reg */
  163. #define DMA_2XADR       0x81    /* Channel 2 address extension reg */
  164. #define DMA_3XADR       0x82    /* Channel 3 address extension reg */
  165.  
  166. /* 16 bit channels */
  167. #define DMA_5XADR       0x8B    /* Channel 5 address extension reg */
  168. #define DMA_6XADR       0x89    /* Channel 6 address extension reg */
  169. #define DMA_7XADR       0x8A    /* Channel 7 address extension reg */
  170.  
  171.  
  172. #define DMA_MSK         0x0A    /* Mask, enable disk, disable others */
  173. #define DMA_CLEAR       0x1A    /* Master clear */
  174. #define IOCR            0x56    /* IO controller */
  175.  
  176. /*
  177.  * DMA Channels. d_chan field of dmareq.
  178.  */
  179.  
  180. #define NCHANS          8
  181.  
  182. /* 8 bit channels */
  183. #define DMA_CH0         0       /* Channel 0 */
  184. #define DMA_CH1         1       /* Channel 1 */
  185. #define DMA_CH2         2       /* Channel 2 */
  186. #define DMA_CH3         3       /* Channel 3 */
  187. /* 16 bit channels */
  188. #define DMA_CH4         4       /* Channel 4 */
  189. #define DMA_CH5         5       /* Channel 5 */
  190. #define DMA_CH6         6       /* Channel 6 */
  191. #define DMA_CH7         7       /* Channel 7 */
  192.  
  193. /*
  194.  * DMA Masks.
  195.  */
  196. #define DMA_SETMSK      4       /* Set mask bit */
  197. #define DMA_CLRMSK      0       /* Clear mask bit */
  198. #define DMA_RD          1
  199. #define DMA_WR          2
  200. #define DMA_VR          0
  201.  
  202. /* from memory to device */
  203. #define DMA_Wrmode      0x48    /* single, read, increment, no auto-init */
  204. /* from device to memory */
  205. #define DMA_Rdmode      0x44    /* single, write, increment, no auto-init */
  206. #define DMA_Nomode      0x0C    /* illegal mode */
  207.  
  208. #define DMAPRI  PRIBIO
  209.  
  210. /* dma_alloc modes */
  211. #define DMA_BLOCK       0       /* blocking task time allocation */
  212. #define DMA_NBLOCK      1       /* non-blocking task time allocation */
  213.  
  214. #define EISA_DMA_8      0       /* 8-bit data path */
  215. #define EISA_DMA_16     1       /* 16-bit data path, word count */
  216. #define EISA_DMA_32     2       /* 32-bit data path */
  217. #define EISA_DMA_16B    3       /* 16-bit data path, byte count */
  218.  
  219. #define EISA_ENCM       4       /* enable chaining mode */
  220. #define EISA_CMOK       8       /* chaining mode completed (OK) */
  221.  
  222.  
  223. /*
  224. Channel Address Array - make's life much easier
  225. */
  226. struct d37A_chan_reg_addr {
  227.         unsigned char   addr_reg;       /* target address register */
  228.         unsigned char   cnt_reg;        /* count register */
  229.         unsigned char   page_reg;       /* page register */
  230.         unsigned char   ff_reg;         /* first-last flipflop */
  231.         unsigned char   cmd_reg;        /* command register */
  232.         unsigned char   mode_reg;       /* mode register */
  233.         unsigned char   mask_reg;       /* mask register */
  234.         unsigned char   stat_reg;       /* status register */
  235.         unsigned char   reqt_reg;       /* request register */
  236.         unsigned short  hpage_reg;      /* high page register */
  237.         unsigned short  hcnt_reg;       /* high count register */
  238.         unsigned short  xmode_reg;      /* extended mode register */
  239.         unsigned short  scm_reg;        /* set chaining mode register */
  240. };
  241.  
  242. /*
  243. macro to initialize array of d37A_chan_reg_addr structures
  244. */
  245. #define D37A_BASE_REGS_VALUES \
  246.         {DMA_0ADR, DMA_0WCNT, DMACH0PG, CTL1_CLFF, \
  247.         CTL1_CMD, CTL1_MODE, CTL1_MASK, CTL1_STAT, CTL1_REQ, \
  248.         DMACH0HPG, DMACH0CCH, CTL1_EWM, CTL1_SCM}, \
  249.         {DMA_1ADR, DMA_1WCNT, DMACH1PG,  CTL1_CLFF, \
  250.         CTL1_CMD, CTL1_MODE, CTL1_MASK, CTL1_STAT, CTL1_REQ, \
  251.         DMACH1HPG, DMACH1CCH, CTL1_EWM, CTL1_SCM}, \
  252.         {DMA_2ADR, DMA_2WCNT, DMACH2PG,  CTL1_CLFF, \
  253.         CTL1_CMD, CTL1_MODE, CTL1_MASK, CTL1_STAT, CTL1_REQ, \
  254.         DMACH2HPG, DMACH2CCH, CTL1_EWM, CTL1_SCM}, \
  255.         {DMA_3ADR, DMA_3WCNT, DMACH3PG,  CTL1_CLFF, \
  256.         CTL1_CMD, CTL1_MODE, CTL1_MASK, CTL1_STAT, CTL1_REQ, \
  257.         DMACH3HPG, DMACH3CCH, CTL1_EWM, CTL1_SCM}, \
  258.         {DMA_4ADR, DMA_4WCNT, DMACH4PG,  CTL2_CLFF, \
  259.         CTL2_CMD, CTL2_MODE, CTL2_MASK, CTL2_STAT, CTL2_REQ, \
  260.         DMACH4HPG, DMACH4CCH, CTL2_EWM, CTL2_SCM}, \
  261.         {DMA_5ADR, DMA_5WCNT, DMACH5PG,  CTL2_CLFF, \
  262.         CTL2_CMD, CTL2_MODE, CTL2_MASK, CTL2_STAT, CTL2_REQ, \
  263.         DMACH5HPG, DMACH5CCH, CTL2_EWM, CTL2_SCM}, \
  264.         {DMA_6ADR, DMA_6WCNT, DMACH6PG,  CTL2_CLFF, \
  265.         CTL2_CMD, CTL2_MODE, CTL2_MASK, CTL2_STAT, CTL2_REQ, \
  266.         DMACH6HPG, DMACH6CCH, CTL2_EWM, CTL2_SCM}, \
  267.         {DMA_7ADR, DMA_7WCNT, DMACH7PG,  CTL2_CLFF, \
  268.         CTL2_CMD, CTL2_MODE, CTL2_MASK, CTL2_STAT, CTL2_REQ, \
  269.         DMACH7HPG, DMACH7CCH, CTL2_EWM, CTL2_SCM}
  270.  
  271. #endif
  272.