aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rio/port.h
blob: 9b5fa3eb0402911165ff4f6af66e2fb1e8d591be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*
** -----------------------------------------------------------------------------
**
**  Perle Specialix driver for Linux
**  Ported from existing RIO Driver for SCO sources.
 *
 *  (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
**	Module		: port.h
**	SID		: 1.3
**	Last Modified	: 11/6/98 11:34:12
**	Retrieved	: 11/6/98 11:34:21
**
**  ident @(#)port.h	1.3
**
** -----------------------------------------------------------------------------
*/

#ifndef	__rio_port_h__
#define	__rio_port_h__

/*
**	Port data structure
*/
struct Port {
	struct gs_port gs;
	int PortNum;			/* RIO port no., 0-511 */
	struct Host *HostP;
	caddr_t Caddr;
	unsigned short HostPort;	/* Port number on host card */
	unsigned char RupNum;		/* Number of RUP for port */
	unsigned char ID2;		/* Second ID of RTA for port */
	unsigned long State;		/* FLAGS for open & xopen */
#define	RIO_LOPEN	0x00001		/* Local open */
#define	RIO_MOPEN	0x00002		/* Modem open */
#define	RIO_WOPEN	0x00004		/* Waiting for open */
#define	RIO_CLOSING	0x00008		/* The port is being close */
#define	RIO_XPBUSY	0x00010		/* Transparent printer busy */
#define	RIO_BREAKING	0x00020		/* Break in progress */
#define	RIO_DIRECT	0x00040		/* Doing Direct output */
#define	RIO_EXCLUSIVE	0x00080		/* Stream open for exclusive use */
#define	RIO_NDELAY	0x00100		/* Stream is open FNDELAY */
#define	RIO_CARR_ON	0x00200		/* Stream has carrier present */
#define	RIO_XPWANTR	0x00400		/* Stream wanted by Xprint */
#define	RIO_RBLK	0x00800		/* Stream is read-blocked */
#define	RIO_BUSY	0x01000		/* Stream is BUSY for write */
#define	RIO_TIMEOUT	0x02000		/* Stream timeout in progress */
#define	RIO_TXSTOP	0x04000		/* Stream output is stopped */
#define	RIO_WAITFLUSH	0x08000		/* Stream waiting for flush */
#define	RIO_DYNOROD	0x10000		/* Drain failed */
#define	RIO_DELETED	0x20000		/* RTA has been deleted */
#define RIO_ISSCANCODE	0x40000		/* This line is in scancode mode */
#define	RIO_USING_EUC	0x100000	/* Using extended Unix chars */
#define	RIO_CAN_COOK	0x200000	/* This line can do cooking */
#define RIO_TRIAD_MODE  0x400000	/* Enable TRIAD special ops. */
#define RIO_TRIAD_BLOCK 0x800000	/* Next read will block */
#define RIO_TRIAD_FUNC  0x1000000	/* Seen a function key coming in */
#define RIO_THROTTLE_RX 0x2000000	/* RX needs to be throttled. */

	unsigned long Config;		/* FLAGS for NOREAD.... */
#define	RIO_NOREAD	0x0001		/* Are not allowed to read port */
#define	RIO_NOWRITE	0x0002		/* Are not allowed to write port */
#define	RIO_NOXPRINT	0x0004		/* Are not allowed to xprint port */
#define	RIO_NOMASK	0x0007		/* All not allowed things */
#define RIO_IXANY	0x0008		/* Port is allowed ixany */
#define	RIO_MODEM	0x0010		/* Stream is a modem device */
#define	RIO_IXON	0x0020		/* Port is allowed ixon */
#define RIO_WAITDRAIN	0x0040		/* Wait for port to completely drain */
#define RIO_MAP_50_TO_50	0x0080	/* Map 50 baud to 50 baud */
#define RIO_MAP_110_TO_110	0x0100	/* Map 110 baud to 110 baud */

/*
** 15.10.1998 ARG - ESIL 0761 prt fix
** As LynxOS does not appear to support Hardware Flow Control .....
** Define our own flow control flags in 'Config'.
*/
#define RIO_CTSFLOW	0x0200		/* RIO's own CTSFLOW flag */
#define RIO_RTSFLOW	0x0400		/* RIO's own RTSFLOW flag */


	struct PHB *PhbP;		/* pointer to PHB for port */
	u16 *TxAdd;			/* Add packets here */
	u16 *TxStart;			/* Start of add array */
	u16 *TxEnd;			/* End of add array */
	u16 *RxRemove;			/* Remove packets here */
	u16 *RxStart;			/* Start of remove array */
	u16 *RxEnd;			/* End of remove array */
	unsigned int RtaUniqueNum;	/* Unique number of RTA */
	unsigned short PortState;	/* status of port */
	unsigned short ModemState;	/* status of modem lines */
	unsigned long ModemLines;	/* Modem bits sent to RTA */
	unsigned char CookMode;		/* who expands CR/LF? */
	unsigned char ParamSem;		/* Prevent write during param */
	unsigned char Mapped;		/* if port mapped onto host */
	unsigned char SecondBlock;	/* if port belongs to 2nd block
				   		of 16 port RTA */
	unsigned char InUse;		/* how many pre-emptive cmds */
	unsigned char Lock;		/* if params locked */
	unsigned char Store;		/* if params stored across closes */
	unsigned char FirstOpen;	/* TRUE if first time port opened */
	unsigned char FlushCmdBodge;	/* if doing a (non)flush */
	unsigned char MagicFlags;	/* require intr processing */
#define	MAGIC_FLUSH	0x01		/* mirror of WflushFlag */
#define	MAGIC_REBOOT	0x02		/* RTA re-booted, re-open ports */
#define	MORE_OUTPUT_EYGOR 0x04		/* riotproc failed to empty clists */
	unsigned char WflushFlag;	/* 1 How many WFLUSHs active */
/*
** Transparent print stuff
*/
	struct Xprint {
#ifndef MAX_XP_CTRL_LEN
#define MAX_XP_CTRL_LEN		16	/* ALSO IN DAEMON.H */
#endif
		unsigned int XpCps;
		char XpOn[MAX_XP_CTRL_LEN];
		char XpOff[MAX_XP_CTRL_LEN];
		unsigned short XpLen;	/* strlen(XpOn)+strlen(XpOff) */
		unsigned char XpActive;
		unsigned char XpLastTickOk;	/* TRUE if we can process */
#define	XP_OPEN		00001
#define	XP_RUNABLE	00002
		struct ttystatics *XttyP;
	} Xprint;
	unsigned char RxDataStart;
	unsigned char Cor2Copy;		/* copy of COR2 */
	char *Name;			/* points to the Rta's name */
	char *TxRingBuffer;
	unsigned short TxBufferIn;	/* New data arrives here */
	unsigned short TxBufferOut;	/* Intr removes data here */
	unsigned short OldTxBufferOut;	/* Indicates if draining */
	int TimeoutId;			/* Timeout ID */
	unsigned int Debug;
	unsigned char WaitUntilBooted;	/* True if open should block */
	unsigned int statsGather;	/* True if gathering stats */
	unsigned long txchars;		/* Chars transmitted */
	unsigned long rxchars;		/* Chars received */
	unsigned long opens;		/* port open count */
	unsigned long closes;		/* port close count */
	unsigned long ioctls;		/* ioctl count */
	unsigned char LastRxTgl;	/* Last state of rx toggle bit */
	spinlock_t portSem;		/* Lock using this sem */
	int MonitorTstate;		/* Monitoring ? */
	int timeout_id;			/* For calling 100 ms delays */
	int timeout_sem;		/* For calling 100 ms delays */
	int firstOpen;			/* First time open ? */
	char *p;			/* save the global struc here .. */
};

struct ModuleInfo {
	char *Name;
	unsigned int Flags[4];		/* one per port on a module */
};

/*
** This struct is required because trying to grab an entire Port structure
** runs into problems with differing struct sizes between driver and config.
*/
struct PortParams {
	unsigned int Port;
	unsigned long Config;
	unsigned long State;
	struct ttystatics *TtyP;
};

#endif