home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / asy.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  5.1 KB  |  165 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/asy.h.sl 1.1 4.0 12/08/90 31625 AT&T-USL"
  11.  
  12. #define SPL()        spltty()/* protection from interrupts */
  13.  
  14. /*
  15.  * Definitions for INS8250 / 16550  chips
  16.  */
  17.  
  18.     /* defined as offsets from the data register */
  19. #define DAT     0   /* receive/transmit data */
  20. #define ICR     1   /* interrupt control register */
  21. #define ISR     2   /* interrupt status register */
  22. #define LCR     3   /* line control register */
  23. #define MCR     4   /* modem control register */
  24. #define LSR     5   /* line status register */
  25. #define MSR     6   /* modem status register */
  26. #define DLL     0   /* divisor latch (lsb) */
  27. #define DLH     1   /* divisor latch (msb) */
  28.  
  29. /*
  30.  * INTEL 8210-A/B & 16450/16550 Registers Structure.
  31.  */
  32.  
  33. /* Line Control Register */
  34. #define        WLS0    0x01        /*word length select bit 0 */    
  35. #define        WLS1    0x02        /*word length select bit 2 */    
  36. #define        STB    0x04        /* number of stop bits */
  37. #define        PEN    0x08        /* parity enable */
  38. #define        EPS    0x10        /* even parity select */
  39. #define        SETBREAK 0x40        /* break key */
  40. #define        DLAB    0x80        /* divisor latch access bit */
  41. #define     RXLEN   0x03    /* # of data bits per received/xmitted character */
  42. #define     STOP1   0x00
  43. #define     STOP2   0x04
  44. #define     PAREN   0x08
  45. #define     PAREVN  0x10
  46. #define     PARMARK 0x20
  47. #define     SNDBRK  0x40
  48. #define     DLAB    0x80
  49.  
  50.  
  51. #define        BITS5    0x00        /* 5 bits per char */
  52. #define        BITS6    0x01        /* 6 bits per char */
  53. #define        BITS7    0x02        /* 7 bits per char */
  54. #define        BITS8    0x03        /* 8 bits per char */
  55.  
  56. /* Line Status Register */
  57. #define        RCA    0x01        /* data ready */
  58. #define        OVRRUN    0x02        /* overrun error */
  59. #define        PARERR    0x04        /* parity error */
  60. #define        FRMERR    0x08        /* framing error */
  61. #define        BRKDET 0x10        /* a break has arrived */
  62. #define        XHRE    0x20        /* tx hold reg is now empty */
  63. #define        XSRE    0x40        /* tx shift reg is now empty */
  64. #define        RFBE    0x80        /* rx FIFO Buffer error */
  65.  
  66. /* Interrupt Id Regisger */
  67. #define        MSTATUS    0x00
  68. #define        TxRDY    0x02
  69. #define        RxRDY    0x04
  70. #define        ERROR_INTR    0x08
  71.  
  72. /* Interrupt Enable Register */
  73. #define        FFTMOUT 0x0c        /* tmp for ringbuf mary */
  74. #define        RSTATUS 0x06        /* tmp for ringbuf mary */
  75. #define        RIEN    0x01        /* Received Data Ready */
  76. #define        TIEN    0x02        /* Tx Hold Register Empty */
  77. #define        SIEN    0x04    /* Receiver Line Status */
  78. #define        MIEN    0x08    /* Modem Status */
  79.  
  80. /* Modem Control Register */
  81. #define        DTR        0x01    /* Data Terminal Ready */
  82. #define        RTS        0x02    /* Request To Send */
  83. #define        OUT1        0x04    /* Aux output - not used */
  84. #define        OUT2        0x08    /* turns intr to 386 on/off */    
  85. #define        ASY_LOOP    0x10    /* loopback for diagnostics */
  86.  
  87. /* Modem Status Register */
  88. #define        DCTS        0x01    /* Delta Clear To Send */
  89. #define        DDSR        0x02    /* Delta Data Set Ready */
  90. #define        DRI        0x04    /* Trail Edge Ring Indicator */
  91. #define        DDCD        0x08    /* Delta Data Carrier Detect */
  92. #define        CTS        0x10    /* Clear To Send */
  93. #define        DSR        0x20    /* Data Set Ready */
  94. #define        RI        0x40    /* Ring Indicator */
  95. #define        DCD        0x80    /* Data Carrier Detect */
  96.  
  97. #define     DELTAS(x)     ((x)&(DCTS|DDSR|DRI|DDCD))
  98. #define     STATES(x)     ((x)(CTS|DSR|RI|DCD))
  99.  
  100.  
  101. #define     asychan(dev)    (dev&0x0f)
  102. #define     asymajor(dev)   ((dev>>8)&0x7f)
  103. #define     FIFOEN    0x8f    /* fifo enabled, w/ 8 byte trigger */
  104.  
  105. /* asy_flags definitions */
  106. #define     XBRK    0x01            /* xmitting break in progress */
  107. #define        HWDEV    0x02        /* Hardware device being used */
  108. #define        HWFLWO    0x04        /* H/W Flow ON */
  109. #define        HWFLWS    0x08        /* Start H/W after CSTOP */
  110. #define        ASY82510    0x40    /* 1 - 82510 , 0 - 16450/16550/8250 */
  111. #define        ASYHERE    0x80        /* adapter is present */
  112. #define     BRKTIME    HZ/4
  113.  
  114. /*
  115.  * Defines for ioctl calls (VP/ix)
  116.  */
  117.  
  118. #define AIOC            ('A'<<8)
  119. #define AIOCINTTYPE        (AIOC|60)    /* set interrupt type */
  120. #define AIOCDOSMODE        (AIOC|61)    /* set DOS mode */
  121. #define AIOCNONDOSMODE        (AIOC|62)    /* reset DOS mode */
  122. #define AIOCSERIALOUT        (AIOC|63)    /* serial device data write */
  123. #define AIOCSERIALIN        (AIOC|64)    /* serial device data read */
  124. #define AIOCSETSS        (AIOC|65)    /* set start/stop chars */
  125. #define AIOCINFO        (AIOC|66)    /* tell usr what device we are */
  126.  
  127. /* Ioctl alternate names used by VP/ix */
  128. #define VPC_SERIAL_DOS        AIOCDOSMODE    
  129. #define VPC_SERIAL_NONDOS    AIOCNONDOSMODE
  130. #define VPC_SERIAL_INFO        AIOCINFO
  131. #define VPC_SERIAL_OUT        AIOCSERIALOUT
  132. #define VPC_SERIAL_IN        AIOCSERIALIN
  133.  
  134. /* Serial in/out requests */
  135. #define SO_DIVLLSB        1
  136. #define SO_DIVLMSB        2
  137. #define SO_LCR            3
  138. #define SO_MCR            4
  139. #define SI_MSR            1
  140. #define SIO_MASK(elem)        (1<<((elem)-1))
  141.  
  142.  
  143. /*
  144.  * Asychronous configuration Structures 
  145.  */
  146.  
  147. struct asy{
  148.     int        asy_flags;
  149.     unsigned    asy_dat;
  150.     unsigned    asy_icr;
  151.     unsigned    asy_isr;
  152.     unsigned    asy_lcr;
  153.     unsigned    asy_mcr;
  154.     unsigned    asy_lsr;
  155.     unsigned    asy_msr;
  156.     unsigned    asy_vect;
  157.     struct msgb    *asyrbp;
  158.     minor_t        asy_dev;
  159. #ifdef MERGE386
  160.     int (*asy_ppi_func)();        /* Merge asy func pointer */
  161.     unsigned char *asy_ppi_data;    /* merge data */
  162. #endif /* MERGE386 */
  163. };
  164.  
  165.