2 ** -----------------------------------------------------------------------------
4 ** Perle Specialix driver for Linux
5 ** Ported from existing RIO Driver for SCO sources.
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
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.
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.
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.
25 ** Last Modified : 11/6/98 11:34:12
26 ** Retrieved : 11/6/98 11:34:21
28 ** ident @(#)port.h 1.3
30 ** -----------------------------------------------------------------------------
33 #ifndef __rio_port_h__
34 #define __rio_port_h__
37 static char *_port_h_sccs_
= "@(#)port.h 1.3";
45 ** the port data structure - one per port in the system
52 ** interrupt statistics
60 ** throughput statistics
68 ** driver entry statistics
92 ** Port data structure
97 int PortNum
; /* RIO port no., 0-511 */
99 volatile caddr_t Caddr
;
100 ushort HostPort
; /* Port number on host card */
101 uchar RupNum
; /* Number of RUP for port */
102 uchar ID2
; /* Second ID of RTA for port */
103 ulong State
; /* FLAGS for open & xopen */
104 #define RIO_LOPEN 0x00001 /* Local open */
105 #define RIO_MOPEN 0x00002 /* Modem open */
106 #define RIO_WOPEN 0x00004 /* Waiting for open */
107 #define RIO_CLOSING 0x00008 /* The port is being close */
108 #define RIO_XPBUSY 0x00010 /* Transparent printer busy */
109 #define RIO_BREAKING 0x00020 /* Break in progress */
110 #define RIO_DIRECT 0x00040 /* Doing Direct output */
111 #define RIO_EXCLUSIVE 0x00080 /* Stream open for exclusive use */
112 #define RIO_NDELAY 0x00100 /* Stream is open FNDELAY */
113 #define RIO_CARR_ON 0x00200 /* Stream has carrier present */
114 #define RIO_XPWANTR 0x00400 /* Stream wanted by Xprint */
115 #define RIO_RBLK 0x00800 /* Stream is read-blocked */
116 #define RIO_BUSY 0x01000 /* Stream is BUSY for write */
117 #define RIO_TIMEOUT 0x02000 /* Stream timeout in progress */
118 #define RIO_TXSTOP 0x04000 /* Stream output is stopped */
119 #define RIO_WAITFLUSH 0x08000 /* Stream waiting for flush */
120 #define RIO_DYNOROD 0x10000 /* Drain failed */
121 #define RIO_DELETED 0x20000 /* RTA has been deleted */
122 #define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */
123 #define RIO_USING_EUC 0x100000 /* Using extended Unix chars */
124 #define RIO_CAN_COOK 0x200000 /* This line can do cooking */
125 #define RIO_TRIAD_MODE 0x400000 /* Enable TRIAD special ops. */
126 #define RIO_TRIAD_BLOCK 0x800000 /* Next read will block */
127 #define RIO_TRIAD_FUNC 0x1000000 /* Seen a function key coming in */
128 #define RIO_THROTTLE_RX 0x2000000 /* RX needs to be throttled. */
130 ulong Config
; /* FLAGS for NOREAD.... */
131 #define RIO_NOREAD 0x0001 /* Are not allowed to read port */
132 #define RIO_NOWRITE 0x0002 /* Are not allowed to write port */
133 #define RIO_NOXPRINT 0x0004 /* Are not allowed to xprint port */
134 #define RIO_NOMASK 0x0007 /* All not allowed things */
135 #define RIO_IXANY 0x0008 /* Port is allowed ixany */
136 #define RIO_MODEM 0x0010 /* Stream is a modem device */
137 #define RIO_IXON 0x0020 /* Port is allowed ixon */
138 #define RIO_WAITDRAIN 0x0040 /* Wait for port to completely drain */
139 #define RIO_MAP_50_TO_50 0x0080 /* Map 50 baud to 50 baud */
140 #define RIO_MAP_110_TO_110 0x0100 /* Map 110 baud to 110 baud */
143 ** 15.10.1998 ARG - ESIL 0761 prt fix
144 ** As LynxOS does not appear to support Hardware Flow Control .....
145 ** Define our own flow control flags in 'Config'.
147 #define RIO_CTSFLOW 0x0200 /* RIO's own CTSFLOW flag */
148 #define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */
151 struct PHB
*PhbP
; /* pointer to PHB for port */
152 WORD
*TxAdd
; /* Add packets here */
153 WORD
*TxStart
; /* Start of add array */
154 WORD
*TxEnd
; /* End of add array */
155 WORD
*RxRemove
; /* Remove packets here */
156 WORD
*RxStart
; /* Start of remove array */
157 WORD
*RxEnd
; /* End of remove array */
158 uint RtaUniqueNum
; /* Unique number of RTA */
159 ushort PortState
; /* status of port */
160 ushort ModemState
; /* status of modem lines */
161 ulong ModemLines
; /* Modem bits sent to RTA */
162 uchar CookMode
; /* who expands CR/LF? */
163 uchar ParamSem
; /* Prevent write during param */
164 uchar Mapped
; /* if port mapped onto host */
165 uchar SecondBlock
; /* if port belongs to 2nd block
167 uchar InUse
; /* how many pre-emptive cmds */
168 uchar Lock
; /* if params locked */
169 uchar Store
; /* if params stored across closes */
170 uchar FirstOpen
; /* TRUE if first time port opened */
171 uchar FlushCmdBodge
; /* if doing a (non)flush */
172 uchar MagicFlags
; /* require intr processing */
173 #define MAGIC_FLUSH 0x01 /* mirror of WflushFlag */
174 #define MAGIC_REBOOT 0x02 /* RTA re-booted, re-open ports */
175 #define MORE_OUTPUT_EYGOR 0x04 /* riotproc failed to empty clists */
176 uchar WflushFlag
; /* 1 How many WFLUSHs active */
178 ** Transparent print stuff
182 #ifndef MAX_XP_CTRL_LEN
183 #define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */
186 char XpOn
[MAX_XP_CTRL_LEN
];
187 char XpOff
[MAX_XP_CTRL_LEN
];
188 ushort XpLen
; /* strlen(XpOn)+strlen(XpOff) */
190 uchar XpLastTickOk
; /* TRUE if we can process */
191 #define XP_OPEN 00001
192 #define XP_RUNABLE 00002
193 struct ttystatics
*XttyP
;
198 struct termss VpixSs
;
199 uchar ModemStatusReg
; /* Modem status register */
202 uchar Cor2Copy
; /* copy of COR2 */
203 char *Name
; /* points to the Rta's name */
205 struct RIOStats Stat
; /* ports statistics */
208 ushort TxBufferIn
; /* New data arrives here */
209 ushort TxBufferOut
; /* Intr removes data here */
210 ushort OldTxBufferOut
; /* Indicates if draining */
211 int TimeoutId
; /* Timeout ID */
213 uchar WaitUntilBooted
; /* True if open should block */
214 uint statsGather
; /* True if gathering stats */
215 ulong txchars
; /* Chars transmitted */
216 ulong rxchars
; /* Chars received */
217 ulong opens
; /* port open count */
218 ulong closes
; /* port close count */
219 ulong ioctls
; /* ioctl count */
220 uchar LastRxTgl
; /* Last state of rx toggle bit */
221 spinlock_t portSem
; /* Lock using this sem */
222 int MonitorTstate
; /* Monitoring ? */
223 int timeout_id
; /* For calling 100 ms delays */
224 int timeout_sem
;/* For calling 100 ms delays */
225 int firstOpen
; /* First time open ? */
226 char * p
; /* save the global struc here .. */
232 uint Flags
[4]; /* one per port on a module */
237 ** This struct is required because trying to grab an entire Port structure
238 ** runs into problems with differing struct sizes between driver and config.
244 struct ttystatics
*TtyP
;