Linux Audio

Check our new training course

Loading...
v4.6
 
  1/*
  2	usa90msg.h
  3
  4	Copyright (c) 1998-2003 InnoSys Incorporated.  All Rights Reserved
  5	This file is available under a BSD-style copyright
  6
  7	Keyspan USB Async Message Formats for the USA19HS
  8
  9	Redistribution and use in source and binary forms, with or without
 10	modification, are permitted provided that the following conditions are
 11	met:
 12
 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:
 17
 18        	Copyright (c) 1998-2003 InnoSys Incorporated.  All Rights Reserved
 19
 20        	This file is available under a BSD-style copyright
 21
 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.
 25
 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.    
 37
 38	Revisions:
 39
 40	2003feb14		add setTxMode/txMode  and cancelRxXoff to portControl
 41	2003mar21		change name of PARITY_0/1 to add MARK/SPACE
 42*/
 43
 44#ifndef	__USA90MSG__
 45#define	__USA90MSG__
 46
 47struct keyspan_usa90_portControlMessage
 48{
 49	/*
 50		there are three types of "commands" sent in the control message:
 51
 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):
 55	*/
 56
 57	u8	setClocking,	// host requests baud rate be set
 58		baudLo,			// host does baud divisor calculation
 59		baudHi,			// host does baud divisor calculation 
 60		
 61		setLcr,			// host requests lcr be set
 62		lcr,			// use PARITY, STOPBITS, DATABITS below
 63		
 64		setRxMode,		// set receive mode
 65		rxMode,			// RXMODE_DMA or RXMODE_BYHAND
 66
 67		setTxMode,		// set transmit mode
 68		txMode,			// TXMODE_DMA or TXMODE_BYHAND
 69
 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
 78
 79		sendChar,		// host requests char transmitted immediately
 80		txChar,			// character to send
 81
 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
 86
 87	
 88	/*
 89		2.	configuration data which is simply used as is 
 90			and must be specified correctly in every host message.
 91	*/
 92
 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...
 96	/*
 97		3.	Firmware states which cause actions if they change					
 98		and must be specified correctly in every host message.
 99	*/
100
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
105
106	/*
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
111	*/
112
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
117};
118
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
132
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)
138
139#define		RXFLOW_XOFF			0x10	
140#define		RXFLOW_RTS			0x20	
141#define		RXFLOW_DTR			0x40
142#define		RXFLOW_DSR_SENSITIVITY	0x80
143
144#define		RXMODE_BYHAND		0x00	
145#define		RXMODE_DMA			0x02	
146
147#define		TXMODE_BYHAND		0x00	
148#define		TXMODE_DMA			0x02	
149
150
151// all things called "StatusMessage" are sent on the status endpoint
152
153struct keyspan_usa90_portStatusMessage	
154{
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 
169};
170
171// bits in RX data message when STAT byte is included
172
173#define	RXERROR_OVERRUN		0x02
174#define	RXERROR_PARITY		0x04
175#define	RXERROR_FRAMING		0x08
176#define	RXERROR_BREAK		0x10
177
178#define	PORTSTATE_ENABLED	0x80
179#define	PORTSTATE_TXFLUSH	0x01
180#define	PORTSTATE_TXBREAK	0x02
181#define	PORTSTATE_LOOPBACK 	0x04
182
183// MSR bits
184
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
189
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
194
195// ie: the maximum length of an endpoint buffer
196#define		MAX_DATA_LEN			64
197
198#endif
v6.2
  1/* SPDX-License-Identifier: BSD-3-Clause */
  2/*
  3	usa90msg.h
  4
  5	Copyright (c) 1998-2003 InnoSys Incorporated.  All Rights Reserved
  6	This file is available under a BSD-style copyright
  7
  8	Keyspan USB Async Message Formats for the USA19HS
  9
 10	Redistribution and use in source and binary forms, with or without
 11	modification, are permitted provided that the following conditions are
 12	met:
 13
 14	1. Redistributions of source code must retain this licence text
 15   	without modification, this list of conditions, and the following
 16   	disclaimer.  The following copyright notice must appear immediately at
 17   	the beginning of all source files:
 18
 19        	Copyright (c) 1998-2003 InnoSys Incorporated.  All Rights Reserved
 20
 21        	This file is available under a BSD-style copyright
 22
 23	2. The name of InnoSys Incorporated may not be used to endorse or promote
 24   	products derived from this software without specific prior written
 25   	permission.
 26
 27	THIS SOFTWARE IS PROVIDED BY INNOSYS CORP. ``AS IS'' AND ANY EXPRESS OR
 28	IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 29	OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
 30	NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 31	INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 32	(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 33	SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 34	CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 35	LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 36	OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 37	SUCH DAMAGE.    
 38
 39	Revisions:
 40
 41	2003feb14		add setTxMode/txMode  and cancelRxXoff to portControl
 42	2003mar21		change name of PARITY_0/1 to add MARK/SPACE
 43*/
 44
 45#ifndef	__USA90MSG__
 46#define	__USA90MSG__
 47
 48struct keyspan_usa90_portControlMessage
 49{
 50	/*
 51		there are three types of "commands" sent in the control message:
 52
 53		1.	configuration changes which must be requested by setting
 54			the corresponding "set" flag (and should only be requested
 55			when necessary, to reduce overhead on the device):
 56	*/
 57
 58	u8	setClocking,	// host requests baud rate be set
 59		baudLo,			// host does baud divisor calculation
 60		baudHi,			// host does baud divisor calculation 
 61		
 62		setLcr,			// host requests lcr be set
 63		lcr,			// use PARITY, STOPBITS, DATABITS below
 64		
 65		setRxMode,		// set receive mode
 66		rxMode,			// RXMODE_DMA or RXMODE_BYHAND
 67
 68		setTxMode,		// set transmit mode
 69		txMode,			// TXMODE_DMA or TXMODE_BYHAND
 70
 71		setTxFlowControl,	// host requests tx flow control be set
 72		txFlowControl	,	// use TX_FLOW... bits below
 73		setRxFlowControl,	// host requests rx flow control be set
 74		rxFlowControl,	// use RX_FLOW... bits below
 75		sendXoff,		// host requests XOFF transmitted immediately
 76		sendXon,		// host requests XON char transmitted
 77		xonChar,		// specified in current character format
 78		xoffChar,		// specified in current character format
 79
 80		sendChar,		// host requests char transmitted immediately
 81		txChar,			// character to send
 82
 83		setRts,			// host requests RTS output be set
 84		rts,			// 1=on, 0=off
 85		setDtr, 		// host requests DTR output be set
 86		dtr;			// 1=on, 0=off
 87
 88	
 89	/*
 90		2.	configuration data which is simply used as is 
 91			and must be specified correctly in every host message.
 92	*/
 93
 94	u8	rxForwardingLength,  // forward when this number of chars available
 95		rxForwardingTimeout, // (1-31 in ms)
 96		txAckSetting;	   // 0=don't ack, 1=normal, 2-255 TBD...
 97	/*
 98		3.	Firmware states which cause actions if they change					
 99		and must be specified correctly in every host message.
100	*/
101
102	u8	portEnabled,	// 0=disabled, 1=enabled
103		txFlush,		// 0=normal, 1=toss outbound data
104		txBreak,		// 0=break off, 1=break on
105		loopbackMode;	// 0=no loopback, 1=loopback enabled
106
107	/*
108		4.	commands which are flags only; these are processed in order
109			(so that, e.g., if rxFlush and rxForward flags are set, the
110			port will have no data to forward); any non-zero value 
111			is respected
112	*/
113
114	u8	rxFlush,		// toss inbound data
115		rxForward,		// forward all inbound data, NOW (as if fwdLen==1)
116		cancelRxXoff,	// cancel any receive XOFF state (_txXoff)
117		returnStatus;	// return current status NOW
118};
119
120// defines for bits in lcr
121#define		USA_DATABITS_5		0x00
122#define		USA_DATABITS_6		0x01
123#define		USA_DATABITS_7		0x02
124#define		USA_DATABITS_8		0x03
125#define		STOPBITS_5678_1		0x00	// 1 stop bit for all byte sizes
126#define		STOPBITS_5_1p5		0x04	// 1.5 stop bits for 5-bit byte
127#define		STOPBITS_678_2		0x04	// 2 stop bits for 6-8 bit byte
128#define		USA_PARITY_NONE		0x00
129#define		USA_PARITY_ODD		0x08
130#define		USA_PARITY_EVEN		0x18
131#define		PARITY_MARK_1  		0x28   	// force parity MARK
132#define		PARITY_SPACE_0 		0x38	// force parity SPACE
133
134#define		TXFLOW_CTS			0x04	
135#define		TXFLOW_DSR			0x08
136#define		TXFLOW_XOFF			0x01	
137#define		TXFLOW_XOFF_ANY		0x02	
138#define		TXFLOW_XOFF_BITS	(TXFLOW_XOFF | TXFLOW_XOFF_ANY)
139
140#define		RXFLOW_XOFF			0x10	
141#define		RXFLOW_RTS			0x20	
142#define		RXFLOW_DTR			0x40
143#define		RXFLOW_DSR_SENSITIVITY	0x80
144
145#define		RXMODE_BYHAND		0x00	
146#define		RXMODE_DMA			0x02	
147
148#define		TXMODE_BYHAND		0x00	
149#define		TXMODE_DMA			0x02	
150
151
152// all things called "StatusMessage" are sent on the status endpoint
153
154struct keyspan_usa90_portStatusMessage	
155{
156	u8	msr,			// reports the actual MSR register
157		cts,			// reports CTS pin
158		dcd,			// reports DCD pin
159		dsr,			// reports DSR pin
160		ri,				// reports RI pin
161		_txXoff,		// port is in XOFF state (we received XOFF)
162		rxBreak,		// reports break state
163		rxOverrun,		// count of overrun errors (since last reported)
164		rxParity,		// count of parity errors (since last reported)
165		rxFrame,		// count of frame errors (since last reported)
166		portState,		// PORTSTATE_xxx bits (useful for debugging)
167		messageAck,		// message acknowledgement
168		charAck,		// character acknowledgement
169		controlResponse;	// (value = returnStatus) a control message has been processed 
170};
171
172// bits in RX data message when STAT byte is included
173
174#define	RXERROR_OVERRUN		0x02
175#define	RXERROR_PARITY		0x04
176#define	RXERROR_FRAMING		0x08
177#define	RXERROR_BREAK		0x10
178
179#define	PORTSTATE_ENABLED	0x80
180#define	PORTSTATE_TXFLUSH	0x01
181#define	PORTSTATE_TXBREAK	0x02
182#define	PORTSTATE_LOOPBACK 	0x04
183
184// MSR bits
185
186#define USA_MSR_dCTS	  		0x01		// CTS has changed since last report	
187#define USA_MSR_dDSR	  		0x02
188#define USA_MSR_dRI			0x04
189#define USA_MSR_dDCD	  		0x08
190
191#define USA_MSR_CTS			0x10	  	// current state of CTS
192#define USA_MSR_DSR			0x20
193#define USA_USA_MSR_RI			0x40
194#define MSR_DCD				0x80
195
196// ie: the maximum length of an endpoint buffer
197#define		MAX_DATA_LEN			64
198
199#endif