home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / include / sys / dma.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-26  |  6.7 KB  |  180 lines

  1. /*    Copyright (c) 1984, 1986, 1987, 1988 AT&T    */
  2. /*      All Rights Reserved      */
  3.  
  4. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  5. /*    The copyright notice above does not evidence any       */
  6. /*    actual or intended publication of such source code.    */
  7.  
  8. /*    Copyright (c) 1987, 1988 Microsoft Corporation    */
  9. /*      All Rights Reserved    */
  10.  
  11. /*    This Module contains Proprietary Information of Microsoft  */
  12. /*    Corporation and should be treated as Confidential.       */
  13.  
  14. #ident    "@(#)head.sys:dma.h    1.4"
  15.  
  16. /*
  17.  * Defines for PC AT DMA controllers.
  18.  * The PC AT has two intel 8237A-5 dma controllers with page registers
  19.  * for each channel, allowing access to the entire 16M address space.
  20.  */
  21.  
  22. #define    DMACH0PG    0x87    /* port address for dma chan. 0 page reg. */
  23. #define    DMACH1PG    0x83    /* port address for dma chan. 1 page reg. */
  24. #define    DMACH2PG    0x81    /* port address for dma chan. 2 page reg. */
  25. #define    DMACH3PG    0x82    /* port address for dma chan. 3 page reg. */
  26. #define    DMACH5PG    0x8b    /* port address for dma chan. 5 page reg. */
  27. #define    DMACH6PG    0x89    /* port address for dma chan. 6 page reg. */
  28. #define    DMACH7PG    0x8a    /* port address for dma chan. 7 page reg. */
  29.  
  30. /*
  31.  * I/O port addresses for controller 1 programming.
  32.  */
  33. #define    DMA1BCA0    0x00    /* chan. 0 base and current address */
  34. #define    DMA1BCWC0    0x01    /* chan. 0 base and current word count */
  35. #define    DMA1BCA1    0x02    /* chan. 1 base and current address */
  36. #define    DMA1BCWC1    0x03    /* chan. 1 base and current word count */
  37. #define    DMA1BCA2    0x04    /* chan. 2 base and current address */
  38. #define    DMA1BCWC2    0x05    /* chan. 2 base and current word count */
  39. #define    DMA1BCA3    0x06    /* chan. 3 base and current address */
  40. #define    DMA1BCWC3    0x07    /* chan. 3 base and current word count */
  41. #define DMA1RSWWCR    0x08    /* read status reg/write command reg */
  42. #define    DMA1WRR        0x09    /* write request register */
  43. #define    DMA1WSMR    0x0a    /* write single mask register bit */
  44. #define    DMA1WMR        0x0b    /* write mode register */
  45. #define    DMA1CBPFF    0x0c    /* clear byte pointer flip flop */
  46. #define    DMA1RTRWMC    0x0d    /* read temp reg/write master clear */
  47. #define    DMA1CMR        0x0e    /* clear mask register */
  48. #define    DMA1WAMRB    0x0f    /* write all mask register bits */
  49.  
  50. /*
  51.  * I/O port addresses for controller 2 programming.
  52.  */
  53. #define    DMA2BCA0    0xc0    /* chan. 0 base and current address */
  54. #define    DMA2BCWC0    0xc2    /* chan. 0 base and current word count */
  55. #define    DMA2BCA1    0xc4    /* chan. 1 base and current address */
  56. #define    DMA2BCWC1    0xc6    /* chan. 1 base and current word count */
  57. #define    DMA2BCA2    0xc8    /* chan. 2 base and current address */
  58. #define    DMA2BCWC2    0xca    /* chan. 2 base and current word count */
  59. #define    DMA2BCA3    0xcc    /* chan. 3 base and current address */
  60. #define    DMA2BCWC3    0xce    /* chan. 3 base and current word count */
  61. #define DMA2RSWWCR    0xd0    /* read status reg/write command reg */
  62. #define    DMA2WRR        0xd2    /* write request register */
  63. #define    DMA2WSMR    0xd4    /* write single mask register bit */
  64. #define    DMA2WMR        0xd6    /* write mode register */
  65. #define    DMA2CBPFF    0xd8    /* clear byte pointer flip flop */
  66. #define    DMA2RTRWMC    0xda    /* read temp reg/write master clear */
  67. #define    DMA2CMR        0xdc    /* clear mask register */
  68. #define    DMA2WAMRB    0xde    /* write all mask register bits */
  69.  
  70. /*
  71.  * defines for XENIX compatibility
  72.  */
  73.  
  74. /*
  75.  * Intel 8237 DMA Controller.
  76.  */
  77.  
  78. /*
  79.  * DMA I/O Port Assignments.
  80.  */
  81. /* 8 bit channel specific registers on controller 1 */
  82. #define DMA_0ADR     0x00    /* Channel  address register */
  83. #define DMA_0WCNT     0x01    /* Channel  word count */
  84. #define DMA_1ADR     0x02    /* Channel  address register */
  85. #define DMA_1WCNT     0x03    /* Channel  word count */
  86. #define DMA_2ADR     0x04    /* Channel  address register */
  87. #define DMA_2WCNT     0x05    /* Channel  word count */
  88. #define DMA_3ADR     0x06    /* Channel  address register */
  89. #define DMA_3WCNT     0x07    /* Channel  word count */
  90.  
  91. /* 16 bit channel specific registers on controller 1.
  92.  * Chip A0 connected to bus A1, etc. so even address 
  93.  * increments generated by this controller.  Hence, 
  94.  * 16 bit dma, and only even i/o addresses. Channel 4
  95.  * used to cascade controllers.
  96.  */
  97. #define DMA_5ADR     0xC4    /* Channel  address register */
  98. #define DMA_5WCNT     0xC6    /* Channel  word count */
  99. #define DMA_6ADR     0xC8    /* Channel  address register */
  100. #define DMA_6WCNT     0xCA    /* Channel  word count */
  101. #define DMA_7ADR     0xCC    /* Channel  address register */
  102. #define DMA_7WCNT     0xCE    /* Channel  word count */
  103.  
  104. /* DMA controller 1, 8 bit channels */
  105. #define CTL1_CMD    0x08    /* Command reg */
  106. #define CTL1_STAT    0x08    /* Status reg */
  107. #define CTL1_RES_MSK    0x0A    /* Mask set/reset register */
  108. #define CTL1_MODE    0x0B    /* Mode reg */
  109. #define CTL1_CLFF    0x0C    /* Clear byte pointer first/last flip-flop */
  110.  
  111. /* DMA controller 2, 16 bit channels */
  112. #define CTL2_CMD    0xD0    /* Command reg */
  113. #define CTL2_STAT    0xD0    /* Status reg */
  114. #define CTL2_RES_MSK    0xD4    /* Mask set/reset register */
  115. #define CTL2_MODE    0xD6    /* Mode reg */
  116. #define CTL2_CLFF    0xD8    /* Clear byte pointer first/last flip-flop */
  117.  
  118. /* 8 bit channels */
  119. #define DMA_0XADR    0x87    /* Channel 0 address extension reg */
  120. #define DMA_1XADR     0x83    /* Channel 1 address extension reg */
  121. #define DMA_2XADR     0x81    /* Channel 2 address extension reg */
  122. #define DMA_3XADR     0x82    /* Channel 3 address extension reg */
  123.  
  124. /* 16 bit channels */
  125. #define DMA_5XADR     0x8B    /* Channel 5 address extension reg */
  126. #define DMA_6XADR     0x89    /* Channel 6 address extension reg */
  127. #define DMA_7XADR     0x8A    /* Channel 7 address extension reg */
  128.  
  129.  
  130. #define DMA_MSK        0x0A    /* Mask, enable disk, disable others */
  131. #define DMA_CLEAR    0x1A    /* Master clear */
  132. #define IOCR        0x56    /* IO controller */
  133.  
  134. /*
  135.  * DMA Channels. d_chan field of dmareq.
  136.  */
  137.  
  138. #define NCHANS        8
  139.  
  140. /* 8 bit channels */
  141. #define DMA_CH0        0    /* Channel 0 */
  142. #define DMA_CH1        1    /* Channel 1 */
  143. #define DMA_CH2        2    /* Channel 2 */
  144. #define DMA_CH3        3    /* Channel 3 */
  145. /* 16 bit channels */
  146. #define DMA_CH5        5    /* Channel 5 */
  147. #define DMA_CH6        6    /* Channel 6 */
  148. #define DMA_CH7        7    /* Channel 7 */
  149.  
  150. /*
  151.  * DMA Masks.
  152.  */
  153. #define DMA_SETMSK    4    /* Set mask bit */
  154. #define DMA_CLRMSK    0    /* Clear mask bit */
  155.  
  156. /*
  157.  * DMA Commands. d_mode field of dmareq.
  158.  */
  159. /* from memory to device */
  160. #define DMA_Wrmode    0x48    /* single, read, increment, no auto-init */
  161. /* from device to memory */
  162. #define DMA_Rdmode    0x44    /* single, write, increment, no auto-init */
  163. #define DMA_Nomode    0x0C    /* illegal mode */
  164.  
  165. #define DMAPRI    PRIBIO
  166.  
  167. /* dma_alloc modes */
  168. #define DMA_BLOCK    0    /* blocking task time allocation */
  169. #define DMA_NBLOCK    1    /* non-blocking task time allocation */
  170.  
  171. struct dmareq
  172. {   struct dmareq    *d_nxt;        /* reserved */
  173.     unsigned short     d_chan;    /* specifies channel */
  174.     unsigned short     d_mode;    /* direction of transfer */
  175.     paddr_t         d_addr;    /* physical src or dst */
  176.     long         d_cnt;        /* byte or word (16 bit chan) count */
  177.     int               (*d_proc)();    /* address of dma routine */
  178.     char        *d_params;    /* driver defineable param block */
  179. };
  180.