xref: /reactos/sdk/include/psdk/ntddser.h (revision c2c66aff)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * ntddser.h
3*c2c66affSColin Finck  *
4*c2c66affSColin Finck  * Serial port driver interface
5*c2c66affSColin Finck  *
6*c2c66affSColin Finck  * This file is part of the w32api package.
7*c2c66affSColin Finck  *
8*c2c66affSColin Finck  * Contributors:
9*c2c66affSColin Finck  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10*c2c66affSColin Finck  *
11*c2c66affSColin Finck  * THIS SOFTWARE IS NOT COPYRIGHTED
12*c2c66affSColin Finck  *
13*c2c66affSColin Finck  * This source code is offered for use in the public domain. You may
14*c2c66affSColin Finck  * use, modify or distribute it freely.
15*c2c66affSColin Finck  *
16*c2c66affSColin Finck  * This code is distributed in the hope that it will be useful but
17*c2c66affSColin Finck  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18*c2c66affSColin Finck  * DISCLAIMED. This includes but is not limited to warranties of
19*c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20*c2c66affSColin Finck  *
21*c2c66affSColin Finck  */
22*c2c66affSColin Finck 
23*c2c66affSColin Finck #ifndef _NTDDSER_
24*c2c66affSColin Finck #define _NTDDSER_
25*c2c66affSColin Finck 
26*c2c66affSColin Finck #ifdef __cplusplus
27*c2c66affSColin Finck extern "C" {
28*c2c66affSColin Finck #endif
29*c2c66affSColin Finck 
30*c2c66affSColin Finck /* GUIDs */
31*c2c66affSColin Finck 
32*c2c66affSColin Finck DEFINE_GUID(GUID_DEVINTERFACE_COMPORT,
33*c2c66affSColin Finck   0x86e0d1e0L, 0x8089, 0x11d0, 0x9c, 0xe4, 0x08, 0x00, 0x3e, 0x30, 0x1f, 0x73);
34*c2c66affSColin Finck 
35*c2c66affSColin Finck #define GUID_CLASS_COMPORT GUID_DEVINTERFACE_COMPORT
36*c2c66affSColin Finck 
37*c2c66affSColin Finck DEFINE_GUID(GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR,
38*c2c66affSColin Finck   0x4D36E978L, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18);
39*c2c66affSColin Finck 
40*c2c66affSColin Finck #define GUID_SERENUM_BUS_ENUMERATOR GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR
41*c2c66affSColin Finck 
42*c2c66affSColin Finck #define IOCTL_SERIAL_CLEAR_STATS \
43*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 36, METHOD_BUFFERED, FILE_ANY_ACCESS)
44*c2c66affSColin Finck #define IOCTL_SERIAL_CLR_DTR \
45*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
46*c2c66affSColin Finck #define IOCTL_SERIAL_CLR_RTS \
47*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 13, METHOD_BUFFERED, FILE_ANY_ACCESS)
48*c2c66affSColin Finck #define IOCTL_SERIAL_CONFIG_SIZE \
49*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 32, METHOD_BUFFERED, FILE_ANY_ACCESS)
50*c2c66affSColin Finck #define IOCTL_SERIAL_GET_BAUD_RATE \
51*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
52*c2c66affSColin Finck #define IOCTL_SERIAL_GET_CHARS \
53*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
54*c2c66affSColin Finck #define IOCTL_SERIAL_GET_COMMSTATUS \
55*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 27, METHOD_BUFFERED, FILE_ANY_ACCESS)
56*c2c66affSColin Finck #define IOCTL_SERIAL_GET_DTRRTS \
57*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
58*c2c66affSColin Finck #define IOCTL_SERIAL_GET_HANDFLOW \
59*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
60*c2c66affSColin Finck #define IOCTL_SERIAL_GET_LINE_CONTROL \
61*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
62*c2c66affSColin Finck #define IOCTL_SERIAL_GET_MODEM_CONTROL \
63*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 37, METHOD_BUFFERED, FILE_ANY_ACCESS)
64*c2c66affSColin Finck #define IOCTL_SERIAL_GET_MODEMSTATUS \
65*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 26, METHOD_BUFFERED, FILE_ANY_ACCESS)
66*c2c66affSColin Finck #define IOCTL_SERIAL_GET_PROPERTIES \
67*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 29, METHOD_BUFFERED, FILE_ANY_ACCESS)
68*c2c66affSColin Finck #define IOCTL_SERIAL_GET_STATS \
69*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 35, METHOD_BUFFERED, FILE_ANY_ACCESS)
70*c2c66affSColin Finck #define IOCTL_SERIAL_GET_TIMEOUTS \
71*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
72*c2c66affSColin Finck #define IOCTL_SERIAL_GET_WAIT_MASK \
73*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 16, METHOD_BUFFERED, FILE_ANY_ACCESS)
74*c2c66affSColin Finck #define IOCTL_SERIAL_IMMEDIATE_CHAR \
75*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
76*c2c66affSColin Finck #define IOCTL_SERIAL_LSRMST_INSERT \
77*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 31, METHOD_BUFFERED, FILE_ANY_ACCESS)
78*c2c66affSColin Finck #define IOCTL_SERIAL_PURGE \
79*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 19, METHOD_BUFFERED, FILE_ANY_ACCESS)
80*c2c66affSColin Finck #define IOCTL_SERIAL_RESET_DEVICE \
81*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
82*c2c66affSColin Finck #define IOCTL_SERIAL_SET_BAUD_RATE \
83*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
84*c2c66affSColin Finck #define IOCTL_SERIAL_SET_BREAK_ON \
85*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
86*c2c66affSColin Finck #define IOCTL_SERIAL_SET_BREAK_OFF \
87*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
88*c2c66affSColin Finck #define IOCTL_SERIAL_SET_CHARS \
89*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
90*c2c66affSColin Finck #define IOCTL_SERIAL_SET_DTR \
91*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
92*c2c66affSColin Finck #define IOCTL_SERIAL_SET_FIFO_CONTROL \
93*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 39, METHOD_BUFFERED, FILE_ANY_ACCESS)
94*c2c66affSColin Finck #define IOCTL_SERIAL_SET_HANDFLOW \
95*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)
96*c2c66affSColin Finck #define IOCTL_SERIAL_SET_LINE_CONTROL \
97*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
98*c2c66affSColin Finck #define IOCTL_SERIAL_SET_MODEM_CONTROL \
99*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 38, METHOD_BUFFERED, FILE_ANY_ACCESS)
100*c2c66affSColin Finck #define IOCTL_SERIAL_SET_QUEUE_SIZE \
101*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
102*c2c66affSColin Finck #define IOCTL_SERIAL_SET_RTS \
103*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
104*c2c66affSColin Finck #define IOCTL_SERIAL_SET_TIMEOUTS \
105*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
106*c2c66affSColin Finck #define IOCTL_SERIAL_SET_WAIT_MASK \
107*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 17, METHOD_BUFFERED, FILE_ANY_ACCESS)
108*c2c66affSColin Finck #define IOCTL_SERIAL_SET_XOFF \
109*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 14, METHOD_BUFFERED, FILE_ANY_ACCESS)
110*c2c66affSColin Finck #define IOCTL_SERIAL_SET_XON \
111*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
112*c2c66affSColin Finck #define IOCTL_SERIAL_WAIT_ON_MASK \
113*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 18, METHOD_BUFFERED, FILE_ANY_ACCESS)
114*c2c66affSColin Finck #define IOCTL_SERIAL_XOFF_COUNTER \
115*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 28, METHOD_BUFFERED, FILE_ANY_ACCESS)
116*c2c66affSColin Finck 
117*c2c66affSColin Finck #define IOCTL_SERIAL_INTERNAL_BASIC_SETTINGS \
118*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
119*c2c66affSColin Finck #define IOCTL_SERIAL_INTERNAL_CANCEL_WAIT_WAKE \
120*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
121*c2c66affSColin Finck #define IOCTL_SERIAL_INTERNAL_DO_WAIT_WAKE \
122*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
123*c2c66affSColin Finck #define IOCTL_SERIAL_INTERNAL_RESTORE_SETTINGS \
124*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERIAL_PORT, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
125*c2c66affSColin Finck 
126*c2c66affSColin Finck #define IOCTL_SERENUM_PORT_DESC \
127*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERENUM, 130, METHOD_BUFFERED, FILE_ANY_ACCESS)
128*c2c66affSColin Finck #define IOCTL_SERENUM_GET_PORT_NAME \
129*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERENUM, 131, METHOD_BUFFERED, FILE_ANY_ACCESS)
130*c2c66affSColin Finck 
131*c2c66affSColin Finck #define IOCTL_INTERNAL_SERENUM_REMOVE_SELF \
132*c2c66affSColin Finck   CTL_CODE (FILE_DEVICE_SERENUM, 129, METHOD_NEITHER, FILE_ANY_ACCESS)
133*c2c66affSColin Finck 
134*c2c66affSColin Finck 
135*c2c66affSColin Finck typedef struct _SERIAL_BAUD_RATE {
136*c2c66affSColin Finck   ULONG  BaudRate;
137*c2c66affSColin Finck } SERIAL_BAUD_RATE, *PSERIAL_BAUD_RATE;
138*c2c66affSColin Finck 
139*c2c66affSColin Finck /* SERIAL_BAUD_RATE.BaudRate constants */
140*c2c66affSColin Finck #define SERIAL_BAUD_075                   0x00000001
141*c2c66affSColin Finck #define SERIAL_BAUD_110                   0x00000002
142*c2c66affSColin Finck #define SERIAL_BAUD_134_5                 0x00000004
143*c2c66affSColin Finck #define SERIAL_BAUD_150                   0x00000008
144*c2c66affSColin Finck #define SERIAL_BAUD_300                   0x00000010
145*c2c66affSColin Finck #define SERIAL_BAUD_600                   0x00000020
146*c2c66affSColin Finck #define SERIAL_BAUD_1200                  0x00000040
147*c2c66affSColin Finck #define SERIAL_BAUD_1800                  0x00000080
148*c2c66affSColin Finck #define SERIAL_BAUD_2400                  0x00000100
149*c2c66affSColin Finck #define SERIAL_BAUD_4800                  0x00000200
150*c2c66affSColin Finck #define SERIAL_BAUD_7200                  0x00000400
151*c2c66affSColin Finck #define SERIAL_BAUD_9600                  0x00000800
152*c2c66affSColin Finck #define SERIAL_BAUD_14400                 0x00001000
153*c2c66affSColin Finck #define SERIAL_BAUD_19200                 0x00002000
154*c2c66affSColin Finck #define SERIAL_BAUD_38400                 0x00004000
155*c2c66affSColin Finck #define SERIAL_BAUD_56K                   0x00008000
156*c2c66affSColin Finck #define SERIAL_BAUD_128K                  0x00010000
157*c2c66affSColin Finck #define SERIAL_BAUD_115200                0x00020000
158*c2c66affSColin Finck #define SERIAL_BAUD_57600                 0x00040000
159*c2c66affSColin Finck #define SERIAL_BAUD_USER                  0x10000000
160*c2c66affSColin Finck 
161*c2c66affSColin Finck typedef struct _SERIAL_CHARS {
162*c2c66affSColin Finck   UCHAR  EofChar;
163*c2c66affSColin Finck   UCHAR  ErrorChar;
164*c2c66affSColin Finck   UCHAR  BreakChar;
165*c2c66affSColin Finck   UCHAR  EventChar;
166*c2c66affSColin Finck   UCHAR  XonChar;
167*c2c66affSColin Finck   UCHAR  XoffChar;
168*c2c66affSColin Finck } SERIAL_CHARS, *PSERIAL_CHARS;
169*c2c66affSColin Finck 
170*c2c66affSColin Finck typedef struct _SERIAL_STATUS {
171*c2c66affSColin Finck   ULONG  Errors;
172*c2c66affSColin Finck   ULONG  HoldReasons;
173*c2c66affSColin Finck   ULONG  AmountInInQueue;
174*c2c66affSColin Finck   ULONG  AmountInOutQueue;
175*c2c66affSColin Finck   BOOLEAN  EofReceived;
176*c2c66affSColin Finck   BOOLEAN  WaitForImmediate;
177*c2c66affSColin Finck } SERIAL_STATUS, *PSERIAL_STATUS;
178*c2c66affSColin Finck 
179*c2c66affSColin Finck typedef struct _SERIAL_HANDFLOW {
180*c2c66affSColin Finck 	ULONG  ControlHandShake;
181*c2c66affSColin Finck 	ULONG  FlowReplace;
182*c2c66affSColin Finck 	LONG  XonLimit;
183*c2c66affSColin Finck 	LONG  XoffLimit;
184*c2c66affSColin Finck } SERIAL_HANDFLOW, *PSERIAL_HANDFLOW;
185*c2c66affSColin Finck 
186*c2c66affSColin Finck #define SERIAL_DTR_MASK                   0x00000003
187*c2c66affSColin Finck #define SERIAL_DTR_CONTROL                0x00000001
188*c2c66affSColin Finck #define SERIAL_DTR_HANDSHAKE              0x00000002
189*c2c66affSColin Finck #define SERIAL_CTS_HANDSHAKE              0x00000008
190*c2c66affSColin Finck #define SERIAL_DSR_HANDSHAKE              0x00000010
191*c2c66affSColin Finck #define SERIAL_DCD_HANDSHAKE              0x00000020
192*c2c66affSColin Finck #define SERIAL_OUT_HANDSHAKEMASK          0x00000038
193*c2c66affSColin Finck #define SERIAL_DSR_SENSITIVITY            0x00000040
194*c2c66affSColin Finck #define SERIAL_ERROR_ABORT                0x80000000
195*c2c66affSColin Finck #define SERIAL_CONTROL_INVALID            0x7fffff84
196*c2c66affSColin Finck #define SERIAL_AUTO_TRANSMIT              0x00000001
197*c2c66affSColin Finck #define SERIAL_AUTO_RECEIVE               0x00000002
198*c2c66affSColin Finck #define SERIAL_ERROR_CHAR                 0x00000004
199*c2c66affSColin Finck #define SERIAL_NULL_STRIPPING             0x00000008
200*c2c66affSColin Finck #define SERIAL_BREAK_CHAR                 0x00000010
201*c2c66affSColin Finck #define SERIAL_RTS_MASK                   0x000000c0
202*c2c66affSColin Finck #define SERIAL_RTS_CONTROL                0x00000040
203*c2c66affSColin Finck #define SERIAL_RTS_HANDSHAKE              0x00000080
204*c2c66affSColin Finck #define SERIAL_TRANSMIT_TOGGLE            0x000000c0
205*c2c66affSColin Finck #define SERIAL_XOFF_CONTINUE              0x80000000
206*c2c66affSColin Finck #define SERIAL_FLOW_INVALID               0x7fffff20
207*c2c66affSColin Finck 
208*c2c66affSColin Finck typedef struct _SERIAL_LINE_CONTROL {
209*c2c66affSColin Finck   UCHAR  StopBits;
210*c2c66affSColin Finck   UCHAR  Parity;
211*c2c66affSColin Finck   UCHAR  WordLength;
212*c2c66affSColin Finck } SERIAL_LINE_CONTROL, *PSERIAL_LINE_CONTROL;
213*c2c66affSColin Finck 
214*c2c66affSColin Finck /* SERIAL_LINE_CONTROL.StopBits constants */
215*c2c66affSColin Finck #define STOP_BIT_1                        0x00
216*c2c66affSColin Finck #define STOP_BITS_1_5                     0x01
217*c2c66affSColin Finck #define STOP_BITS_2                       0x02
218*c2c66affSColin Finck 
219*c2c66affSColin Finck /* SERIAL_LINE_CONTROL.Parity constants */
220*c2c66affSColin Finck #define NO_PARITY                         0x00
221*c2c66affSColin Finck #define ODD_PARITY                        0x01
222*c2c66affSColin Finck #define EVEN_PARITY                       0x02
223*c2c66affSColin Finck #define MARK_PARITY                       0x03
224*c2c66affSColin Finck #define SPACE_PARITY                      0x04
225*c2c66affSColin Finck 
226*c2c66affSColin Finck /* IOCTL_SERIAL_(GET_MODEM_CONTROL, SET_MODEM_CONTROL) flags */
227*c2c66affSColin Finck #define SERIAL_IOC_MCR_DTR                0x00000001
228*c2c66affSColin Finck #define SERIAL_IOC_MCR_RTS                0x00000002
229*c2c66affSColin Finck #define SERIAL_IOC_MCR_OUT1               0x00000004
230*c2c66affSColin Finck #define SERIAL_IOC_MCR_OUT2               0x00000008
231*c2c66affSColin Finck #define SERIAL_IOC_MCR_LOOP               0x00000010
232*c2c66affSColin Finck 
233*c2c66affSColin Finck typedef struct _SERIAL_COMMPROP {
234*c2c66affSColin Finck   USHORT  PacketLength;
235*c2c66affSColin Finck   USHORT  PacketVersion;
236*c2c66affSColin Finck   ULONG  ServiceMask;
237*c2c66affSColin Finck   ULONG  Reserved1;
238*c2c66affSColin Finck   ULONG  MaxTxQueue;
239*c2c66affSColin Finck   ULONG  MaxRxQueue;
240*c2c66affSColin Finck   ULONG  MaxBaud;
241*c2c66affSColin Finck   ULONG  ProvSubType;
242*c2c66affSColin Finck   ULONG  ProvCapabilities;
243*c2c66affSColin Finck   ULONG  SettableParams;
244*c2c66affSColin Finck   ULONG  SettableBaud;
245*c2c66affSColin Finck   USHORT  SettableData;
246*c2c66affSColin Finck   USHORT  SettableStopParity;
247*c2c66affSColin Finck   ULONG  CurrentTxQueue;
248*c2c66affSColin Finck   ULONG  CurrentRxQueue;
249*c2c66affSColin Finck   ULONG  ProvSpec1;
250*c2c66affSColin Finck   ULONG  ProvSpec2;
251*c2c66affSColin Finck   WCHAR  ProvChar[1];
252*c2c66affSColin Finck } SERIAL_COMMPROP, *PSERIAL_COMMPROP;
253*c2c66affSColin Finck 
254*c2c66affSColin Finck /* SERIAL_COMMPROP.SettableParams flags */
255*c2c66affSColin Finck #define SERIAL_SP_PARITY                  0x0001
256*c2c66affSColin Finck #define SERIAL_SP_BAUD                    0x0002
257*c2c66affSColin Finck #define SERIAL_SP_DATABITS                0x0004
258*c2c66affSColin Finck #define SERIAL_SP_STOPBITS                0x0008
259*c2c66affSColin Finck #define SERIAL_SP_HANDSHAKING             0x0010
260*c2c66affSColin Finck #define SERIAL_SP_PARITY_CHECK            0x0020
261*c2c66affSColin Finck #define SERIAL_SP_CARRIER_DETECT          0x0040
262*c2c66affSColin Finck 
263*c2c66affSColin Finck /* SERIAL_COMMPROP.ProvCapabilities flags */
264*c2c66affSColin Finck #define SERIAL_PCF_DTRDSR                 0x00000001
265*c2c66affSColin Finck #define SERIAL_PCF_RTSCTS                 0x00000002
266*c2c66affSColin Finck #define SERIAL_PCF_CD                     0x00000004
267*c2c66affSColin Finck #define SERIAL_PCF_PARITY_CHECK           0x00000008
268*c2c66affSColin Finck #define SERIAL_PCF_XONXOFF                0x00000010
269*c2c66affSColin Finck #define SERIAL_PCF_SETXCHAR               0x00000020
270*c2c66affSColin Finck #define SERIAL_PCF_TOTALTIMEOUTS          0x00000040
271*c2c66affSColin Finck #define SERIAL_PCF_INTTIMEOUTS            0x00000080
272*c2c66affSColin Finck #define SERIAL_PCF_SPECIALCHARS           0x00000100
273*c2c66affSColin Finck #define SERIAL_PCF_16BITMODE              0x00000200
274*c2c66affSColin Finck 
275*c2c66affSColin Finck /* SERIAL_COMMPROP.SettableData flags */
276*c2c66affSColin Finck #define SERIAL_DATABITS_5                 0x0001
277*c2c66affSColin Finck #define SERIAL_DATABITS_6                 0x0002
278*c2c66affSColin Finck #define SERIAL_DATABITS_7                 0x0004
279*c2c66affSColin Finck #define SERIAL_DATABITS_8                 0x0008
280*c2c66affSColin Finck #define SERIAL_DATABITS_16                0x0010
281*c2c66affSColin Finck #define SERIAL_DATABITS_16X               0x0020
282*c2c66affSColin Finck 
283*c2c66affSColin Finck /* SERIAL_COMMPROP.SettableStopParity flags */
284*c2c66affSColin Finck #define SERIAL_STOPBITS_10                0x0001
285*c2c66affSColin Finck #define SERIAL_STOPBITS_15                0x0002
286*c2c66affSColin Finck #define SERIAL_STOPBITS_20                0x0004
287*c2c66affSColin Finck #define SERIAL_PARITY_NONE                0x0100
288*c2c66affSColin Finck #define SERIAL_PARITY_ODD                 0x0200
289*c2c66affSColin Finck #define SERIAL_PARITY_EVEN                0x0400
290*c2c66affSColin Finck #define SERIAL_PARITY_MARK                0x0800
291*c2c66affSColin Finck #define SERIAL_PARITY_SPACE               0x1000
292*c2c66affSColin Finck 
293*c2c66affSColin Finck typedef struct _SERIALPERF_STATS {
294*c2c66affSColin Finck   ULONG  ReceivedCount;
295*c2c66affSColin Finck   ULONG  TransmittedCount;
296*c2c66affSColin Finck   ULONG  FrameErrorCount;
297*c2c66affSColin Finck   ULONG  SerialOverrunErrorCount;
298*c2c66affSColin Finck   ULONG  BufferOverrunErrorCount;
299*c2c66affSColin Finck   ULONG  ParityErrorCount;
300*c2c66affSColin Finck } SERIALPERF_STATS, *PSERIALPERF_STATS;
301*c2c66affSColin Finck 
302*c2c66affSColin Finck typedef struct _SERIAL_TIMEOUTS {
303*c2c66affSColin Finck   ULONG  ReadIntervalTimeout;
304*c2c66affSColin Finck   ULONG  ReadTotalTimeoutMultiplier;
305*c2c66affSColin Finck   ULONG  ReadTotalTimeoutConstant;
306*c2c66affSColin Finck   ULONG  WriteTotalTimeoutMultiplier;
307*c2c66affSColin Finck   ULONG  WriteTotalTimeoutConstant;
308*c2c66affSColin Finck } SERIAL_TIMEOUTS, *PSERIAL_TIMEOUTS;
309*c2c66affSColin Finck 
310*c2c66affSColin Finck /* IOCTL_SERIAL_(GET_WAIT_MASK, SET_WAIT_MASK, WAIT_ON_MASK) flags */
311*c2c66affSColin Finck #define SERIAL_EV_RXCHAR                  0x0001
312*c2c66affSColin Finck #define SERIAL_EV_RXFLAG                  0x0002
313*c2c66affSColin Finck #define SERIAL_EV_TXEMPTY                 0x0004
314*c2c66affSColin Finck #define SERIAL_EV_CTS                     0x0008
315*c2c66affSColin Finck #define SERIAL_EV_DSR                     0x0010
316*c2c66affSColin Finck #define SERIAL_EV_RLSD                    0x0020
317*c2c66affSColin Finck #define SERIAL_EV_BREAK                   0x0040
318*c2c66affSColin Finck #define SERIAL_EV_ERR                     0x0080
319*c2c66affSColin Finck #define SERIAL_EV_RING                    0x0100
320*c2c66affSColin Finck #define SERIAL_EV_PERR                    0x0200
321*c2c66affSColin Finck #define SERIAL_EV_RX80FULL                0x0400
322*c2c66affSColin Finck #define SERIAL_EV_EVENT1                  0x0800
323*c2c66affSColin Finck #define SERIAL_EV_EVENT2                  0x1000
324*c2c66affSColin Finck 
325*c2c66affSColin Finck /* IOCTL_SERIAL_LSRMST_INSERT constants */
326*c2c66affSColin Finck #define SERIAL_LSRMST_LSR_DATA            0x01
327*c2c66affSColin Finck #define SERIAL_LSRMST_LSR_NODATA          0x02
328*c2c66affSColin Finck #define SERIAL_LSRMST_MST                 0x03
329*c2c66affSColin Finck #define SERIAL_LSRMST_ESCAPE              0x00
330*c2c66affSColin Finck 
331*c2c66affSColin Finck /* IOCTL_SERIAL_PURGE constants */
332*c2c66affSColin Finck #define SERIAL_PURGE_TXABORT              0x00000001
333*c2c66affSColin Finck #define SERIAL_PURGE_RXABORT              0x00000002
334*c2c66affSColin Finck #define SERIAL_PURGE_TXCLEAR              0x00000004
335*c2c66affSColin Finck #define SERIAL_PURGE_RXCLEAR              0x00000008
336*c2c66affSColin Finck 
337*c2c66affSColin Finck /* IOCTL_SERIAL_SET_FIFO_CONTROL constants */
338*c2c66affSColin Finck #define SERIAL_IOC_FCR_FIFO_ENABLE        0x00000001
339*c2c66affSColin Finck #define SERIAL_IOC_FCR_RCVR_RESET         0x00000002
340*c2c66affSColin Finck #define SERIAL_IOC_FCR_XMIT_RESET         0x00000004
341*c2c66affSColin Finck #define SERIAL_IOC_FCR_DMA_MODE           0x00000008
342*c2c66affSColin Finck #define SERIAL_IOC_FCR_RES1               0x00000010
343*c2c66affSColin Finck #define SERIAL_IOC_FCR_RES2               0x00000020
344*c2c66affSColin Finck #define SERIAL_IOC_FCR_RCVR_TRIGGER_LSB   0x00000040
345*c2c66affSColin Finck #define SERIAL_IOC_FCR_RCVR_TRIGGER_MSB   0x00000080
346*c2c66affSColin Finck 
347*c2c66affSColin Finck typedef struct _SERIAL_QUEUE_SIZE {
348*c2c66affSColin Finck   ULONG  InSize;
349*c2c66affSColin Finck   ULONG  OutSize;
350*c2c66affSColin Finck } SERIAL_QUEUE_SIZE, *PSERIAL_QUEUE_SIZE;
351*c2c66affSColin Finck 
352*c2c66affSColin Finck typedef struct _SERIAL_XOFF_COUNTER {
353*c2c66affSColin Finck 	ULONG  Timeout;
354*c2c66affSColin Finck 	LONG  Counter;
355*c2c66affSColin Finck 	UCHAR  XoffChar;
356*c2c66affSColin Finck } SERIAL_XOFF_COUNTER, *PSERIAL_XOFF_COUNTER;
357*c2c66affSColin Finck 
358*c2c66affSColin Finck typedef struct _SERIAL_BASIC_SETTINGS {
359*c2c66affSColin Finck 	SERIAL_TIMEOUTS  Timeouts;
360*c2c66affSColin Finck 	SERIAL_HANDFLOW  HandFlow;
361*c2c66affSColin Finck 	ULONG  RxFifo;
362*c2c66affSColin Finck 	ULONG  TxFifo;
363*c2c66affSColin Finck } SERIAL_BASIC_SETTINGS, *PSERIAL_BASIC_SETTINGS;
364*c2c66affSColin Finck 
365*c2c66affSColin Finck typedef struct _SERENUM_PORT_DESC {
366*c2c66affSColin Finck 	ULONG  Size;
367*c2c66affSColin Finck 	PVOID  PortHandle;
368*c2c66affSColin Finck 	PHYSICAL_ADDRESS  PortAddress;
369*c2c66affSColin Finck 	USHORT  Reserved[1];
370*c2c66affSColin Finck } SERENUM_PORT_DESC, *PSERENUM_PORT_DESC;
371*c2c66affSColin Finck 
372*c2c66affSColin Finck typedef UCHAR
373*c2c66affSColin Finck (NTAPI*PSERENUM_READPORT)(
374*c2c66affSColin Finck   PVOID  SerPortAddress);
375*c2c66affSColin Finck 
376*c2c66affSColin Finck typedef VOID
377*c2c66affSColin Finck (NTAPI*PSERENUM_WRITEPORT)(
378*c2c66affSColin Finck   PVOID  SerPortAddress,
379*c2c66affSColin Finck   UCHAR  Value);
380*c2c66affSColin Finck 
381*c2c66affSColin Finck typedef enum _SERENUM_PORTION {
382*c2c66affSColin Finck   SerenumFirstHalf,
383*c2c66affSColin Finck   SerenumSecondHalf,
384*c2c66affSColin Finck   SerenumWhole
385*c2c66affSColin Finck } SERENUM_PORTION;
386*c2c66affSColin Finck 
387*c2c66affSColin Finck typedef struct _SERENUM_PORT_PARAMETERS {
388*c2c66affSColin Finck   ULONG  Size;
389*c2c66affSColin Finck   PSERENUM_READPORT  ReadAccessor;
390*c2c66affSColin Finck   PSERENUM_WRITEPORT  WriteAccessor;
391*c2c66affSColin Finck   PVOID  SerPortAddress;
392*c2c66affSColin Finck   PVOID  HardwareHandle;
393*c2c66affSColin Finck   SERENUM_PORTION  Portion;
394*c2c66affSColin Finck   USHORT  NumberAxis;
395*c2c66affSColin Finck   USHORT  Reserved[3];
396*c2c66affSColin Finck } SERENUM_PORT_PARAMETERS, *PSERENUM_PORT_PARAMETERS;
397*c2c66affSColin Finck 
398*c2c66affSColin Finck #define SERIAL_ERROR_BREAK                0x00000001
399*c2c66affSColin Finck #define SERIAL_ERROR_FRAMING              0x00000002
400*c2c66affSColin Finck #define SERIAL_ERROR_OVERRUN              0x00000004
401*c2c66affSColin Finck #define SERIAL_ERROR_QUEUEOVERRUN         0x00000008
402*c2c66affSColin Finck #define SERIAL_ERROR_PARITY               0x00000010
403*c2c66affSColin Finck 
404*c2c66affSColin Finck #define SERIAL_SP_UNSPECIFIED             0x00000000
405*c2c66affSColin Finck #define SERIAL_SP_RS232                   0x00000001
406*c2c66affSColin Finck #define SERIAL_SP_PARALLEL                0x00000002
407*c2c66affSColin Finck #define SERIAL_SP_RS422                   0x00000003
408*c2c66affSColin Finck #define SERIAL_SP_RS423                   0x00000004
409*c2c66affSColin Finck #define SERIAL_SP_RS449                   0x00000005
410*c2c66affSColin Finck #define SERIAL_SP_MODEM                   0X00000006
411*c2c66affSColin Finck #define SERIAL_SP_FAX                     0x00000021
412*c2c66affSColin Finck #define SERIAL_SP_SCANNER                 0x00000022
413*c2c66affSColin Finck #define SERIAL_SP_BRIDGE                  0x00000100
414*c2c66affSColin Finck #define SERIAL_SP_LAT                     0x00000101
415*c2c66affSColin Finck #define SERIAL_SP_TELNET                  0x00000102
416*c2c66affSColin Finck #define SERIAL_SP_X25                     0x00000103
417*c2c66affSColin Finck #define SERIAL_SP_SERIALCOMM              0x00000001
418*c2c66affSColin Finck 
419*c2c66affSColin Finck #define SERIAL_TX_WAITING_FOR_CTS         0x00000001
420*c2c66affSColin Finck #define SERIAL_TX_WAITING_FOR_DSR         0x00000002
421*c2c66affSColin Finck #define SERIAL_TX_WAITING_FOR_DCD         0x00000004
422*c2c66affSColin Finck #define SERIAL_TX_WAITING_FOR_XON         0x00000008
423*c2c66affSColin Finck #define SERIAL_TX_WAITING_XOFF_SENT       0x00000010
424*c2c66affSColin Finck #define SERIAL_TX_WAITING_ON_BREAK        0x00000020
425*c2c66affSColin Finck #define SERIAL_RX_WAITING_FOR_DSR         0x00000040
426*c2c66affSColin Finck 
427*c2c66affSColin Finck #define SERIAL_DTR_STATE                  0x00000001
428*c2c66affSColin Finck #define SERIAL_RTS_STATE                  0x00000002
429*c2c66affSColin Finck #define SERIAL_CTS_STATE                  0x00000010
430*c2c66affSColin Finck #define SERIAL_DSR_STATE                  0x00000020
431*c2c66affSColin Finck #define SERIAL_RI_STATE                   0x00000040
432*c2c66affSColin Finck #define SERIAL_DCD_STATE                  0x00000080
433*c2c66affSColin Finck 
434*c2c66affSColin Finck typedef struct _SERIALCONFIG {
435*c2c66affSColin Finck   ULONG  Size;
436*c2c66affSColin Finck   USHORT  Version;
437*c2c66affSColin Finck   ULONG  SubType;
438*c2c66affSColin Finck   ULONG  ProvOffset;
439*c2c66affSColin Finck   ULONG  ProviderSize;
440*c2c66affSColin Finck   WCHAR  ProviderData[1];
441*c2c66affSColin Finck } SERIALCONFIG,*PSERIALCONFIG;
442*c2c66affSColin Finck 
443*c2c66affSColin Finck #ifdef __cplusplus
444*c2c66affSColin Finck }
445*c2c66affSColin Finck #endif
446*c2c66affSColin Finck 
447*c2c66affSColin Finck #endif /* _NTDDSER_ */
448