1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
/*! \file lusbk_shared.h
* \brief Types and defines shared with the driver.
*/
// fix C_ASSERT macro error notifications in VS2010+ code browser
//! Values used in the \c bmAttributes field of a \ref USB_ENDPOINT_DESCRIPTOR
typedef enum _USBD_PIPE_TYPE
USBD_PIPE_TYPE;
// pipe policy types ///////////////
// libusbK ISO pipe policy types ///
// http://msdn.microsoft.com/en-us/library/windows/hardware/ff552359%28v=vs.85%29.aspx
// Settings.Parallel.NumberOfPresentedRequests
// Maximum number of transfers that can be asynchronously delivered at a
// time. Available in version 1.9 and later versions of KMDF.
// Power policy types //////////////
// Device Information types ////////
// Device Speeds
//! The \c WINUSB_PIPE_INFORMATION structure contains pipe information that the \ref UsbK_QueryPipe routine retrieves.
typedef struct _WINUSB_PIPE_INFORMATION
WINUSB_PIPE_INFORMATION;
//! Pointer to a \ref WINUSB_PIPE_INFORMATION structure
typedef WINUSB_PIPE_INFORMATION* PWINUSB_PIPE_INFORMATION;
;
//! The \c WINUSB_PIPE_INFORMATION_EX structure contains pipe information that the \ref UsbK_QueryPipeEx routine retrieves.
typedef struct _WINUSB_PIPE_INFORMATION_EX
WINUSB_PIPE_INFORMATION_EX;
//! Pointer to a \ref WINUSB_PIPE_INFORMATION_EX structure
typedef WINUSB_PIPE_INFORMATION_EX* PWINUSB_PIPE_INFORMATION_EX;
;
//! The \c WINUSB_SETUP_PACKET structure describes a USB setup packet.
/*!
* It is often more convient to use this structure in combination with a \ref KUSB_SETUP_PACKET.
* For example:
* \code
* \endcode
*/
typedef struct _WINUSB_SETUP_PACKET
WINUSB_SETUP_PACKET;
//! pointer to a \c WINUSB_SETUP_PACKET structure
typedef WINUSB_SETUP_PACKET* PWINUSB_SETUP_PACKET;
;
// __WUSBIO_H__ __WINUSB_COMPAT_IO_H__
/*! \addtogroup isok
* @{
*/
//! Structure describing an isochronous transfer packet for libusbK.
typedef struct _KISO_PACKET
KISO_PACKET;
//! pointer to a \c KISO_PACKET structure
typedef KISO_PACKET* PKISO_PACKET;
//! Structure describing an isochronous transfer packet for winusb.
typedef struct _KISO_WUSB_PACKET
KISO_WUSB_PACKET;
//! pointer to a \c KISO_PACKET structure
typedef KISO_WUSB_PACKET* PKISO_WUSB_PACKET;
//! Additional ISO transfer flags.
typedef enum _KISO_FLAG
KISO_FLAG;
//! Structure describing a user defined isochronous transfer.
/*!
*
* \fixedstruct{16}
*
* The \ref KISO_CONTEXT::StartFrame member of the \ref KISO_CONTEXT specifies the starting USB frame number
* for the transaction. The driver can use \ref UsbK_GetCurrentFrameNumber to request the current frame
* number.
*
* In full-speed transmissions, the frame number for any particular packet will be the sum of the start frame
* number and the packet index. For instance, the fourth packet in the \ref KISO_CONTEXT has an index of 3, so
* its frame number will be StartFrame + 3. In a write transfer, the port driver loads this frame with the
* buffer data at the data buffer offset specified by IsoPacket[3].Offset.
*
* When the driver processes the \ref KISO_CONTEXT, it discards all packets in the \ref KISO_CONTEXT whose
* frame numbers are lower than the current frame number. The port driver sets the Status member of the packet
* descriptor for each discarded packet to USBD_STATUS_ISO_NA_LATE_USBPORT, USBD_STATUS_ISO_NOT_ACCESSED_BY_HW
* or USBD_STATUS_ISO_NOT_ACCESSED_LATE. Even if it discards some packets, the port driver attempts to
* transmit those packets in the \ref KISO_CONTEXT whose frame numbers are higher than the current frame
* number.
*
* The check for a valid StartFrame member is slightly more complicated in high-speed transmissions because
* the port driver loads each packet into a high-speed microframe; however, the value in StartFrame refers to
* the 1 millisecond (full-speed) frame number, not the microframe. For example, if the StartFrame value
* recorded in the \ref KISO_CONTEXT is one less than the current frame, the port driver will discard as many
* as eight packets. The exact number of packets that the port driver discards depends on the period
* associated with the isochronous pipe.
*
* High-speed isochronous pipes can have periods of 1, 2, 4, or 8. The period number specifies the frequency
* with which the port driver inserts packets into the data stream. If the period is 2, for example, the port
* driver will insert a packet into the data stream every two microframes. This means that it will only use
* four of the eight microframes available within each 1-millisecond frame for isochronous data transmission.
*
* In general, the higher the period, the fewer packets the port driver will discard when a \ref KISO_CONTEXT
* arrives late. Assume the period on an isochronous pipe is 2. With a period of 2, each 1-millisecond speed
* frame will carry four packets of isochronous data for that pipe. So, for example, if CurrentFrame -
* StartFrame = 3, the port driver will discard 3 * 4 = 12 packets. On the other hand, if the period is 4,
* each 1-millisecond frame carries only two packets of isochronous data for the pipe. Therefore, if the
* \ref KISO_CONTEXT arrives three 1-millisecond frames late, as in the previous example, the port driver will
* discard 3 * 2 = 6 packets, instead of 12 packets.
*
* For all types of isochronous pipe, the distance between the current frame and the StartFrame value
* specified in the \ref KISO_CONTEXT must be less than USBD_ISO_START_FRAME_RANGE. If StartFrame is not
* within the proper range, the driver sets the Status member of the \ref KISO_PACKET
* \c USBD_STATUS_BAD_START_FRAME and discards the entire \ref KISO_CONTEXT. The following code example shows
* the precise check that the port driver does on the \ref KISO_CONTEXT start frame:
* \code
* if (abs((CurrentFrame - StartFrame)) > USBD_ISO_START_FRAME_RANGE)
* {
* // discard the KISO_CONTEXT
* }
* \endcode
*
*/
typedef struct _KISO_CONTEXT
KISO_CONTEXT;
;
//! pointer to a \c KISO_CONTEXT structure
typedef KISO_CONTEXT* PKISO_CONTEXT;
//! Structure describing additional information about how an isochronous pipe transfers data.
/*!
*/
typedef struct _KISOCH_PACKET_INFORMATION
KISOCH_PACKET_INFORMATION;
//! pointer to a \c KISOCH_PACKET_INFORMATION structure
typedef KISOCH_PACKET_INFORMATION* PKISOCH_PACKET_INFORMATION;
/*! @} */
// __LUSBK_SHARED_H_