aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/keyspan_usa26msg.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/usb/serial/keyspan_usa26msg.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/usb/serial/keyspan_usa26msg.h')
-rw-r--r--drivers/usb/serial/keyspan_usa26msg.h260
1 files changed, 260 insertions, 0 deletions
diff --git a/drivers/usb/serial/keyspan_usa26msg.h b/drivers/usb/serial/keyspan_usa26msg.h
new file mode 100644
index 000000000000..3808727db65a
--- /dev/null
+++ b/drivers/usb/serial/keyspan_usa26msg.h
@@ -0,0 +1,260 @@
1/*
2 usa26msg.h
3
4 Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved
5 This file is available under a BSD-style copyright
6
7 Keyspan USB Async Message Formats for the USA28X
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are
11 met:
12
13 1. Redistributions of source code must retain this licence text
14 without modification, this list of conditions, and the following
15 disclaimer. The following copyright notice must appear immediately at
16 the beginning of all source files:
17
18 Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved
19
20 This file is available under a BSD-style copyright
21
22 2. The name of InnoSys Incorporated may not be used to endorse or promote
23 products derived from this software without specific prior written
24 permission.
25
26 THIS SOFTWARE IS PROVIDED BY INNOSYS CORP. ``AS IS'' AND ANY EXPRESS OR
27 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
29 NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
30 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 SUCH DAMAGE.
37
38 Third revision: USA28X version (aka USA26)
39
40 Buffer formats for RX/TX data messages are not defined by
41 a structure, but are described here:
42
43 USB OUT (host -> USAxx, transmit) messages contain a
44 REQUEST_ACK indicator (set to 0xff to request an ACK at the
45 completion of transmit; 0x00 otherwise), followed by data:
46
47 RQSTACK DAT DAT DAT ...
48
49 with a total data length of 63.
50
51 USB IN (USAxx -> host, receive) messages begin with a status
52 byte in which the 0x80 bit is either:
53
54 (a) 0x80 bit clear
55 indicates that the bytes following it are all data
56 bytes:
57
58 STAT DATA DATA DATA DATA DATA ...
59
60 for a total of up to 63 DATA bytes,
61
62 or:
63
64 (b) 0x80 bit set
65 indiates that the bytes following alternate data and
66 status bytes:
67
68 STAT DATA STAT DATA STAT DATA STAT DATA ...
69
70 for a total of up to 32 DATA bytes.
71
72 The valid bits in the STAT bytes are:
73
74 OVERRUN 0x02
75 PARITY 0x04
76 FRAMING 0x08
77 BREAK 0x10
78
79 Notes:
80
81 (1) The OVERRUN bit can appear in either (a) or (b) format
82 messages, but the but the PARITY/FRAMING/BREAK bits
83 only appear in (b) format messages.
84 (2) For the host to determine the exact point at which the
85 overrun occurred (to identify the point in the data
86 stream at which the data was lost), it needs to count
87 128 characters, starting at the first character of the
88 message in which OVERRUN was reported; the lost character(s)
89 would have been received between the 128th and 129th
90 characters.
91 (3) An RX data message in which the first byte has 0x80 clear
92 serves as a "break off" indicator.
93
94 revision history:
95
96 1999feb10 add reportHskiaChanges to allow us to ignore them
97 1999feb10 add txAckThreshold for fast+loose throughput enhancement
98 1999mar30 beef up support for RX error reporting
99 1999apr14 add resetDataToggle to control message
100 2000jan04 merge with usa17msg.h
101 2000jun01 add extended BSD-style copyright text
102 2001jul05 change message format to improve OVERRUN case
103
104 Note on shared names:
105
106 In the case of fields which have been merged between the USA17
107 and USA26 definitions, the USA26 definition is the first part
108 of the name and the USA17 definition is the second part of the
109 name; both meanings are described below.
110*/
111
112#ifndef __USA26MSG__
113#define __USA26MSG__
114
115
116struct keyspan_usa26_portControlMessage
117{
118 /*
119 there are three types of "commands" sent in the control message:
120
121 1. configuration changes which must be requested by setting
122 the corresponding "set" flag (and should only be requested
123 when necessary, to reduce overhead on the USA26):
124 */
125 u8 setClocking, // BOTH: host requests baud rate be set
126 baudLo, // BOTH: host does baud divisor calculation
127 baudHi, // BOTH: baudHi is only used for first port (gives lower rates)
128 externalClock_txClocking,
129 // USA26: 0=internal, other=external
130 // USA17: 0=internal, other=external/RI
131 rxClocking, // USA17: 0=internal, 1=external/RI, other=external/DSR
132
133
134 setLcr, // BOTH: host requests lcr be set
135 lcr, // BOTH: use PARITY, STOPBITS, DATABITS below
136
137 setFlowControl, // BOTH: host requests flow control be set
138 ctsFlowControl, // BOTH: 1=use CTS flow control, 0=don't
139 xonFlowControl, // BOTH: 1=use XON/XOFF flow control, 0=don't
140 xonChar, // BOTH: specified in current character format
141 xoffChar, // BOTH: specified in current character format
142
143 setTxTriState_setRts,
144 // USA26: host requests TX tri-state be set
145 // USA17: host requests RTS output be set
146 txTriState_rts, // BOTH: 1=active (normal), 0=tristate (off)
147
148 setHskoa_setDtr,
149 // USA26: host requests HSKOA output be set
150 // USA17: host requests DTR output be set
151 hskoa_dtr, // BOTH: 1=on, 0=off
152
153 setPrescaler, // USA26: host requests prescalar be set (default: 13)
154 prescaler; // BOTH: specified as N/8; values 8-ff are valid
155 // must be set any time internal baud rate is set;
156 // must not be set when external clocking is used
157 // note: in USA17, prescaler is applied whenever
158 // setClocking is requested
159
160 /*
161 3. configuration data which is simply used as is (no overhead,
162 but must be specified correctly in every host message).
163 */
164 u8 forwardingLength, // BOTH: forward when this number of chars available
165 reportHskiaChanges_dsrFlowControl,
166 // USA26: 1=normal; 0=ignore external clock
167 // USA17: 1=use DSR flow control, 0=don't
168 txAckThreshold, // BOTH: 0=not allowed, 1=normal, 2-255 deliver ACK faster
169 loopbackMode; // BOTH: 0=no loopback, 1=loopback enabled
170
171 /*
172 4. commands which are flags only; these are processed in order
173 (so that, e.g., if both _txOn and _txOff flags are set, the
174 port ends in a TX_OFF state); any non-zero value is respected
175 */
176 u8 _txOn, // BOTH: enable transmitting (and continue if there's data)
177 _txOff, // BOTH: stop transmitting
178 txFlush, // BOTH: toss outbound data
179 txBreak, // BOTH: turn on break (cleared by _txOn)
180 rxOn, // BOTH: turn on receiver
181 rxOff, // BOTH: turn off receiver
182 rxFlush, // BOTH: toss inbound data
183 rxForward, // BOTH: forward all inbound data, NOW (as if fwdLen==1)
184 returnStatus, // BOTH: return current status (even if it hasn't changed)
185 resetDataToggle;// BOTH: reset data toggle state to DATA0
186
187};
188
189// defines for bits in lcr
190#define USA_DATABITS_5 0x00
191#define USA_DATABITS_6 0x01
192#define USA_DATABITS_7 0x02
193#define USA_DATABITS_8 0x03
194#define STOPBITS_5678_1 0x00 // 1 stop bit for all byte sizes
195#define STOPBITS_5_1p5 0x04 // 1.5 stop bits for 5-bit byte
196#define STOPBITS_678_2 0x04 // 2 stop bits for 6/7/8-bit byte
197#define USA_PARITY_NONE 0x00
198#define USA_PARITY_ODD 0x08
199#define USA_PARITY_EVEN 0x18
200#define PARITY_1 0x28
201#define PARITY_0 0x38
202
203// all things called "StatusMessage" are sent on the status endpoint
204
205struct keyspan_usa26_portStatusMessage // one for each port
206{
207 u8 port, // BOTH: 0=first, 1=second, other=see below
208 hskia_cts, // USA26: reports HSKIA pin
209 // USA17: reports CTS pin
210 gpia_dcd, // USA26: reports GPIA pin
211 // USA17: reports DCD pin
212 dsr, // USA17: reports DSR pin
213 ri, // USA17: reports RI pin
214 _txOff, // port has been disabled (by host)
215 _txXoff, // port is in XOFF state (either host or RX XOFF)
216 rxEnabled, // as configured by rxOn/rxOff 1=on, 0=off
217 controlResponse;// 1=a control message has been processed
218};
219
220// bits in RX data message when STAT byte is included
221#define RXERROR_OVERRUN 0x02
222#define RXERROR_PARITY 0x04
223#define RXERROR_FRAMING 0x08
224#define RXERROR_BREAK 0x10
225
226struct keyspan_usa26_globalControlMessage
227{
228 u8 sendGlobalStatus, // 2=request for two status responses
229 resetStatusToggle, // 1=reset global status toggle
230 resetStatusCount; // a cycling value
231};
232
233struct keyspan_usa26_globalStatusMessage
234{
235 u8 port, // 3
236 sendGlobalStatus, // from request, decremented
237 resetStatusCount; // as in request
238};
239
240struct keyspan_usa26_globalDebugMessage
241{
242 u8 port, // 2
243 a,
244 b,
245 c,
246 d;
247};
248
249// ie: the maximum length of an EZUSB endpoint buffer
250#define MAX_DATA_LEN 64
251
252// update status approx. 60 times a second (16.6666 ms)
253#define STATUS_UPDATE_INTERVAL 16
254
255// status rationing tuning value (each port gets checked each n ms)
256#define STATUS_RATION 10
257
258#endif
259
260