11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds usa49msg.h 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds This file is available under a BSD-style copyright 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Keyspan USB Async Message Formats for the USA49W 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Redistribution and use in source and binary forms, with or without 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds modification, are permitted provided that the following conditions are 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds met: 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1. Redistributions of source code must retain this licence text 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds without modification, this list of conditions, and the following 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds disclaimer. The following copyright notice must appear immediately at 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds the beginning of all source files: 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds This file is available under a BSD-style copyright 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2. The name of InnoSys Incorporated may not be used to endorse or promote 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds products derived from this software without specific prior written 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds permission. 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds THIS SOFTWARE IS PROVIDED BY INNOSYS CORP. ``AS IS'' AND ANY EXPRESS OR 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds SUCH DAMAGE. 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4th revision: USA49W version 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Buffer formats for RX/TX data messages are not defined by 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds a structure, but are described here: 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds USB OUT (host -> USAxx, transmit) messages contain a 441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds REQUEST_ACK indicator (set to 0xff to request an ACK at the 451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds completion of transmit; 0x00 otherwise), followed by data: 461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds RQSTACK DAT DAT DAT ... 481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds with a total data length of 63. 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds USB IN (USAxx -> host, receive) messages begin with a status 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds byte in which the 0x80 bit is either: 531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (a) 0x80 bit clear 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds indicates that the bytes following it are all data 561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds bytes: 571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds STAT DATA DATA DATA DATA DATA ... 591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds for a total of up to 63 DATA bytes, 611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds or: 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (b) 0x80 bit set 651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds indiates that the bytes following alternate data and 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds status bytes: 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds STAT DATA STAT DATA STAT DATA STAT DATA ... 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds for a total of up to 32 DATA bytes. 711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds The valid bits in the STAT bytes are: 731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds OVERRUN 0x02 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds PARITY 0x04 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds FRAMING 0x08 771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds BREAK 0x10 781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Notes: 801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (1) The OVERRUN bit can appear in either (a) or (b) format 821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds messages, but the but the PARITY/FRAMING/BREAK bits 831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds only appear in (b) format messages. 841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (2) For the host to determine the exact point at which the 851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds overrun occurred (to identify the point in the data 861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds stream at which the data was lost), it needs to count 871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 128 characters, starting at the first character of the 881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds message in which OVERRUN was reported; the lost character(s) 891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds would have been received between the 128th and 129th 901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds characters. 911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (3) An RX data message in which the first byte has 0x80 clear 921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds serves as a "break off" indicator. 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (4) a control message specifying disablePort will be answered 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds with a status message, but no further status will be sent 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds until a control messages with enablePort is sent 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds revision history: 981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1999feb10 add reportHskiaChanges to allow us to ignore them 1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1999feb10 add txAckThreshold for fast+loose throughput enhancement 1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1999mar30 beef up support for RX error reporting 1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1999apr14 add resetDataToggle to control message 1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2000jan04 merge with usa17msg.h 1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2000mar08 clone from usa26msg.h -> usa49msg.h 1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2000mar09 change to support 4 ports 1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2000may03 change external clocking to match USA-49W hardware 1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2000jun01 add extended BSD-style copyright text 1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2001jul05 change message format to improve OVERRUN case 1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef __USA49MSG__ 1121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define __USA49MSG__ 1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Host->device messages sent on the global control endpoint: 1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds portNumber message 1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ---------- -------------------- 1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 0,1,2,3 portControlMessage 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 0x80 globalControlMessage 1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct keyspan_usa49_portControlMessage 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 0. 0/1/2/3 port control message follows 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 0x80 set non-port control message follows 1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 portNumber, 1311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds there are three types of "commands" sent in the control message: 1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1. configuration changes which must be requested by setting 1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds the corresponding "set" flag (and should only be requested 1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds when necessary, to reduce overhead on the USA26): 1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds setClocking, // host requests baud rate be set 1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds baudLo, // host does baud divisor calculation 1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds baudHi, // baudHi is only used for first port (gives lower rates) 1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds prescaler, // specified as N/8; values 8-ff are valid 1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds // must be set any time internal baud rate is set; 1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds txClocking, // 0=internal, 1=external/DSR 1451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds rxClocking, // 0=internal, 1=external/DSR 1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds setLcr, // host requests lcr be set 1481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds lcr, // use PARITY, STOPBITS, DATABITS below 1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds setFlowControl, // host requests flow control be set 1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ctsFlowControl, // 1=use CTS flow control, 0=don't 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds xonFlowControl, // 1=use XON/XOFF flow control, 0=don't 1531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds xonChar, // specified in current character format 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds xoffChar, // specified in current character format 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds setRts, // host requests RTS output be set 1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds rts, // 1=active, 0=inactive 1581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds setDtr, // host requests DTR output be set 1601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds dtr; // 1=on, 0=off 1611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 1641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3. configuration data which is simply used as is (no overhead, 1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds but must be specified correctly in every host message). 1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 forwardingLength, // forward when this number of chars available 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds dsrFlowControl, // 1=use DSR flow control, 0=don't 1691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds txAckThreshold, // 0=not allowed, 1=normal, 2-255 deliver ACK faster 1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds loopbackMode; // 0=no loopback, 1=loopback enabled 1711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4. commands which are flags only; these are processed in order 1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (so that, e.g., if both _txOn and _txOff flags are set, the 1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds port ends in a TX_OFF state); any non-zero value is respected 1761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 _txOn, // enable transmitting (and continue if there's data) 1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds _txOff, // stop transmitting 1791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds txFlush, // toss outbound data 1801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds txBreak, // turn on break (cleared by _txOn) 1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds rxOn, // turn on receiver 1821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds rxOff, // turn off receiver 1831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds rxFlush, // toss inbound data 1841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds rxForward, // forward all inbound data, NOW (as if fwdLen==1) 1851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds returnStatus, // return current status (even if it hasn't changed) 1861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds resetDataToggle,// reset data toggle state to DATA0 1871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds enablePort, // start servicing port (move data, check status) 1881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds disablePort; // stop servicing port (does implicit tx/rx flush/off) 1891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// defines for bits in lcr 1931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define USA_DATABITS_5 0x00 1941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define USA_DATABITS_6 0x01 1951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define USA_DATABITS_7 0x02 1961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define USA_DATABITS_8 0x03 1971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define STOPBITS_5678_1 0x00 // 1 stop bit for all byte sizes 1981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define STOPBITS_5_1p5 0x04 // 1.5 stop bits for 5-bit byte 1991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define STOPBITS_678_2 0x04 // 2 stop bits for 6/7/8-bit byte 2001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define USA_PARITY_NONE 0x00 2011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define USA_PARITY_ODD 0x08 2021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define USA_PARITY_EVEN 0x18 2031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define PARITY_1 0x28 2041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define PARITY_0 0x38 2051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 2071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds during normal operation, status messages are returned 2081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds to the host whenever the board detects changes. In some 2091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds circumstances (e.g. Windows), status messages from the 2101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds device cause problems; to shut them off, the host issues 2111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds a control message with the disableStatusMessages flags 2121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds set (to any non-zero value). The device will respond to 2131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds this message, and then suppress further status messages; 2141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds it will resume sending status messages any time the host 2151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds sends any control message (either global or port-specific). 2161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 2171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct keyspan_usa49_globalControlMessage 2191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 2201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 portNumber, // 0x80 2211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds sendGlobalStatus, // 1/2=number of status responses requested 2221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds resetStatusToggle, // 1=reset global status toggle 2231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds resetStatusCount, // a cycling value 2241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds remoteWakeupEnable, // 0x10=P1, 0x20=P2, 0x40=P3, 0x80=P4 2251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds disableStatusMessages; // 1=send no status until host talks 2261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 2271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 2291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Device->host messages send on the global status endpoint 2301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds portNumber message 2321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ---------- -------------------- 2331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 0x00,0x01,0x02,0x03 portStatusMessage 2341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 0x80 globalStatusMessage 2351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 0x81 globalDebugMessage 2361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 2371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct keyspan_usa49_portStatusMessage // one for each port 2391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 2401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 portNumber, // 0,1,2,3 2411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds cts, // reports CTS pin 2421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds dcd, // reports DCD pin 2431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds dsr, // reports DSR pin 2441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ri, // reports RI pin 2451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds _txOff, // transmit has been disabled (by host) 2461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds _txXoff, // transmit is in XOFF state (either host or RX XOFF) 2471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds rxEnabled, // as configured by rxOn/rxOff 1=on, 0=off 2481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds controlResponse,// 1=a control message has been processed 2491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds txAck, // ACK (data TX complete) 2501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds rs232valid; // RS-232 signal valid 2511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 2521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// bits in RX data message when STAT byte is included 2541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RXERROR_OVERRUN 0x02 2551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RXERROR_PARITY 0x04 2561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RXERROR_FRAMING 0x08 2571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RXERROR_BREAK 0x10 2581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct keyspan_usa49_globalStatusMessage 2601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 2611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 portNumber, // 0x80=globalStatusMessage 2621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds sendGlobalStatus, // from request, decremented 2631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds resetStatusCount; // as in request 2641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 2651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct keyspan_usa49_globalDebugMessage 2671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 2681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 portNumber, // 0x81=globalDebugMessage 2691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds n, // typically a count/status byte 2701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds b; // typically a data byte 2711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 2721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// ie: the maximum length of an EZUSB endpoint buffer 2741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MAX_DATA_LEN 64 2751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// update status approx. 60 times a second (16.6666 ms) 2771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define STATUS_UPDATE_INTERVAL 16 2781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds// status rationing tuning value (each port gets checked each n ms) 2801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define STATUS_RATION 10 2811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 283