digi.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Copyright 2003 Digi International (www.digi.com)
  3. * Scott H Kilau <Scott_Kilau at digi dot com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2, or (at your option)
  8. * any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
  12. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. * PURPOSE. See the GNU General Public License for more details.
  14. */
  15. #ifndef __DIGI_H
  16. #define __DIGI_H
  17. #ifndef TIOCM_LE
  18. #define TIOCM_LE 0x01 /* line enable */
  19. #define TIOCM_DTR 0x02 /* data terminal ready */
  20. #define TIOCM_RTS 0x04 /* request to send */
  21. #define TIOCM_ST 0x08 /* secondary transmit */
  22. #define TIOCM_SR 0x10 /* secondary receive */
  23. #define TIOCM_CTS 0x20 /* clear to send */
  24. #define TIOCM_CAR 0x40 /* carrier detect */
  25. #define TIOCM_RNG 0x80 /* ring indicator */
  26. #define TIOCM_DSR 0x100 /* data set ready */
  27. #define TIOCM_RI TIOCM_RNG /* ring (alternate) */
  28. #define TIOCM_CD TIOCM_CAR /* carrier detect (alt) */
  29. #endif
  30. #if !defined(TIOCMSET)
  31. #define TIOCMSET (('d'<<8) | 252) /* set modem ctrl state */
  32. #define TIOCMGET (('d'<<8) | 253) /* set modem ctrl state */
  33. #endif
  34. #if !defined(TIOCMBIC)
  35. #define TIOCMBIC (('d'<<8) | 254) /* set modem ctrl state */
  36. #define TIOCMBIS (('d'<<8) | 255) /* set modem ctrl state */
  37. #endif
  38. #define DIGI_GETA (('e'<<8) | 94) /* Read params */
  39. #define DIGI_SETA (('e'<<8) | 95) /* Set params */
  40. #define DIGI_SETAW (('e'<<8) | 96) /* Drain & set params */
  41. #define DIGI_SETAF (('e'<<8) | 97) /* Drain, flush & set params */
  42. #define DIGI_GET_NI_INFO (('d'<<8) | 250) /* Non-intelligent state info */
  43. #define DIGI_LOOPBACK (('d'<<8) | 252) /*
  44. * Enable/disable UART
  45. * internal loopback
  46. */
  47. #define DIGI_FAST 0x0002 /* Fast baud rates */
  48. #define RTSPACE 0x0004 /* RTS input flow control */
  49. #define CTSPACE 0x0008 /* CTS output flow control */
  50. #define DIGI_COOK 0x0080 /* Cooked processing done in FEP */
  51. #define DIGI_FORCEDCD 0x0100 /* Force carrier */
  52. #define DIGI_ALTPIN 0x0200 /* Alternate RJ-45 pin config */
  53. #define DIGI_PRINTER 0x0800 /* Hold port open for flow cntrl*/
  54. #define DIGI_DTR_TOGGLE 0x2000 /* Support DTR Toggle */
  55. #define DIGI_RTS_TOGGLE 0x8000 /* Support RTS Toggle */
  56. #define DIGI_PLEN 28 /* String length */
  57. #define DIGI_TSIZ 10 /* Terminal string len */
  58. /************************************************************************
  59. * Structure used with ioctl commands for DIGI parameters.
  60. ************************************************************************/
  61. struct digi_t {
  62. unsigned short digi_flags; /* Flags (see above) */
  63. unsigned short digi_maxcps; /* Max printer CPS */
  64. unsigned short digi_maxchar; /* Max chars in print queue */
  65. unsigned short digi_bufsize; /* Buffer size */
  66. unsigned char digi_onlen; /* Length of ON string */
  67. unsigned char digi_offlen; /* Length of OFF string */
  68. char digi_onstr[DIGI_PLEN]; /* Printer on string */
  69. char digi_offstr[DIGI_PLEN]; /* Printer off string */
  70. char digi_term[DIGI_TSIZ]; /* terminal string */
  71. };
  72. /************************************************************************
  73. * Structure to get driver status information
  74. ************************************************************************/
  75. struct digi_dinfo {
  76. unsigned int dinfo_nboards; /* # boards configured */
  77. char dinfo_reserved[12]; /* for future expansion */
  78. char dinfo_version[16]; /* driver version */
  79. };
  80. #define DIGI_GETDD (('d'<<8) | 248) /* get driver info */
  81. /************************************************************************
  82. * Structure used with ioctl commands for per-board information
  83. *
  84. * physsize and memsize differ when board has "windowed" memory
  85. ************************************************************************/
  86. struct digi_info {
  87. unsigned int info_bdnum; /* Board number (0 based) */
  88. unsigned int info_ioport; /* io port address */
  89. unsigned int info_physaddr; /* memory address */
  90. unsigned int info_physsize; /* Size of host mem window */
  91. unsigned int info_memsize; /* Amount of dual-port mem */
  92. /* on board */
  93. unsigned short info_bdtype; /* Board type */
  94. unsigned short info_nports; /* number of ports */
  95. char info_bdstate; /* board state */
  96. char info_reserved[7]; /* for future expansion */
  97. };
  98. #define DIGI_GETBD (('d'<<8) | 249) /* get board info */
  99. struct digi_getbuffer /* Struct for holding buffer use counts */
  100. {
  101. unsigned long tIn;
  102. unsigned long tOut;
  103. unsigned long rxbuf;
  104. unsigned long txbuf;
  105. unsigned long txdone;
  106. };
  107. struct digi_getcounter {
  108. unsigned long norun; /* number of UART overrun errors */
  109. unsigned long noflow; /* number of buffer overflow errors */
  110. unsigned long nframe; /* number of framing errors */
  111. unsigned long nparity; /* number of parity errors */
  112. unsigned long nbreak; /* number of breaks received */
  113. unsigned long rbytes; /* number of received bytes */
  114. unsigned long tbytes; /* number of bytes transmitted fully */
  115. };
  116. /* Board State Definitions */
  117. #define BD_RUNNING 0x0
  118. #define BD_NOFEP 0x5
  119. #define DIGI_SETCUSTOMBAUD _IOW('e', 106, int) /* Set integer baud rate */
  120. #define DIGI_GETCUSTOMBAUD _IOR('e', 107, int) /* Get integer baud rate */
  121. #define DIGI_REALPORT_GETBUFFERS (('e'<<8) | 108)
  122. #define DIGI_REALPORT_SENDIMMEDIATE (('e'<<8) | 109)
  123. #define DIGI_REALPORT_GETCOUNTERS (('e'<<8) | 110)
  124. #define DIGI_REALPORT_GETEVENTS (('e'<<8) | 111)
  125. #define EV_OPU 0x0001 /* !<Output paused by client */
  126. #define EV_OPS 0x0002 /* !<Output paused by reqular sw flowctrl */
  127. #define EV_IPU 0x0010 /* !<Input paused unconditionally by user */
  128. #define EV_IPS 0x0020 /* !<Input paused by high/low water marks */
  129. #define EV_TXB 0x0040 /* !<Transmit break pending */
  130. /*
  131. * This structure holds data needed for the intelligent <--> nonintelligent
  132. * DPA translation
  133. */
  134. struct ni_info {
  135. int board;
  136. int channel;
  137. int dtr;
  138. int rts;
  139. int cts;
  140. int dsr;
  141. int ri;
  142. int dcd;
  143. int curtx;
  144. int currx;
  145. unsigned short iflag;
  146. unsigned short oflag;
  147. unsigned short cflag;
  148. unsigned short lflag;
  149. unsigned int mstat;
  150. unsigned char hflow;
  151. unsigned char xmit_stopped;
  152. unsigned char recv_stopped;
  153. unsigned int baud;
  154. };
  155. #define T_CLASSIC 0002
  156. #define T_PCIBUS 0400
  157. #define T_NEO_EXPRESS 0001
  158. #define T_NEO 0000
  159. #define TTY_FLIPBUF_SIZE 512
  160. #endif /* DIGI_H */