1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 23 /* 24 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 25 * Use is subject to license terms. 26 */ 27 28 #ifndef _SYS_USB_USBSER_KEYSPAN_USA90MSG_H 29 #define _SYS_USB_USBSER_KEYSPAN_USA90MSG_H 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 typedef struct keyspan_usa19hs_port_ctrl_msg keyspan_usa19hs_port_ctrl_msg_t; 38 typedef struct keyspan_usa19hs_port_status_msg 39 keyspan_usa19hs_port_status_msg_t; 40 41 /* 42 * usa90msg.h 43 * 44 * Copyright (c) 1998-2003 InnoSys Incorporated. All Rights Reserved 45 * This file is available under a BSD-style copyright 46 * 47 * Keyspan USB Async Firmware to run on xxxxx 48 * 49 * Redistribution and use in source and binary forms, with or without 50 * modification, are permitted provided that the following conditions are 51 * met: 52 * 53 * 1. Redistributions of source code must retain this licence text 54 * without modification, this list of conditions, and the following 55 * disclaimer. The following copyright notice must appear immediately at 56 * the beginning of all source files: 57 * 58 * Copyright (c) 1998-2000 InnoSys Incorporated. All Rights Reserved 59 * 60 * This file is available under a BSD-style copyright 61 * 62 * 2. Redistributions in binary form must reproduce the above copyright 63 * notice, this list of conditions and the following disclaimer in the 64 * documentation and/or other materials provided with the distribution. 65 * 66 * 3. The name of InnoSys Incorprated may not be used to endorse or promote 67 * products derived from this software without specific prior written 68 * permission. 69 * 70 * THIS SOFTWARE IS PROVIDED BY INNOSYS CORP. ``AS IS'' AND ANY EXPRESS OR 71 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 72 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 73 * NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 74 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 75 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 76 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 77 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 78 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 79 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 80 * SUCH DAMAGE. 81 * 82 * Revisions: 83 * 84 * 2003feb14 add setTxMode/txMode and cancelRxXoff to portControl 85 * 86 */ 87 88 struct keyspan_usa19hs_port_ctrl_msg { 89 /* 90 * there are three types of "commands" sent in the control message: 91 * 92 * configuration changes which must be requested by setting 93 * the corresponding "set" flag (and should only be requested 94 * when necessary, to reduce overhead on the device): 95 */ 96 97 uint8_t setClocking; /* host requests baud rate be set */ 98 uint8_t baudLo; /* host does baud divisor calculation */ 99 uint8_t baudHi; /* host does baud divisor calculation */ 100 101 uint8_t setLcr; /* host requests lcr be set */ 102 uint8_t lcr; /* use PARITY, STOPBITS, DATABITS below */ 103 104 uint8_t setRxMode; /* set receive mode */ 105 uint8_t rxMode; /* RXMODE_DMA or RXMODE_BYHAND */ 106 107 uint8_t setTxMode; /* set transmit mode */ 108 uint8_t txMode; /* TXMODE_DMA or TXMODE_BYHAND */ 109 110 /* host requests tx flow control be set */ 111 uint8_t setTxFlowControl; 112 uint8_t txFlowControl; /* use TX_FLOW... bits below */ 113 114 /* host requests rx flow control be set */ 115 uint8_t setRxFlowControl; 116 uint8_t rxFlowControl; /* use RX_FLOW... bits below */ 117 uint8_t sendXoff; /* host requests XOFF transmitted immediately */ 118 uint8_t sendXon; /* host requests XON char transmitted */ 119 uint8_t xonChar; /* specified in current character format */ 120 uint8_t xoffChar; /* specified in current character format */ 121 122 uint8_t sendChar; /* host requests char transmitted immediately */ 123 uint8_t txChar; /* character to send */ 124 125 uint8_t setRts; /* host requests RTS output be set */ 126 uint8_t rts; /* 1=on, 0=off */ 127 uint8_t setDtr; /* host requests DTR output be set */ 128 uint8_t dtr; /* 1=on, 0=off */ 129 130 /* 131 * configuration data which is simply used as is 132 * and must be specified correctly in every host message. 133 */ 134 135 /* forward when this number of chars available */ 136 uint8_t rxForwardingLength; 137 uint8_t rxForwardingTimeout; /* (1-31 in ms) */ 138 uint8_t txAckSetting; /* 0=don't ack, 1=normal, 2-255 TBD... */ 139 /* 140 * Firmware states which cause actions if they change 141 * and must be specified correctly in every host message. 142 */ 143 144 uint8_t portEnabled; /* 0=disabled, 1=enabled */ 145 uint8_t txFlush; /* 0=normal, 1=toss outbound data */ 146 uint8_t txBreak; /* 0=break off, 1=break on */ 147 uint8_t loopbackMode; /* 0=no loopback, 1=loopback enabled */ 148 149 /* 150 * commands which are flags only; these are processed in order 151 * (so that, e.g., if rxFlush and rxForward flags are set, the 152 * port will have no data to forward); any non-zero value 153 * is respected 154 */ 155 156 uint8_t rxFlush; /* toss inbound data */ 157 158 /* forward all inbound data, NOW (as if fwdLen==1) */ 159 uint8_t rxForward; 160 uint8_t cancelRxXoff; /* cancel any receive XOFF state (_txXoff) */ 161 uint8_t returnStatus; /* return current status NOW */ 162 }; 163 164 /* defines for bits in lcr */ 165 #define USA_DATABITS_5 0x00 166 #define USA_DATABITS_6 0x01 167 #define USA_DATABITS_7 0x02 168 #define USA_DATABITS_8 0x03 169 #define STOPBITS_5678_1 0x00 /* 1 stop bit for all byte sizes */ 170 #define STOPBITS_5_1p5 0x04 /* 1.5 stop bits for 5-bit byte */ 171 #define STOPBITS_678_2 0x04 /* 2 stop bits for 6-8 bit byte */ 172 #define USA_PARITY_NONE 0x00 173 #define USA_PARITY_ODD 0x08 174 #define USA_PARITY_EVEN 0x18 175 #define PARITY_MARK_1 0x28 /* force parity MARK */ 176 #define PARITY_SPACE_0 0x38 /* force parity SPACE */ 177 178 #define TXFLOW_CTS 0x04 179 #define TXFLOW_DSR 0x08 180 #define TXFLOW_XOFF 0x01 181 #define TXFLOW_XOFF_ANY 0x02 182 #define TXFLOW_XOFF_BITS (TXFLOW_XOFF | TXFLOW_XOFF_ANY) 183 184 #define RXFLOW_XOFF 0x10 185 #define RXFLOW_RTS 0x20 186 #define RXFLOW_DTR 0x40 187 #define RXFLOW_DSR_SENSITIVITY 0x80 188 189 #define RXMODE_BYHAND 0x00 190 #define RXMODE_DMA 0x02 191 192 #define TXMODE_BYHAND 0x00 193 #define TXMODE_DMA 0x02 194 195 /* all things called "StatusMessage" are sent on the status endpoint */ 196 197 struct keyspan_usa19hs_port_status_msg { 198 uint8_t msr; /* reports the actual MSR register */ 199 uint8_t cts; /* reports CTS pin */ 200 uint8_t dcd; /* reports DCD pin */ 201 uint8_t dsr; /* reports DSR pin */ 202 uint8_t ri; /* reports RI pin */ 203 uint8_t _txXoff; /* port is in XOFF state (we received XOFF) */ 204 uint8_t rxBreak; /* reports break state */ 205 206 /* count of overrun errors (since last reported) */ 207 uint8_t rxOverrun; 208 209 /* count of parity errors (since last reported) */ 210 uint8_t rxParity; 211 212 /* count of frame errors (since last reported) */ 213 uint8_t rxFrame; 214 uint8_t portState; /* PORTSTATE_xxx bits (useful for debugging) */ 215 uint8_t messageAck; /* message acknowledgement */ 216 uint8_t charAck; /* character acknowledgement */ 217 218 /* (value = returnStatus) a control message has been processed */ 219 uint8_t controlResponse; 220 }; 221 222 /* bits in RX data message when STAT byte is included */ 223 224 #define RXERROR_OVERRUN 0x02 225 #define RXERROR_PARITY 0x04 226 #define RXERROR_FRAMING 0x08 227 #define RXERROR_BREAK 0x10 228 229 #define PORTSTATE_ENABLED 0x80 230 #define PORTSTATE_TXFLUSH 0x01 231 #define PORTSTATE_TXBREAK 0x02 232 #define PORTSTATE_LOOPBACK 0x04 233 234 /* MSR bits */ 235 236 /* CTS has changed since last report */ 237 #define USA_MSR_dCTS 0x01 238 #define USA_MSR_dDSR 0x02 239 #define USA_MSR_dRI 0x04 240 #define USA_MSR_dDCD 0x08 241 242 #define USA_MSR_CTS 0x10 /* current state of CTS */ 243 #define USA_MSR_DSR 0x20 244 #define USA_USA_MSR_RI 0x40 245 #define MSR_DCD 0x80 246 247 /* ie: the maximum length of an endpoint buffer */ 248 #define MAX_DATA_LEN 64 249 250 #ifdef __cplusplus 251 } 252 #endif 253 254 #endif /* _SYS_USB_USBSER_KEYSPAN_USA90MSG_H */ 255