^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) usa26msg.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 USA28X
^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) Third revision: USA28X version (aka USA26)
^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) indicates 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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) revision history:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) 1999feb10 add reportHskiaChanges to allow us to ignore them
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) 1999feb10 add txAckThreshold for fast+loose throughput enhancement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) 1999mar30 beef up support for RX error reporting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 1999apr14 add resetDataToggle to control message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 2000jan04 merge with usa17msg.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 2000jun01 add extended BSD-style copyright text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 2001jul05 change message format to improve OVERRUN case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) Note on shared names:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) In the case of fields which have been merged between the USA17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) and USA26 definitions, the USA26 definition is the first part
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) of the name and the USA17 definition is the second part of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) name; both meanings are described below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #ifndef __USA26MSG__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #define __USA26MSG__
^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) struct keyspan_usa26_portControlMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) there are three types of "commands" sent in the control message:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 1. configuration changes which must be requested by setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) the corresponding "set" flag (and should only be requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) when necessary, to reduce overhead on the USA26):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) u8 setClocking, // BOTH: host requests baud rate be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) baudLo, // BOTH: host does baud divisor calculation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) baudHi, // BOTH: baudHi is only used for first port (gives lower rates)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) externalClock_txClocking,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) // USA26: 0=internal, other=external
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) // USA17: 0=internal, other=external/RI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) rxClocking, // USA17: 0=internal, 1=external/RI, other=external/DSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) setLcr, // BOTH: host requests lcr be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) lcr, // BOTH: use PARITY, STOPBITS, DATABITS below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) setFlowControl, // BOTH: host requests flow control be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) ctsFlowControl, // BOTH: 1=use CTS flow control, 0=don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) xonFlowControl, // BOTH: 1=use XON/XOFF flow control, 0=don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) xonChar, // BOTH: specified in current character format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) xoffChar, // BOTH: specified in current character format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) setTxTriState_setRts,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) // USA26: host requests TX tri-state be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) // USA17: host requests RTS output be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) txTriState_rts, // BOTH: 1=active (normal), 0=tristate (off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) setHskoa_setDtr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) // USA26: host requests HSKOA output be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) // USA17: host requests DTR output be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) hskoa_dtr, // BOTH: 1=on, 0=off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) setPrescaler, // USA26: host requests prescalar be set (default: 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) prescaler; // BOTH: specified as N/8; values 8-ff are valid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) // must be set any time internal baud rate is set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) // must not be set when external clocking is used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) // note: in USA17, prescaler is applied whenever
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) // setClocking is requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 3. configuration data which is simply used as is (no overhead,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) but must be specified correctly in every host message).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) u8 forwardingLength, // BOTH: forward when this number of chars available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) reportHskiaChanges_dsrFlowControl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) // USA26: 1=normal; 0=ignore external clock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) // USA17: 1=use DSR flow control, 0=don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) txAckThreshold, // BOTH: 0=not allowed, 1=normal, 2-255 deliver ACK faster
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) loopbackMode; // BOTH: 0=no loopback, 1=loopback enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 4. commands which are flags only; these are processed in order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) (so that, e.g., if both _txOn and _txOff flags are set, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) port ends in a TX_OFF state); any non-zero value is respected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) u8 _txOn, // BOTH: enable transmitting (and continue if there's data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) _txOff, // BOTH: stop transmitting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) txFlush, // BOTH: toss outbound data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) txBreak, // BOTH: turn on break (cleared by _txOn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) rxOn, // BOTH: turn on receiver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) rxOff, // BOTH: turn off receiver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) rxFlush, // BOTH: toss inbound data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) rxForward, // BOTH: forward all inbound data, NOW (as if fwdLen==1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) returnStatus, // BOTH: return current status (even if it hasn't changed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) resetDataToggle;// BOTH: reset data toggle state to DATA0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) // defines for bits in lcr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) #define USA_DATABITS_5 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) #define USA_DATABITS_6 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) #define USA_DATABITS_7 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #define USA_DATABITS_8 0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) #define STOPBITS_5678_1 0x00 // 1 stop bit for all byte sizes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) #define STOPBITS_5_1p5 0x04 // 1.5 stop bits for 5-bit byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) #define STOPBITS_678_2 0x04 // 2 stop bits for 6/7/8-bit byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #define USA_PARITY_NONE 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) #define USA_PARITY_ODD 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #define USA_PARITY_EVEN 0x18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #define PARITY_1 0x28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #define PARITY_0 0x38
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) // all things called "StatusMessage" are sent on the status endpoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) struct keyspan_usa26_portStatusMessage // one for each port
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) u8 port, // BOTH: 0=first, 1=second, other=see below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) hskia_cts, // USA26: reports HSKIA pin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) // USA17: reports CTS pin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) gpia_dcd, // USA26: reports GPIA pin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) // USA17: reports DCD pin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) dsr, // USA17: reports DSR pin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) ri, // USA17: reports RI pin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) _txOff, // port has been disabled (by host)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) _txXoff, // port is in XOFF state (either host or RX XOFF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) rxEnabled, // as configured by rxOn/rxOff 1=on, 0=off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) controlResponse;// 1=a control message has been processed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) // bits in RX data message when STAT byte is included
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) #define RXERROR_OVERRUN 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) #define RXERROR_PARITY 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) #define RXERROR_FRAMING 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) #define RXERROR_BREAK 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) struct keyspan_usa26_globalControlMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) u8 sendGlobalStatus, // 2=request for two status responses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) resetStatusToggle, // 1=reset global status toggle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) resetStatusCount; // a cycling value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) struct keyspan_usa26_globalStatusMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) u8 port, // 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) sendGlobalStatus, // from request, decremented
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) resetStatusCount; // as in request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) struct keyspan_usa26_globalDebugMessage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) u8 port, // 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) // ie: the maximum length of an EZUSB endpoint buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) #define MAX_DATA_LEN 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) // update status approx. 60 times a second (16.6666 ms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) #define STATUS_UPDATE_INTERVAL 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) // status rationing tuning value (each port gets checked each n ms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) #define STATUS_RATION 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)