^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: BSD-3-Clause */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) usa49msg.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) This file is available under a BSD-style copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) Keyspan USB Async Message Formats for the USA49W
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Redistribution and use in source and binary forms, with or without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) modification, are permitted provided that the following conditions are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 1. Redistributions of source code must retain this licence text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) without modification, this list of conditions, and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) disclaimer. The following copyright notice must appear immediately at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) the beginning of all source files:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) This file is available under a BSD-style copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 2. The name of InnoSys Incorporated may not be used to endorse or promote
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) products derived from this software without specific prior written
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) permission.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) THIS SOFTWARE IS PROVIDED BY INNOSYS CORP. ``AS IS'' AND ANY EXPRESS OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) SUCH DAMAGE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 4th revision: USA49W version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) Buffer formats for RX/TX data messages are not defined by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) a structure, but are described here:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) USB OUT (host -> USAxx, transmit) messages contain a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) REQUEST_ACK indicator (set to 0xff to request an ACK at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) completion of transmit; 0x00 otherwise), followed by data:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) RQSTACK DAT DAT DAT ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) with a total data length of 63.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) USB IN (USAxx -> host, receive) messages begin with a status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) byte in which the 0x80 bit is either:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) (a) 0x80 bit clear
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) indicates that the bytes following it are all data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) bytes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) STAT DATA DATA DATA DATA DATA ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) for a total of up to 63 DATA bytes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) or:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) (b) 0x80 bit set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) indiates that the bytes following alternate data and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) status bytes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) STAT DATA STAT DATA STAT DATA STAT DATA ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) for a total of up to 32 DATA bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) The valid bits in the STAT bytes are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) OVERRUN 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) PARITY 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) FRAMING 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) BREAK 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) Notes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) (1) The OVERRUN bit can appear in either (a) or (b) format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) messages, but the but the PARITY/FRAMING/BREAK bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) only appear in (b) format messages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) (2) For the host to determine the exact point at which the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) overrun occurred (to identify the point in the data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) stream at which the data was lost), it needs to count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 128 characters, starting at the first character of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) message in which OVERRUN was reported; the lost character(s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) would have been received between the 128th and 129th
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) characters.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) (3) An RX data message in which the first byte has 0x80 clear
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) serves as a "break off" indicator.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) (4) a control message specifying disablePort will be answered
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) with a status message, but no further status will be sent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) until a control messages with enablePort is sent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) revision history:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 1999feb10 add reportHskiaChanges to allow us to ignore them
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 1999feb10 add txAckThreshold for fast+loose throughput enhancement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 1999mar30 beef up support for RX error reporting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 1999apr14 add resetDataToggle to control message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 2000jan04 merge with usa17msg.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 2000mar08 clone from usa26msg.h -> usa49msg.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 2000mar09 change to support 4 ports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 2000may03 change external clocking to match USA-49W hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 2000jun01 add extended BSD-style copyright text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 2001jul05 change message format to improve OVERRUN case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #ifndef __USA49MSG__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define __USA49MSG__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) Host->device messages sent on the global control endpoint:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) portNumber message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) ---------- --------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 0,1,2,3 portControlMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 0x80 globalControlMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) struct keyspan_usa49_portControlMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 0. 0/1/2/3 port control message follows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 0x80 set non-port control message follows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) u8 portNumber,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) there are three types of "commands" sent in the control message:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 1. configuration changes which must be requested by setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) the corresponding "set" flag (and should only be requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) when necessary, to reduce overhead on the USA26):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) setClocking, // host requests baud rate be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) baudLo, // host does baud divisor calculation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) baudHi, // baudHi is only used for first port (gives lower rates)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) prescaler, // specified as N/8; values 8-ff are valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) // must be set any time internal baud rate is set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) txClocking, // 0=internal, 1=external/DSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) rxClocking, // 0=internal, 1=external/DSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) setLcr, // host requests lcr be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) lcr, // use PARITY, STOPBITS, DATABITS below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) setFlowControl, // host requests flow control be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) ctsFlowControl, // 1=use CTS flow control, 0=don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) xonFlowControl, // 1=use XON/XOFF flow control, 0=don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) xonChar, // specified in current character format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) xoffChar, // specified in current character format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) setRts, // host requests RTS output be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) rts, // 1=active, 0=inactive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) setDtr, // host requests DTR output be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) dtr; // 1=on, 0=off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 3. configuration data which is simply used as is (no overhead,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) but must be specified correctly in every host message).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) u8 forwardingLength, // forward when this number of chars available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) dsrFlowControl, // 1=use DSR flow control, 0=don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) txAckThreshold, // 0=not allowed, 1=normal, 2-255 deliver ACK faster
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) loopbackMode; // 0=no loopback, 1=loopback enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 4. commands which are flags only; these are processed in order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) (so that, e.g., if both _txOn and _txOff flags are set, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) port ends in a TX_OFF state); any non-zero value is respected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) u8 _txOn, // enable transmitting (and continue if there's data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) _txOff, // stop transmitting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) txFlush, // toss outbound data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) txBreak, // turn on break (cleared by _txOn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) rxOn, // turn on receiver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) rxOff, // turn off receiver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) rxFlush, // toss inbound data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) rxForward, // forward all inbound data, NOW (as if fwdLen==1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) returnStatus, // return current status (even if it hasn't changed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) resetDataToggle,// reset data toggle state to DATA0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) enablePort, // start servicing port (move data, check status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) disablePort; // stop servicing port (does implicit tx/rx flush/off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) // defines for bits in lcr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #define USA_DATABITS_5 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) #define USA_DATABITS_6 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) #define USA_DATABITS_7 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) #define USA_DATABITS_8 0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #define STOPBITS_5678_1 0x00 // 1 stop bit for all byte sizes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) #define STOPBITS_5_1p5 0x04 // 1.5 stop bits for 5-bit byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #define STOPBITS_678_2 0x04 // 2 stop bits for 6/7/8-bit byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #define USA_PARITY_NONE 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #define USA_PARITY_ODD 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) #define USA_PARITY_EVEN 0x18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) #define PARITY_1 0x28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) #define PARITY_0 0x38
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) during normal operation, status messages are returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) to the host whenever the board detects changes. In some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) circumstances (e.g. Windows), status messages from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) device cause problems; to shut them off, the host issues
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) a control message with the disableStatusMessages flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) set (to any non-zero value). The device will respond to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) this message, and then suppress further status messages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) it will resume sending status messages any time the host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) sends any control message (either global or port-specific).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) struct keyspan_usa49_globalControlMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) u8 portNumber, // 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) sendGlobalStatus, // 1/2=number of status responses requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) resetStatusToggle, // 1=reset global status toggle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) resetStatusCount, // a cycling value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) remoteWakeupEnable, // 0x10=P1, 0x20=P2, 0x40=P3, 0x80=P4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) disableStatusMessages; // 1=send no status until host talks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) Device->host messages send on the global status endpoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) portNumber message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) ---------- --------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 0x00,0x01,0x02,0x03 portStatusMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 0x80 globalStatusMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 0x81 globalDebugMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) struct keyspan_usa49_portStatusMessage // one for each port
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) u8 portNumber, // 0,1,2,3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) cts, // reports CTS pin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) dcd, // reports DCD pin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) dsr, // reports DSR pin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) ri, // reports RI pin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) _txOff, // transmit has been disabled (by host)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) _txXoff, // transmit is in XOFF state (either host or RX XOFF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) rxEnabled, // as configured by rxOn/rxOff 1=on, 0=off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) controlResponse,// 1=a control message has been processed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) txAck, // ACK (data TX complete)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) rs232valid; // RS-232 signal valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) // bits in RX data message when STAT byte is included
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) #define RXERROR_OVERRUN 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) #define RXERROR_PARITY 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) #define RXERROR_FRAMING 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) #define RXERROR_BREAK 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) struct keyspan_usa49_globalStatusMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) u8 portNumber, // 0x80=globalStatusMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) sendGlobalStatus, // from request, decremented
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) resetStatusCount; // as in request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) struct keyspan_usa49_globalDebugMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) u8 portNumber, // 0x81=globalDebugMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) n, // typically a count/status byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) b; // typically a data byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) // ie: the maximum length of an EZUSB endpoint buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) #define MAX_DATA_LEN 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) // update status approx. 60 times a second (16.6666 ms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) #define STATUS_UPDATE_INTERVAL 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) // status rationing tuning value (each port gets checked each n ms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) #define STATUS_RATION 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) #endif