24#define WIN32_NO_STATUS
32#define FASTBAUD 115200
38#define LOOPBACK_TXD_RXD FALSE
39#define LOOPBACK_CTS_RTS FALSE
40#define LOOPBACK_DTR_DSR FALSE
41#define LOOPBACK_DTR_RING FALSE
42#define LOOPBACK_DTR_DCD FALSE
76 "baud=9600 parity=e data=5 stop=1 xon=on odsr=off octs=off dtr=on rts=on idsr=on",
78 { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
79 { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x02, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
80 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
81 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
84 "baud=0 parity=M data=6 stop=1.5 xon=off odsr=on octs=ON dtr=off rts=off idsr=OFF",
86 { 0x00000000, 0x00000000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
87 { 0xffffffff, 0x00000000, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x03, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
88 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
89 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
92 "BAUD=4000000000 parity=n data=7 stop=2 to=off",
94 { 0x00000000, 0xee6b2800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
95 { 0xffffffff, 0xee6b2800, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
96 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
97 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }
100 "Baud=115200 Parity=O Data=8 To=On",
102 { 0x00000000, 0x0001c200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
103 { 0xffffffff, 0x0001c200, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
104 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 },
105 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 }
108 "PaRiTy=s Data=7 DTR=on",
110 { 0x00000000, 0x00000000, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
111 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
112 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
113 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
118 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
119 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
120 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
121 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
126 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
127 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
128 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
129 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
134 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
135 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
136 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
137 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
142 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
143 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
144 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
145 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
150 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
151 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
152 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
153 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
158 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
159 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
160 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
161 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
166 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
167 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
168 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
169 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
174 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
175 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
176 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
177 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
182 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
183 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
184 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
185 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
190 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
191 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
192 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
193 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
198 { 0x00000000, 0x0000006e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
199 { 0xffffffff, 0x0000006e, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
200 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
201 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
206 { 0x00000000, 0x0000012c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
207 { 0xffffffff, 0x0000012c, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x02, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
208 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
209 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
214 { 0x00000000, 0x00000258, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
215 { 0xffffffff, 0x00000258, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x03, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
216 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
217 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
222 { 0x00000000, 0x000004b0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
223 { 0xffffffff, 0x000004b0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
224 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
225 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
230 { 0x00000000, 0x00000960, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
231 { 0xffffffff, 0x00000960, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x04, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
232 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
233 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
238 { 0x00000000, 0x000012c0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
239 { 0xffffffff, 0x000012c0, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 1, 2, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
240 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
241 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
246 { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
247 { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
248 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
249 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
254 { 0x00000000, 0x00004b00, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
255 { 0xffffffff, 0x00004b00, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x02, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
256 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
257 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
262 { 0x00000000, 0x00000000, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
263 { 0xffffffff, 0x00000000, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 1, 2, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
264 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
265 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
268 "4000000000,O,7,1.5,X",
270 { 0x00000000, 0xee6b2800, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
271 { 0xffffffff, 0xee6b2800, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
272 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
273 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
278 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
279 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
280 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
281 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
286 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
287 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
288 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
289 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
294 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
295 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
296 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
297 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
302 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
303 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
304 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
305 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
310 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
311 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
312 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
313 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
318 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
319 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
320 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
321 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
326 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
327 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
328 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
329 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
334 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
335 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
336 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
337 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
340 "COMx:baud=38400 data=8",
342 { 0x00000000, 0x00009600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
343 { 0xffffffff, 0x00009600, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
344 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
345 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
348 "COMx :to=on stop=1.5",
350 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
351 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
352 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 },
353 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 }
356 "COMx: baud=12345 data=7",
358 { 0x00000000, 0x00003039, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
359 { 0xffffffff, 0x00003039, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
360 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
361 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
364 "COMx : xon=on odsr=off",
366 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
367 { 0xffffffff, 0xffffffff, 1, 1, 1, 0, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
368 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
369 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
374 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
375 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
376 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
377 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
382 { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
383 { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
384 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
385 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
390 { 0x00000000, 0x0000006e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
391 { 0xffffffff, 0x0000006e, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x02, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
392 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
393 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
398 { 0x00000000, 0x00004b00, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
399 { 0xffffffff, 0x00004b00, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
400 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
401 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
404 "COMx : 57600,S,6,2,x",
406 { 0x00000000, 0x0000e100, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
407 { 0xffffffff, 0x0000e100, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x04, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
408 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
409 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
413#define TEST_COUNT (sizeof(test) / sizeof(TEST))
455 ok(LastError == CorrectError,
"%s(\"%s\"), 0x%02x: GetLastError() returned %d, should be %d\n", function, ptest->
string, initial_value, LastError, CorrectError);
456 ok(
result == ptest->
result,
"%s(\"%s\"), 0x%02x: return value should be %s\n", function, ptest->
string, initial_value, ptest->
result ?
"TRUE" :
"FALSE");
459#define check_dcb_member(a,b) ok(pdcb1->a == pdcb2->a, "%s(\"%s\"), 0x%02x: "#a" is "b", should be "b"\n", function, ptest->string, initial_value, pdcb1->a, pdcb2->a)
460#define check_dcb_member2(a,c,b) if(pdcb2->a == c) { check_dcb_member(a,b); } else { ok(pdcb1->a == pdcb2->a || pdcb1->a == c, "%s(\"%s\"), 0x%02x: "#a" is "b", should be "b" or "b"\n", function, ptest->string, initial_value, pdcb1->a, pdcb2->a, c); }
462static void check_dcb(
const char *function,
const TEST *ptest,
int initial_value,
const DCB *pdcb1,
const DCB *pdcb2)
532#define check_timeouts_member(a) ok(ptimeouts1->a == ptimeouts2->a, "%s(\"%s\"), 0x%02x: "#a" is %u, should be %u\n", function, ptest->string, initial_value, ptimeouts1->a, ptimeouts2->a);
549 memset(&dcb, initial_value,
sizeof(
DCB));
556 check_dcb(
"BuildCommDCBA", ptest, initial_value, &dcb, pexpected_dcb);
566 memset(&dcb, initial_value,
sizeof(
DCB));
574 check_dcb(
"BuildCommDCBAndTimeoutsA", ptest, initial_value, &dcb, pexpected_dcb);
583 static int reportedDCBW = 0;
588 memset(&dcb, initial_value,
sizeof(
DCB));
596 win_skip(
"BuildCommDCBW is not implemented\n");
602 check_dcb(
"BuildCommDCBW", ptest, initial_value, &dcb, pexpected_dcb);
611 static int reportedDCBAndTW = 0;
616 memset(&dcb, initial_value,
sizeof(
DCB));
624 if(!reportedDCBAndTW++)
625 win_skip(
"BuildCommDCBAndTimeoutsW is not implemented\n");
631 check_dcb(
"BuildCommDCBAndTimeoutsW", ptest, initial_value, &dcb, pexpected_dcb);
637 char port_name[] =
"COMx";
644 for(port_name[3] =
'1'; port_name[3] <=
'9'; port_name[3]++)
657 trace(
"Could not find a valid COM port. Some tests will be skipped.\n");
692 char port_name[] =
"COMx";
698 for(port_name[3] =
'1'; port_name[3] <=
'9'; port_name[3]++)
708 trace(
"Could not find a valid COM port.\n");
710 trace(
"Found Com port %s. Connected devices may disturb results\n", port_name);
721 trace(
"%s doesn't respond, skipping the test\n", port_name);
723 trace(
"%s is not a real serial port, skipping the test\n", port_name);
729 ok(comstat.
cbInQue == 0,
"Unexpected %d chars in InQueue\n",comstat.
cbInQue);
730 ok(comstat.
cbOutQue == 0,
"Still pending %d charcters in OutQueue\n", comstat.
cbOutQue);
731 ok(errors == 0,
"Unexpected errors 0x%08x\n", errors);
741 trace(
"GetCommModemStatus returned 0x%08x->%s%s%s%s\n", ModemStat,
781 ok(
res ==
TRUE,
"A timed-out read should return TRUE\n");
782 ok( LastError == 0xdeadbeef,
"err=%d\n", LastError);
785 "Unexpected TimeOut %d, expected %d\n", timediff,
TIMEOUT);
795 char tbuf[]=
"test_waittxempty";
833 ok(!
res,
"WriteFile on an overlapped handle without ovl structure should fail\n");
836 S(
U(ovl_write)).Offset = 0;
837 S(
U(ovl_write)).OffsetHigh = 0;
846 ok(
after -
before < 30,
"WriteFile took %d ms to write %d Bytes at %d Baud\n",
850 S(
U(ovl_wait)).Offset = 0;
851 S(
U(ovl_wait)).OffsetHigh = 0;
866 ok(
bytes ==
sizeof(evtmask),
"expected %u, written %u\n", (
UINT)
sizeof(evtmask),
bytes);
872 trace(
"recovering after WAIT_TIMEOUT...\n");
883 ok(evtmask &
EV_TXEMPTY,
"WaitCommEvent: expected EV_TXEMPTY, got %#x\n", evtmask);
887 trace(
"WaitCommEvent for EV_TXEMPTY took %d ms (timeout 1500)\n", timediff);
888 ok(timediff < 1200,
"WaitCommEvent used %d ms for waiting\n", timediff);
894 ok(
bytes ==
sizeof(tbuf),
"expected %u, written %u\n", (
UINT)
sizeof(tbuf),
bytes);
899 for (
i = 0;
i < 2;
i++)
909 S(
U(ovl_write)).Offset = 0;
910 S(
U(ovl_write)).OffsetHigh = 0;
920 ok(
stat.cbInQue == 0,
"InQueue should be empty, got %d bytes\n",
stat.cbInQue);
921 ok(
stat.cbOutQue != 0 ||
broken(
stat.cbOutQue == 0) ,
"OutQueue should not be empty\n");
922 ok(errors == 0,
"ClearCommErrors: Unexpected error 0x%08x\n", errors);
926 ok(
bytes ==
sizeof(tbuf),
"expected %u, written %u\n", (
UINT)
sizeof(tbuf),
bytes);
934 ok(
stat.cbInQue == 0,
"InQueue should be empty, got %d bytes\n",
stat.cbInQue);
935 ok(
stat.cbOutQue == 0,
"OutQueue should be empty, got %d bytes\n",
stat.cbOutQue);
936 ok(errors == 0,
"ClearCommErrors: Unexpected error 0x%08x\n", errors);
938 S(
U(ovl_wait)).Offset = 0;
939 S(
U(ovl_wait)).OffsetHigh = 0;
956 ok(
bytes ==
sizeof(evtmask),
"expected %u, written %u\n", (
UINT)
sizeof(evtmask),
bytes);
958 ok(evtmask &
EV_TXEMPTY,
"WaitCommEvent: expected EV_TXEMPTY, got %#x\n", evtmask);
962 ok(!evtmask,
"WaitCommEvent: expected 0, got %#x\n", evtmask);
964 S(
U(ovl_wait2)).Offset = 0;
965 S(
U(ovl_wait2)).OffsetHigh = 0;
969 ok(!
res,
"WaitCommEvent should fail if there is a pending wait\n");
974 trace(
"recovering after WAIT_TIMEOUT...\n");
998 ok(lpStat.
cbInQue == 0,
"Unexpected %d chars in InQueue\n", lpStat.
cbInQue);
1000 ok(errors == 0,
"ClearCommErrors: Unexpected error 0x%08x\n", errors);
1016 ok(!
SetCommState(hcom, &dcb),
"SetCommState should have failed\n");
1018 ok(!(
err &
CE_MODE),
"ClearCommError shouldn't set CE_MODE byte in this case (%x)\n",
err);
1031 char tbuf[]=
"test_LoopbackRead";
1038 trace(
"Starting test_LoopbackRead\n");
1055 ok(
WriteFile(hcom,tbuf,
sizeof(tbuf),&written,
NULL),
"WriteFile failed\n");
1057 ok(written ==
sizeof(tbuf),
"WriteFile %d bytes written\n", written);
1064 "WaitCommEvent: Unexpected EvtMask 0x%08x, expected 0x%08x\n",
1066 trace(
"Write %d ms WaitCommEvent EV_TXEMPTY %d ms\n", diff,
before-
after);
1070 ok(
read ==
sizeof(tbuf),
"ReadFile read %d bytes, expected \"%s\"\n",
read,rbuf);
1077 dcb.BaudRate = 9600;
1086 ok(
WriteFile(hcom,tbuf,
sizeof(tbuf),&written,
NULL),
"WriteFile failed\n");
1087 ok(written ==
sizeof(tbuf),
"WriteFile %d bytes written\n", written);
1089 trace(
"WaitCommEventEV_RXCHAR\n");
1091 ok(evtmask ==
EV_RXCHAR,
"WaitCommEvent: Unexpected EvtMask 0x%08x, expected 0x%08x\n",
1097 ok(
res,
"Readfile failed\n");
1098 ok(
read ==
sizeof(tbuf),
"ReadFile read %d bytes\n",
read);
1100 trace(
"Readfile for %d chars took %d ms\n",
read, diff);
1102 "Timedout Wait took %d ms, expected around %d\n", diff,
TIMEOUT);
1109 ok(
WriteFile(hcom,tbuf,
sizeof(tbuf),&written,
NULL),
"WriteFile failed\n");
1117 ok(
res,
"Readfile failed\n");
1121 while ((
read <
sizeof(tbuf)) && (
i <10));
1123 ok(
read ==
sizeof(tbuf),
"ReadFile read %d bytes\n",
read);
1132 DWORD ModemStat = 0, defaultStat = 0;
1140 memset (&dcb, 0,
sizeof (dcb));
1144 trace(
"RTS_CONTROL_HANDSHAKE is set, so don't manipulate RTS\n");
1155 ok ((ModemStat &
MS_CTS_ON) == 0,
"CTS didn't react: 0x%04x, expected 0x%04x\n",
1159 ok (ModemStat == defaultStat,
"Failed to restore CTS: 0x%04x, expected 0x%04x\n",
1160 ModemStat, defaultStat);
1167 "CTS didn't react: 0x%04x, expected 0x%04x\n",
1171 ok (ModemStat == defaultStat,
"Failed to restore CTS: 0x%04x, expected 0x%04x\n",
1172 ModemStat, defaultStat);
1181 DWORD ModemStat = 0, defaultStat = 0;
1192 trace(
"DTR_CONTROL_HANDSHAKE is set, so don't manipulate DTR\n");
1203 ok ((ModemStat &
MS_RLSD_ON) == 0,
"RLSD didn't react: 0x%04x, expected 0x%04x\n",
1207 ok (ModemStat == defaultStat,
"Failed to restore RLSD: 0x%04x, expected 0x%04x\n",
1208 ModemStat, defaultStat);
1215 "RLSD didn't react: 0x%04x, expected 0x%04x\n",
1219 ok (ModemStat == defaultStat,
"Failed to restore RLSD: 0x%04x, expected 0x%04x\n",
1220 ModemStat, defaultStat);
1229 DWORD ModemStat = 0, defaultStat = 0;
1240 trace(
"DTR_CONTROL_HANDSHAKE is set, so don't manipulate DTR\n");
1251 ok ((ModemStat &
MS_DSR_ON) == 0,
"CTS didn't react: 0x%04x, expected 0x%04x\n",
1255 ok (ModemStat == defaultStat,
"Failed to restore DSR: 0x%04x, expected 0x%04x\n",
1256 ModemStat, defaultStat);
1263 "CTS didn't react: 0x%04x,expected 0x%04x\n",
1267 ok (ModemStat == defaultStat,
"Failed to restore DSR: 0x%04x, expected 0x%04x\n",
1268 ModemStat, defaultStat);
1277 DWORD ModemStat = 0, defaultStat = 0;
1288 trace(
"DTR_CONTROL_HANDSHAKE is set, so don't manipulate DTR\n");
1299 ok ((ModemStat &
MS_RING_ON) == 0,
"RING didn't react: 0x%04x, expected 0x%04x\n",
1303 ok (ModemStat == defaultStat,
"Failed to restore RING: 0x%04x, expected 0x%04x\n",
1304 ModemStat, defaultStat);
1311 "RING didn't react: 0x%04x,expected 0x%04x\n",
1315 ok (ModemStat == defaultStat,
"Failed to restore RING: 0x%04x, expected 0x%04x\n",
1316 ModemStat, defaultStat);
1332 HANDLE hcom, hComPortEvent, hComWriteEvent;
1334 DWORD err_wait, err_write, written, evtmask=0;
1343 ok(hComPortEvent != 0,
"CreateEvent failed\n");
1349 ZeroMemory( &overlapped_w,
sizeof(overlapped_w));
1350 overlapped_w.
hEvent = hComWriteEvent;
1356 trace(
"Success 0x%08x err %d evtmask 0x%08x\n", success_wait, err_wait, evtmask);
1357 ok(success_wait || err_wait ==
ERROR_IO_PENDING,
"overlapped WaitCommEvent failed\n");
1358 trace(
"overlapped WaitCommEvent returned.\n");
1360 success_write=
WriteFile(hcom,
"X", 1, &written, &overlapped_w);
1363 "overlapped WriteFile failed, err %d\n",
1369 ok(success_write ==
WAIT_OBJECT_0,
"WaitForSingleObjectEx, res %d, err %d\n",
1370 success_write, err_write);
1376 trace(
"Write after Wait res 0x%08x err %d\n",success_write, err_write);
1377 ok(success_write && written ==1,
"Write after Wait res 0x%08x err %d\n",
1378 success_write, err_write);
1383 ok(success_wait ==
WAIT_OBJECT_0,
"wait hComPortEvent, res 0x%08x, err %d\n",
1384 success_wait, err_wait);
1389 trace(
"Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
1392 ok(evtmask &
EV_RXCHAR,
"Detect EV_RXCHAR: 0x%08x, expected 0x%08x\n",
1396 "Unexpected time %d, expected around %d\n", diff,
TIMEOUT>>1);
1413 trace(
"toggle_ctlLine timeout %d ctl 0x%08x handle %p\n",
timeout, ctl, hcom );
1416 trace(
"toggle_ctline done\n");
1419 trace(
"toggle_ctline WaitForSingleObjectEx res 0x%08x err %d\n",
1432 HANDLE hcom, hComPortEvent, alarmThread;
1447 trace(
"RTS_CONTROL_HANDSHAKE is set, so don't manipulate DTR\n");
1459 trace(
"test_WaitCts timeout %ld clt 0x%08lx handle %p\n",
args[0],
args[1], hcom);
1463 ok(hComPortEvent != 0,
"CreateEvent failed\n");
1468 trace(
"Thread created\n");
1469 ok(alarmThread !=0 ,
"CreateThread Failed\n");
1478 trace(
"Success 0x%08x err %d evtmask 0x%08x\n",
success,
err, evtmask);
1480 trace(
"overlapped WaitCommEvent returned.\n");
1483 "WaitCts hComPortEvent failed\n");
1487 trace(
"Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
1490 ok(evtmask &
EV_CTS,
"Failed to detect EV_CTS: 0x%08x, expected 0x%08x\n",
1494 ok((evtmask &
MS_CTS_ON) == 0,
"CTS didn't change state!\n");
1496 ok((evtmask &
MS_CTS_ON),
"CTS didn't change state!\n");
1500 "Unexpected time %d, expected around %d\n", diff,
TIMEOUT>>1);
1522 trace(
" Changing CommMask on the fly for handle %p after timeout %d\n",
1526 trace(
"SetCommMask changed\n");
1538 HANDLE hcom, hComPortEvent, alarmThread;
1548 trace(
"RTS_CONTROL_HANDSHAKE is set, so don't manipulate DTR\n");
1555 trace(
"test_AbortWaitCts timeout %ld handle %p\n",
args[0], hcom);
1559 ok(hComPortEvent != 0,
"CreateEvent failed\n");
1563 trace(
"Thread created\n");
1564 ok(alarmThread !=0 ,
"CreateThread Failed\n");
1573 trace(
"Success 0x%08x err %d evtmask 0x%08x\n",
success,
err, evtmask);
1575 trace(
"overlapped WaitCommEvent returned.\n");
1578 "AbortWaitCts hComPortEvent failed\n");
1582 trace(
"Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
1585 ok(evtmask == 0,
"Incorrect EventMask 0x%08x returned on Wait aborted bu SetCommMask, expected 0x%08x\n",
1590 "Unexpected time %d, expected around %d\n", diff,
TIMEOUT>>1);
1605 HANDLE hcom, hComPortEvent, alarmThread;
1617 trace(
"DTR_CONTROL_HANDSHAKE is set, so don't manipulate DTR\n");
1629 trace(
"test_WaitDsr timeout %ld clt 0x%08lx handle %p\n",
args[0],
args[1], hcom);
1633 ok(hComPortEvent != 0,
"CreateEvent failed\n");
1635 ok(alarmThread !=0 ,
"CreateThread Failed\n");
1644 trace(
"Success 0x%08x err %d evtmask 0x%08x\n",
success,
err, evtmask);
1646 trace(
"overlapped WaitCommEvent returned.\n");
1649 "wait hComPortEvent failed\n");
1653 trace(
"Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
1656 ok(evtmask &
EV_DSR,
"Failed to detect EV_DSR: 0x%08x, expected 0x%08x\n",
1660 ok((evtmask &
MS_DSR_ON) == 0,
"DTR didn't change state!\n");
1662 ok((evtmask &
MS_DSR_ON),
"DTR didn't change state!\n");
1666 "Unexpected time %d, expected around %d\n", diff,
TIMEOUT>>1);
1687 HANDLE hcom, hComPortEvent, alarmThread;
1700 trace(
"DTR_CONTROL_HANDSHAKE is set, so don't manipulate DTR\n");
1707 skip(
"modem status failed -> skip.\n");
1717 trace(
"test_WaitRing timeout %ld clt 0x%08lx handle %p\n",
args[0],
args[1], hcom);
1721 ok(hComPortEvent != 0,
"CreateEvent failed\n");
1723 ok(alarmThread !=0 ,
"CreateThread Failed\n");
1732 trace(
"Success 0x%08x err %d evtmask 0x%08x\n",
success,
err, evtmask);
1734 trace(
"overlapped WaitCommEvent returned.\n");
1737 "wait hComPortEvent failed\n");
1741 trace(
"Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
1744 ok(evtmask &
EV_RING,
"Failed to detect EV_RING: 0x%08x, expected 0x%08x\n",
1748 ok((evtmask &
MS_RING_ON) == 0,
"DTR didn't change state!\n");
1750 ok((evtmask &
MS_RING_ON),
"DTR didn't change state!\n");
1754 "Unexpected time %d, expected around %d\n", diff,
TIMEOUT>>1);
1774 HANDLE hcom, hComPortEvent, alarmThread;
1786 trace(
"DTR_CONTROL_HANDSHAKE is set, so don't manipulate DTR\n");
1798 trace(
"test_WaitDcd timeout %ld clt 0x%08lx handle %p\n",
args[0],
args[1], hcom);
1802 ok(hComPortEvent != 0,
"CreateEvent failed\n");
1804 ok(alarmThread !=0 ,
"CreateThread Failed\n");
1813 trace(
"Success 0x%08x err %d evtmask 0x%08x\n",
success,
err, evtmask);
1815 trace(
"overlapped WaitCommEvent returned.\n");
1818 "wait hComPortEvent failed\n");
1822 trace(
"Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
1825 ok(evtmask &
EV_RLSD,
"Failed to detect EV_RLSD: 0x%08x, expected 0x%08x\n",
1829 ok((evtmask &
MS_RLSD_ON) == 0,
"DTR didn't change state!\n");
1831 ok((evtmask &
MS_RLSD_ON),
"DTR didn't change state!\n");
1835 "Unexpected time %d, expected around %d\n", diff,
TIMEOUT>>1);
1857 trace(
"SetCommBreak for handle %p after timeout %d\n",
1861 trace(
"SetCommBreak done\n");
1872 HANDLE hcom, hComPortEvent, alarmThread;
1883 ok(hComPortEvent != 0,
"CreateEvent failed\n");
1885 trace(
"test_WaitBreak\n");
1891 trace(
"Thread created\n");
1892 ok(alarmThread !=0 ,
"CreateThread Failed\n");
1901 trace(
"Success 0x%08x err %d evtmask 0x%08x\n",
success,
err, evtmask);
1903 trace(
"overlapped WaitCommEvent returned.\n");
1913 trace(
"Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
1916 ok(evtmask &
EV_BREAK,
"Failed to detect EV_BREAK: 0x%08x, expected 0x%08x\n",
1922 "Unexpected time %d, expected around %d\n", diff,
TIMEOUT>>1);
1955 S(
U(ovl_wait)).Offset = 0;
1956 S(
U(ovl_wait)).OffsetHigh = 0;
1959 trace(
"waiting 10 secs for com port events (turn on/off the device)...\n");
1960 last_event_time = 0;
1975 last_event_time =
after;
1978 ok(
bytes ==
sizeof(evtmask),
"expected %u, written %u\n", (
UINT)
sizeof(evtmask),
bytes);
1979 trace(
"WaitCommEvent: got events %#x\n", evtmask);
1985 if (last_event_time ||
after -
before >= 10000)
goto done;
2013 ok(
stat.cbInQue == 0,
"expected 0, got %d bytes in InQueue\n",
stat.cbInQue);
2014 ok(
stat.cbOutQue == 0,
"expected 0, got %d bytes in OutQueue\n",
stat.cbOutQue);
2015 ok(errors == 0,
"expected errors 0, got %#x\n", errors);
2022 static const char atz[]=
"ATZ\r\n";
2033 if (!pNtReadFile || !pNtWriteFile)
2035 win_skip(
"not running on NT, skipping test\n");
2044 dcb.BaudRate = 9600;
2064 ok(!
ret,
"WriteFile should fail\n");
2075 for (
i = -20;
i < 20;
i++)
2081 if (
i >= 0 ||
i == -1)
2107 skip(
"Probably modem is not connected.\n");
2118 S(
U(ovl_wait)).Offset = 0;
2119 S(
U(ovl_wait)).OffsetHigh = 0;
2122 trace(
"waiting 3 secs for modem response...\n");
2123 last_event_time = 0;
2138 trace(
"got modem response.\n");
2140 last_event_time =
after;
2143 ok(
bytes ==
sizeof(evtmask),
"expected sizeof(evtmask), got %u\n",
bytes);
2144 ok(evtmask &
EV_RXCHAR,
"EV_RXCHAR should be set\n");
2149 ok(!
ret,
"ReadFile should fail\n");
2160 for (
i = -20;
i < 20;
i++)
2191 if (last_event_time ||
after -
before >= 3000)
goto done;
2233 skip(
"interactive tests (set WINETEST_INTERACTIVE=1)\n");
char * strstr(char *String1, char *String2)
char * strcpy(char *DstString, const char *SrcString)
static unsigned char bytes[4]
struct timeout * timeouts
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
#define ERROR_INVALID_FUNCTION
#define ERROR_CALL_NOT_IMPLEMENTED
#define ERROR_INVALID_PARAMETER
#define ReadFile(a, b, c, d, e)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define ERROR_INVALID_HANDLE
#define MultiByteToWideChar
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
DWORD WINAPI GetTickCount(VOID)
BOOL WINAPI GetDefaultCommConfigA(LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize)
BOOL WINAPI BuildCommDCBAndTimeoutsW(LPCWSTR devid, LPDCB lpdcb, LPCOMMTIMEOUTS lptimeouts)
BOOL WINAPI SetCommBreak(HANDLE handle)
BOOL WINAPI SetCommTimeouts(HANDLE hComm, LPCOMMTIMEOUTS lptimeouts)
BOOL WINAPI SetupComm(HANDLE handle, DWORD insize, DWORD outsize)
BOOL WINAPI SetCommMask(HANDLE handle, DWORD evtmask)
BOOL WINAPI SetCommState(HANDLE handle, LPDCB lpdcb)
BOOL WINAPI GetCommState(HANDLE handle, LPDCB lpdcb)
BOOL WINAPI BuildCommDCBA(LPCSTR device, LPDCB lpdcb)
BOOL WINAPI BuildCommDCBW(LPCWSTR devid, LPDCB lpdcb)
BOOL WINAPI GetCommModemStatus(HANDLE hFile, LPDWORD lpModemStat)
BOOL WINAPI BuildCommDCBAndTimeoutsA(LPCSTR device, LPDCB lpdcb, LPCOMMTIMEOUTS lptimeouts)
BOOL WINAPI EscapeCommFunction(HANDLE handle, DWORD func)
BOOL WINAPI ClearCommBreak(HANDLE handle)
BOOL WINAPI WaitCommEvent(HANDLE hFile, LPDWORD lpdwEvents, LPOVERLAPPED lpOverlapped)
BOOL WINAPI ClearCommError(HANDLE handle, LPDWORD errors, LPCOMSTAT lpStat)
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
#define FILE_FLAG_OVERLAPPED
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK void ULONG PLARGE_INTEGER PULONG key
static void test_BuildCommDCBAndTimeoutsA(const char *string, const TEST *ptest, int initial_value, const DCB *pexpected_dcb, const COMMTIMEOUTS *pexpected_timeouts)
static void test_stdio(void)
static void test_WaitCts(void)
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK io_status
static BOOL loopback_dtr_dsr
static HANDLE test_OpenComm(BOOL doOverlap)
#define LOOPBACK_DTR_RING
static void test_ReadTimeOut(void)
static void test_LoopbackDtrRing(void)
static void test_waittxempty(void)
static void test_BuildCommDCBW(const char *string, const TEST *ptest, int initial_value, const DCB *pexpected_dcb)
static DWORD CALLBACK toggle_ctlLine(LPVOID arg)
static DWORD CALLBACK reset_CommMask(LPVOID arg)
static HANDLE PIO_APC_ROUTINE void * apc_user
static void test_WaitBreak(void)
static DWORD CALLBACK set_CommBreak(LPVOID arg)
static void test_BuildCommDCB(void)
static void check_timeouts(const char *function, const TEST *ptest, int initial_value, const COMMTIMEOUTS *ptimeouts1, const COMMTIMEOUTS *ptimeouts2)
static BOOL loopback_dtr_dcd
static void test_BuildCommDCBAndTimeoutsW(const char *string, const TEST *ptest, int initial_value, const DCB *pexpected_dcb, const COMMTIMEOUTS *pexpected_timeouts)
static void test_BuildCommDCBA(const char *string, const TEST *ptest, int initial_value, const DCB *pexpected_dcb)
#define check_timeouts_member(a)
static BOOL loopback_rts_cts
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK void ULONG PLARGE_INTEGER offset
static HANDLE PIO_APC_ROUTINE apc
static void test_GetModemStatus(HANDLE hcom)
#define check_dcb_member(a, b)
static void test_WaitRing(void)
static void test_LoopbackRead(void)
static void test_LoopbackDtrDsr(void)
static void test_LoopbackCtsRts(void)
static void test_FlushFileBuffers(void)
#define check_dcb_member2(a, c, b)
static void test_WaitRx(void)
static void check_dcb(const char *function, const TEST *ptest, int initial_value, const DCB *pdcb1, const DCB *pdcb2)
static void check_result(const char *function, const TEST *ptest, int initial_value, BOOL result)
static void test_WaitDsr(void)
static void test_WaitDcd(void)
static void test_AbortWaitCts(void)
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK void * buffer
static BOOL loopback_txd_rxd
static void test_non_pending_errors(void)
static void test_read_write(void)
static BOOL loopback_dtr_ring
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK void ULONG length
static void test_ClearCommError(void)
static void test_WaitCommEvent(void)
static void test_LoopbackDtrDcd(void)
VOID(* PIO_APC_ROUTINE)(IN PVOID ApcContext, IN PIO_STATUS_BLOCK IoStatusBlock, IN ULONG Reserved)
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED * overlapped
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
__inline int before(__u32 seq1, __u32 seq2)
__inline int after(__u32 seq1, __u32 seq2)
#define STATUS_INVALID_PARAMETER
#define success(from, fromstr, to, tostr)
struct _COMM_CONFIG COMMCONFIG
#define RTS_CONTROL_ENABLE
#define DTR_CONTROL_HANDSHAKE
DWORD WINAPI GetLastError(void)
#define RTS_CONTROL_HANDSHAKE
#define DTR_CONTROL_DISABLE
#define RTS_CONTROL_DISABLE
#define DTR_CONTROL_ENABLE
_IRQL_requires_same_ _In_ CLONG ByteSize