Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / drivers / usb / serial / keyspan_usa90msg.h
blob86708ecd87357095629d6f670938b2da30e456ac
1 /*
2 usa90msg.h
4 Copyright (c) 1998-2003 InnoSys Incorporated. All Rights Reserved
5 This file is available under a BSD-style copyright
7 Keyspan USB Async Message Formats for the USA19HS
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are
11 met:
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:
18 Copyright (c) 1998-2003 InnoSys Incorporated. All Rights Reserved
20 This file is available under a BSD-style copyright
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.
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.
38 Revisions:
40 2003feb14 add setTxMode/txMode and cancelRxXoff to portControl
41 2003mar21 change name of PARITY_0/1 to add MARK/SPACE
44 #ifndef __USA90MSG__
45 #define __USA90MSG__
47 struct keyspan_usa90_portControlMessage
50 there are three types of "commands" sent in the control message:
52 1. configuration changes which must be requested by setting
53 the corresponding "set" flag (and should only be requested
54 when necessary, to reduce overhead on the device):
57 u8 setClocking, // host requests baud rate be set
58 baudLo, // host does baud divisor calculation
59 baudHi, // host does baud divisor calculation
61 setLcr, // host requests lcr be set
62 lcr, // use PARITY, STOPBITS, DATABITS below
64 setRxMode, // set receive mode
65 rxMode, // RXMODE_DMA or RXMODE_BYHAND
67 setTxMode, // set transmit mode
68 txMode, // TXMODE_DMA or TXMODE_BYHAND
70 setTxFlowControl, // host requests tx flow control be set
71 txFlowControl , // use TX_FLOW... bits below
72 setRxFlowControl, // host requests rx flow control be set
73 rxFlowControl, // use RX_FLOW... bits below
74 sendXoff, // host requests XOFF transmitted immediately
75 sendXon, // host requests XON char transmitted
76 xonChar, // specified in current character format
77 xoffChar, // specified in current character format
79 sendChar, // host requests char transmitted immediately
80 txChar, // character to send
82 setRts, // host requests RTS output be set
83 rts, // 1=on, 0=off
84 setDtr, // host requests DTR output be set
85 dtr; // 1=on, 0=off
89 2. configuration data which is simply used as is
90 and must be specified correctly in every host message.
93 u8 rxForwardingLength, // forward when this number of chars available
94 rxForwardingTimeout, // (1-31 in ms)
95 txAckSetting; // 0=don't ack, 1=normal, 2-255 TBD...
97 3. Firmware states which cause actions if they change
98 and must be specified correctly in every host message.
101 u8 portEnabled, // 0=disabled, 1=enabled
102 txFlush, // 0=normal, 1=toss outbound data
103 txBreak, // 0=break off, 1=break on
104 loopbackMode; // 0=no loopback, 1=loopback enabled
107 4. commands which are flags only; these are processed in order
108 (so that, e.g., if rxFlush and rxForward flags are set, the
109 port will have no data to forward); any non-zero value
110 is respected
113 u8 rxFlush, // toss inbound data
114 rxForward, // forward all inbound data, NOW (as if fwdLen==1)
115 cancelRxXoff, // cancel any receive XOFF state (_txXoff)
116 returnStatus; // return current status NOW
119 // defines for bits in lcr
120 #define USA_DATABITS_5 0x00
121 #define USA_DATABITS_6 0x01
122 #define USA_DATABITS_7 0x02
123 #define USA_DATABITS_8 0x03
124 #define STOPBITS_5678_1 0x00 // 1 stop bit for all byte sizes
125 #define STOPBITS_5_1p5 0x04 // 1.5 stop bits for 5-bit byte
126 #define STOPBITS_678_2 0x04 // 2 stop bits for 6-8 bit byte
127 #define USA_PARITY_NONE 0x00
128 #define USA_PARITY_ODD 0x08
129 #define USA_PARITY_EVEN 0x18
130 #define PARITY_MARK_1 0x28 // force parity MARK
131 #define PARITY_SPACE_0 0x38 // force parity SPACE
133 #define TXFLOW_CTS 0x04
134 #define TXFLOW_DSR 0x08
135 #define TXFLOW_XOFF 0x01
136 #define TXFLOW_XOFF_ANY 0x02
137 #define TXFLOW_XOFF_BITS (TXFLOW_XOFF | TXFLOW_XOFF_ANY)
139 #define RXFLOW_XOFF 0x10
140 #define RXFLOW_RTS 0x20
141 #define RXFLOW_DTR 0x40
142 #define RXFLOW_DSR_SENSITIVITY 0x80
144 #define RXMODE_BYHAND 0x00
145 #define RXMODE_DMA 0x02
147 #define TXMODE_BYHAND 0x00
148 #define TXMODE_DMA 0x02
151 // all things called "StatusMessage" are sent on the status endpoint
153 struct keyspan_usa90_portStatusMessage
155 u8 msr, // reports the actual MSR register
156 cts, // reports CTS pin
157 dcd, // reports DCD pin
158 dsr, // reports DSR pin
159 ri, // reports RI pin
160 _txXoff, // port is in XOFF state (we received XOFF)
161 rxBreak, // reports break state
162 rxOverrun, // count of overrun errors (since last reported)
163 rxParity, // count of parity errors (since last reported)
164 rxFrame, // count of frame errors (since last reported)
165 portState, // PORTSTATE_xxx bits (useful for debugging)
166 messageAck, // message acknowledgement
167 charAck, // character acknowledgement
168 controlResponse; // (value = returnStatus) a control message has been processed
171 // bits in RX data message when STAT byte is included
173 #define RXERROR_OVERRUN 0x02
174 #define RXERROR_PARITY 0x04
175 #define RXERROR_FRAMING 0x08
176 #define RXERROR_BREAK 0x10
178 #define PORTSTATE_ENABLED 0x80
179 #define PORTSTATE_TXFLUSH 0x01
180 #define PORTSTATE_TXBREAK 0x02
181 #define PORTSTATE_LOOPBACK 0x04
183 // MSR bits
185 #define USA_MSR_dCTS 0x01 // CTS has changed since last report
186 #define USA_MSR_dDSR 0x02
187 #define USA_MSR_dRI 0x04
188 #define USA_MSR_dDCD 0x08
190 #define USA_MSR_CTS 0x10 // current state of CTS
191 #define USA_MSR_DSR 0x20
192 #define USA_USA_MSR_RI 0x40
193 #define MSR_DCD 0x80
195 // ie: the maximum length of an endpoint buffer
196 #define MAX_DATA_LEN 64
198 #endif