port.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. ** -----------------------------------------------------------------------------
  3. **
  4. ** Perle Specialix driver for Linux
  5. ** Ported from existing RIO Driver for SCO sources.
  6. *
  7. * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. **
  23. ** Module : port.h
  24. ** SID : 1.3
  25. ** Last Modified : 11/6/98 11:34:12
  26. ** Retrieved : 11/6/98 11:34:21
  27. **
  28. ** ident @(#)port.h 1.3
  29. **
  30. ** -----------------------------------------------------------------------------
  31. */
  32. #ifndef __rio_port_h__
  33. #define __rio_port_h__
  34. /*
  35. ** Port data structure
  36. */
  37. struct Port {
  38. struct gs_port gs;
  39. int PortNum; /* RIO port no., 0-511 */
  40. struct Host *HostP;
  41. caddr_t Caddr;
  42. unsigned short HostPort; /* Port number on host card */
  43. unsigned char RupNum; /* Number of RUP for port */
  44. unsigned char ID2; /* Second ID of RTA for port */
  45. unsigned long State; /* FLAGS for open & xopen */
  46. #define RIO_LOPEN 0x00001 /* Local open */
  47. #define RIO_MOPEN 0x00002 /* Modem open */
  48. #define RIO_WOPEN 0x00004 /* Waiting for open */
  49. #define RIO_CLOSING 0x00008 /* The port is being close */
  50. #define RIO_XPBUSY 0x00010 /* Transparent printer busy */
  51. #define RIO_BREAKING 0x00020 /* Break in progress */
  52. #define RIO_DIRECT 0x00040 /* Doing Direct output */
  53. #define RIO_EXCLUSIVE 0x00080 /* Stream open for exclusive use */
  54. #define RIO_NDELAY 0x00100 /* Stream is open FNDELAY */
  55. #define RIO_CARR_ON 0x00200 /* Stream has carrier present */
  56. #define RIO_XPWANTR 0x00400 /* Stream wanted by Xprint */
  57. #define RIO_RBLK 0x00800 /* Stream is read-blocked */
  58. #define RIO_BUSY 0x01000 /* Stream is BUSY for write */
  59. #define RIO_TIMEOUT 0x02000 /* Stream timeout in progress */
  60. #define RIO_TXSTOP 0x04000 /* Stream output is stopped */
  61. #define RIO_WAITFLUSH 0x08000 /* Stream waiting for flush */
  62. #define RIO_DYNOROD 0x10000 /* Drain failed */
  63. #define RIO_DELETED 0x20000 /* RTA has been deleted */
  64. #define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */
  65. #define RIO_USING_EUC 0x100000 /* Using extended Unix chars */
  66. #define RIO_CAN_COOK 0x200000 /* This line can do cooking */
  67. #define RIO_TRIAD_MODE 0x400000 /* Enable TRIAD special ops. */
  68. #define RIO_TRIAD_BLOCK 0x800000 /* Next read will block */
  69. #define RIO_TRIAD_FUNC 0x1000000 /* Seen a function key coming in */
  70. #define RIO_THROTTLE_RX 0x2000000 /* RX needs to be throttled. */
  71. unsigned long Config; /* FLAGS for NOREAD.... */
  72. #define RIO_NOREAD 0x0001 /* Are not allowed to read port */
  73. #define RIO_NOWRITE 0x0002 /* Are not allowed to write port */
  74. #define RIO_NOXPRINT 0x0004 /* Are not allowed to xprint port */
  75. #define RIO_NOMASK 0x0007 /* All not allowed things */
  76. #define RIO_IXANY 0x0008 /* Port is allowed ixany */
  77. #define RIO_MODEM 0x0010 /* Stream is a modem device */
  78. #define RIO_IXON 0x0020 /* Port is allowed ixon */
  79. #define RIO_WAITDRAIN 0x0040 /* Wait for port to completely drain */
  80. #define RIO_MAP_50_TO_50 0x0080 /* Map 50 baud to 50 baud */
  81. #define RIO_MAP_110_TO_110 0x0100 /* Map 110 baud to 110 baud */
  82. /*
  83. ** 15.10.1998 ARG - ESIL 0761 prt fix
  84. ** As LynxOS does not appear to support Hardware Flow Control .....
  85. ** Define our own flow control flags in 'Config'.
  86. */
  87. #define RIO_CTSFLOW 0x0200 /* RIO's own CTSFLOW flag */
  88. #define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */
  89. struct PHB *PhbP; /* pointer to PHB for port */
  90. u16 *TxAdd; /* Add packets here */
  91. u16 *TxStart; /* Start of add array */
  92. u16 *TxEnd; /* End of add array */
  93. u16 *RxRemove; /* Remove packets here */
  94. u16 *RxStart; /* Start of remove array */
  95. u16 *RxEnd; /* End of remove array */
  96. unsigned int RtaUniqueNum; /* Unique number of RTA */
  97. unsigned short PortState; /* status of port */
  98. unsigned short ModemState; /* status of modem lines */
  99. unsigned long ModemLines; /* Modem bits sent to RTA */
  100. unsigned char CookMode; /* who expands CR/LF? */
  101. unsigned char ParamSem; /* Prevent write during param */
  102. unsigned char Mapped; /* if port mapped onto host */
  103. unsigned char SecondBlock; /* if port belongs to 2nd block
  104. of 16 port RTA */
  105. unsigned char InUse; /* how many pre-emptive cmds */
  106. unsigned char Lock; /* if params locked */
  107. unsigned char Store; /* if params stored across closes */
  108. unsigned char FirstOpen; /* TRUE if first time port opened */
  109. unsigned char FlushCmdBodge; /* if doing a (non)flush */
  110. unsigned char MagicFlags; /* require intr processing */
  111. #define MAGIC_FLUSH 0x01 /* mirror of WflushFlag */
  112. #define MAGIC_REBOOT 0x02 /* RTA re-booted, re-open ports */
  113. #define MORE_OUTPUT_EYGOR 0x04 /* riotproc failed to empty clists */
  114. unsigned char WflushFlag; /* 1 How many WFLUSHs active */
  115. /*
  116. ** Transparent print stuff
  117. */
  118. struct Xprint {
  119. #ifndef MAX_XP_CTRL_LEN
  120. #define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */
  121. #endif
  122. unsigned int XpCps;
  123. char XpOn[MAX_XP_CTRL_LEN];
  124. char XpOff[MAX_XP_CTRL_LEN];
  125. unsigned short XpLen; /* strlen(XpOn)+strlen(XpOff) */
  126. unsigned char XpActive;
  127. unsigned char XpLastTickOk; /* TRUE if we can process */
  128. #define XP_OPEN 00001
  129. #define XP_RUNABLE 00002
  130. struct ttystatics *XttyP;
  131. } Xprint;
  132. unsigned char RxDataStart;
  133. unsigned char Cor2Copy; /* copy of COR2 */
  134. char *Name; /* points to the Rta's name */
  135. char *TxRingBuffer;
  136. unsigned short TxBufferIn; /* New data arrives here */
  137. unsigned short TxBufferOut; /* Intr removes data here */
  138. unsigned short OldTxBufferOut; /* Indicates if draining */
  139. int TimeoutId; /* Timeout ID */
  140. unsigned int Debug;
  141. unsigned char WaitUntilBooted; /* True if open should block */
  142. unsigned int statsGather; /* True if gathering stats */
  143. unsigned long txchars; /* Chars transmitted */
  144. unsigned long rxchars; /* Chars received */
  145. unsigned long opens; /* port open count */
  146. unsigned long closes; /* port close count */
  147. unsigned long ioctls; /* ioctl count */
  148. unsigned char LastRxTgl; /* Last state of rx toggle bit */
  149. spinlock_t portSem; /* Lock using this sem */
  150. int MonitorTstate; /* Monitoring ? */
  151. int timeout_id; /* For calling 100 ms delays */
  152. int timeout_sem; /* For calling 100 ms delays */
  153. int firstOpen; /* First time open ? */
  154. char *p; /* save the global struc here .. */
  155. };
  156. struct ModuleInfo {
  157. char *Name;
  158. unsigned int Flags[4]; /* one per port on a module */
  159. };
  160. /*
  161. ** This struct is required because trying to grab an entire Port structure
  162. ** runs into problems with differing struct sizes between driver and config.
  163. */
  164. struct PortParams {
  165. unsigned int Port;
  166. unsigned long Config;
  167. unsigned long State;
  168. struct ttystatics *TtyP;
  169. };
  170. #endif