home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / dma.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  5.9 KB  |  177 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/dma.h.sl 1.1 4.0 12/08/90 15141 AT&T-USL"
  11.  
  12. /*      Copyright (c) 1988, 1989 Intel Corp.            */
  13. /*        All Rights Reserved   */
  14. /*
  15.  *      INTEL CORPORATION PROPRIETARY INFORMATION
  16.  *
  17.  *      This software is supplied under the terms of a license
  18.  *      agreement or nondisclosure agreement with Intel Corpo-
  19.  *      ration and may not be copied or disclosed except in
  20.  *      accordance with the terms of that agreement.
  21.  */
  22.  
  23. #ifndef _SYS_DMA_H
  24. #define    _SYS_DMA_H
  25.  
  26. #ifndef _SYS_I8237A_H
  27. #include "sys/i8237A.h"
  28. #endif
  29.  
  30. /* the DMA Status Structure */
  31. struct dma_stat {
  32.         paddr_t         targaddr;      /* physical address of buffer */
  33.         paddr_t         targaddr_hi;   /* more for 64-bit addresses */
  34.         paddr_t         reqraddr;      /* physical address of buffer */
  35.         paddr_t         reqraddr_hi;   /* more for 64-bit addresses */
  36.         unsigned short  count;         /* size of bytes in buffer */
  37.         unsigned short  count_hi;      /* more for big blocks */
  38. };
  39.  
  40. /* the DMA Buffer Descriptor structure */
  41. struct dma_buf {
  42.         unsigned short  reserved;    /* alignment pad */
  43.         unsigned short   count;      /* size of block */
  44.         paddr_t   address;         /* phys addr of data block */
  45.         paddr_t   physical;         /* phys addr of next dma_buf */
  46.         struct dma_buf  *next_buf;   /* next buffer descriptor */
  47.         unsigned short  reserved_hi; /* alignment pad */
  48.         unsigned short  count_hi;    /* for big blocks */
  49.         unsigned long   address_hi;  /* for 64-bit addressing */
  50.         unsigned long   physical_hi; /* for 64-bit addressing */
  51. };
  52.  
  53. /* the DMA Command Block structure */
  54. struct dma_cb {
  55.         struct dma_cb  *next;       /* free list link */
  56.         struct dma_buf *targbufs;   /* list of target data buffers */
  57.         struct dma_buf *reqrbufs;   /* list of requestor data buffers */
  58.         unsigned char  command;     /* Read/Write/Translate/Verify */
  59.         unsigned char  targ_type;   /* Memory/IO */
  60.         unsigned char  reqr_type;   /* Memory/IO */
  61.         unsigned char  targ_step;   /* Inc/Dec/Hold */
  62.         unsigned char  reqr_step;   /* Inc/Dec/Hold */
  63.         unsigned char  trans_type;  /* Single/Demand/Block/Cascade */
  64.         unsigned char  targ_path;   /* 8/16/32 */
  65.         unsigned char  reqr_path;   /* 8/16/32 */
  66.         unsigned char  cycles;      /* 1 or 2 */
  67.         unsigned char  bufprocess;  /* Single/Chain/Auto-Init */
  68.         unsigned short dummy;           /* alignment pad */
  69.         char           *procparms;  /* parameter buffer for appl call */
  70.         int            (*proc)();   /* address of application call routine */
  71. };
  72.  
  73. #define DMA_CMD_READ    0x0
  74. #define DMA_CMD_WRITE   0x1
  75. #define DMA_CMD_TRAN    0x2
  76. #define DMA_CMD_VRFY    0x3
  77.  
  78. #define DMA_TYPE_MEM    0x0
  79. #define DMA_TYPE_IO     0x1
  80.  
  81. #define DMA_STEP_INC    0x0
  82. #define DMA_STEP_DEC    0x1
  83. #define DMA_STEP_HOLD   0x2
  84.  
  85. #define DMA_TRANS_SNGL  0x0
  86. #define DMA_TRANS_DMND  0x1
  87. #define DMA_TRANS_BLCK  0x2
  88. #define DMA_TRANS_CSCD  0x3
  89.  
  90. #define DMA_PATH_8      0x0
  91. #define DMA_PATH_16     0x1
  92. #define DMA_PATH_32     0x2
  93. #define DMA_PATH_64     0x3
  94.  
  95. /***
  96. ** We could use DMA_PATH_64 to mean this but why not
  97. ** just put in a separate define.
  98. ***/
  99. #define DMA_PATH_16B    0x4     /* 16-bit path but byte count */
  100.  
  101. #define DMA_CYCLES_1    0x0
  102. #define DMA_CYCLES_2    0x1
  103.  
  104. /***
  105. ** For the EISA bus we will use the following definitions for DMA_CYCLES
  106. **    DMA_CYCLES_1 = Compatible timing
  107. **    DMA_CYCLES_2 = Type "A" timing
  108. **    DMA_CYCLES_3 = Type "B" timing
  109. **    DMA_CYCLES_4 = Burst timing
  110. ***/
  111. #define DMA_CYCLES_3    0x2
  112. #define DMA_CYCLES_4    0x3
  113.  
  114. #define DMA_BUF_SNGL    0x0
  115. #define DMA_BUF_CHAIN   0x1
  116. #define DMA_BUF_AUTO    0x2
  117.  
  118. #define DMA_SLEEP       0x0
  119. #define DMA_NOSLEEP     0x1
  120.  
  121. /* some common defined constants */
  122. #ifndef PDMA
  123. #define PDMA 5
  124. #endif
  125.  
  126. #ifndef TRUE
  127. #define TRUE 1
  128. #define FALSE 0
  129. #endif
  130.  
  131. #ifndef NULL
  132. #define NULL 0
  133. #endif
  134.  
  135. /* public function routines */
  136. #if defined(__STDC__)
  137. extern void            dma_init(void);
  138. extern void            dma_intr(int);
  139. extern int             dma_prog(struct dma_cb *, int, unsigned char);
  140. extern int             dma_swsetup(struct dma_cb *, int, unsigned char);
  141. extern void            dma_swstart(struct dma_cb *, int, unsigned char);
  142. extern void            dma_stop(int);
  143. extern void            dma_enable(int);
  144. extern void            dma_disable(int);
  145. extern struct dma_cb  *dma_get_cb(unsigned char);
  146. extern void            dma_free_cb(struct dma_cb *);
  147. extern struct dma_buf *dma_get_buf(unsigned char);
  148. extern void            dma_free_buf(struct dma_buf *);
  149. #else
  150. extern void            dma_init();
  151. extern void            dma_intr();
  152. extern int             dma_prog();
  153. extern int             dma_swsetup();
  154. extern unsigned char   dma_get_best_mode();
  155. extern void            dma_swstart();
  156. extern void            dma_stop();
  157. extern void             dma_enable();
  158. extern void            dma_disable();
  159. extern struct dma_cb  *dma_get_cb();
  160. extern void            dma_free_cb();
  161. extern struct dma_buf *dma_get_buf();
  162. extern void            dma_free_buf();
  163. #endif
  164.  
  165. /* backward compatibility (XENIX)? */
  166. struct dmareq
  167. {   struct dmareq       *d_nxt;         /* reserved */
  168.     unsigned short       d_chan;        /* specifies channel */
  169.     unsigned short       d_mode;        /* direction of transfer */
  170.     paddr_t              d_addr;        /* physical src or dst */
  171.     long                 d_cnt;         /* byte or word (16 bit chan) count */
  172.     int                (*d_proc)();     /* address of dma routine */
  173.     char                *d_params;      /* driver defineable param block */
  174. };
  175.  
  176. #endif /* _SYS_DMA_H */
  177.