home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 206.img / SCO386N3.TD0 / usr / sys / io / dma.h next >
Encoding:
C/C++ Source or Header  |  1987-03-27  |  3.7 KB  |  116 lines

  1. /*
  2.  *    %Z% %M% %I% %D% %Q%
  3.  *
  4.  *    Copyright (C) The Santa Cruz Operation, 1985, 1986.
  5.  *    This Module contains Proprietary Information of
  6.  *    The Santa Cruz Operation and should be treated as Confidential.
  7.  *
  8.  */
  9.  
  10. /*
  11.  * Intel 8237 DMA Controller.
  12.  */
  13.  
  14. /*
  15.  * DMA I/O Port Assignments.
  16.  */
  17. /* 8 bit channel specific registers on controller 1 */
  18. #define DMA_0ADR     0x00    /* Channel  address register */
  19. #define DMA_0WCNT     0x01    /* Channel  word count */
  20. #define DMA_1ADR     0x02    /* Channel  address register */
  21. #define DMA_1WCNT     0x03    /* Channel  word count */
  22. #define DMA_2ADR     0x04    /* Channel  address register */
  23. #define DMA_2WCNT     0x05    /* Channel  word count */
  24. #define DMA_3ADR     0x06    /* Channel  address register */
  25. #define DMA_3WCNT     0x07    /* Channel  word count */
  26.  
  27. /* 16 bit channel specific registers on controller 1.
  28.  * Chip A0 connected to bus A1, etc. so even address 
  29.  * increments generated by this controller.  Hence, 
  30.  * 16 bit dma, and only even i/o addresses. Channel 4
  31.  * used to cascade controllers.
  32.  */
  33. #define DMA_5ADR     0xC4    /* Channel  address register */
  34. #define DMA_5WCNT     0xC6    /* Channel  word count */
  35. #define DMA_6ADR     0xC8    /* Channel  address register */
  36. #define DMA_6WCNT     0xCA    /* Channel  word count */
  37. #define DMA_7ADR     0xCC    /* Channel  address register */
  38. #define DMA_7WCNT     0xCE    /* Channel  word count */
  39.  
  40. /* DMA controller 1, 8 bit channels */
  41. #define CTL1_CMD    0x08    /* Command reg */
  42. #define CTL1_STAT    0x08    /* Status reg */
  43. #define CTL1_RES_MSK    0x0A    /* Mask set/reset register */
  44. #define CTL1_MODE    0x0B    /* Mode reg */
  45. #define CTL1_CLFF    0x0C    /* Clear byte pointer first/last flip-flop */
  46.  
  47. /* DMA controller 2, 16 bit channels */
  48. #define CTL2_CMD    0xD0    /* Command reg */
  49. #define CTL2_STAT    0xD0    /* Status reg */
  50. #define CTL2_RES_MSK    0xD4    /* Mask set/reset register */
  51. #define CTL2_MODE    0xD6    /* Mode reg */
  52. #define CTL2_CLFF    0xD8    /* Clear byte pointer first/last flip-flop */
  53.  
  54. /* 8 bit channels */
  55. #define DMA_0XADR    0x87    /* Channel 0 address extension reg */
  56. #define DMA_1XADR     0x83    /* Channel 1 address extension reg */
  57. #define DMA_2XADR     0x81    /* Channel 2 address extension reg */
  58. #define DMA_3XADR     0x82    /* Channel 3 address extension reg */
  59.  
  60. /* 16 bit channels */
  61. #define DMA_5XADR     0x8B    /* Channel 5 address extension reg */
  62. #define DMA_6XADR     0x89    /* Channel 6 address extension reg */
  63. #define DMA_7XADR     0x8A    /* Channel 7 address extension reg */
  64.  
  65.  
  66. #define DMA_MSK        0x0A    /* Mask, enable disk, disable others */
  67. #define DMA_CLEAR    0x1A    /* Master clear */
  68. #define IOCR        0x56    /* IO controller */
  69.  
  70. /*
  71.  * DMA Channels. d_chan field of dmareq.
  72.  */
  73.  
  74. #define NCHANS        8
  75.  
  76. /* 8 bit channels */
  77. #define DMA_CH0        0    /* Channel 0 */
  78. #define DMA_CH1        1    /* Channel 1 */
  79. #define DMA_CH2        2    /* Channel 2 */
  80. #define DMA_CH3        3    /* Channel 3 */
  81. /* 16 bit channels */
  82. #define DMA_CH5        5    /* Channel 5 */
  83. #define DMA_CH6        6    /* Channel 6 */
  84. #define DMA_CH7        7    /* Channel 7 */
  85.  
  86. /*
  87.  * DMA Masks.
  88.  */
  89. #define DMA_SETMSK    4    /* Set mask bit */
  90. #define DMA_CLRMSK    0    /* Clear mask bit */
  91.  
  92. /*
  93.  * DMA Commands. d_mode field of dmareq.
  94.  */
  95. /* from memory to device */
  96. #define DMA_Wrmode    0x48    /* single, read, increment, no auto-init */
  97. /* from device to memory */
  98. #define DMA_Rdmode    0x44    /* single, write, increment, no auto-init */
  99. #define DMA_Nomode    0x0C    /* illegal mode */
  100.  
  101. #define DMAPRI    PRIBIO
  102.  
  103. /* dma_alloc modes */
  104. #define DMA_BLOCK    0    /* blocking task time allocation */
  105. #define DMA_NBLOCK    1    /* non-blocking task time allocation */
  106.  
  107. struct dmareq
  108. {   struct dmareq    *d_nxt;        /* reserved */
  109.     unsigned short     d_chan;    /* specifies channel */
  110.     unsigned short     d_mode;    /* direction of transfer */
  111.     paddr_t         d_addr;    /* physical src or dst */
  112.     long         d_cnt;        /* byte or word (16 bit chan) count */
  113.     int               (*d_proc)();    /* address of dma routine */
  114.     char        *d_params;    /* driver defineable param block */
  115. };
  116.