libusbK 
3.0
Library Documentation
© 2011-2021 Travis Lee Robinson. All rights reserved.
lusbk_shared.h
Go to the documentation of this file.
1 
5 #ifndef __LUSBK_SHARED_H_
6 #define __LUSBK_SHARED_H_
7 
8 // fix C_ASSERT macro error notifications in VS2010+ code browser
9 #if defined(_MSC_VER) && _MSC_VER >= 1600
10 #define USBK_C_ASSERT(name,x) typedef char C_ASSERT_ ## name ## _COUNTER_ [(x) ? 1 : -1];
11 #else
12 #define USBK_C_ASSERT(name,x) C_ASSERT(x)
13 #endif
14 
15 #ifndef __USB_H__
16 
18 typedef enum _USBD_PIPE_TYPE
19 {
22 
25 
28 
32 
33 #endif
34 
35 #if !defined(__WINUSB_COMPAT_IO_H__) && !defined(__WUSBIO_H__)
36 
37 // pipe policy types ///////////////
38 #define SHORT_PACKET_TERMINATE 0x01
39 #define AUTO_CLEAR_STALL 0x02
40 #define PIPE_TRANSFER_TIMEOUT 0x03
41 #define IGNORE_SHORT_PACKETS 0x04
42 #define ALLOW_PARTIAL_READS 0x05
43 #define AUTO_FLUSH 0x06
44 #define RAW_IO 0x07
45 #define MAXIMUM_TRANSFER_SIZE 0x08
46 #define RESET_PIPE_ON_RESUME 0x09
47 
48 // libusbK ISO pipe policy types ///
49 #define ISO_START_LATENCY 0x20
50 #define ISO_ALWAYS_START_ASAP 0x21
51 #define ISO_NUM_FIXED_PACKETS 0x22
52 
53 // http://msdn.microsoft.com/en-us/library/windows/hardware/ff552359%28v=vs.85%29.aspx
54 // Settings.Parallel.NumberOfPresentedRequests
55 // Maximum number of transfers that can be asynchronously delivered at a
56 // time. Available in version 1.9 and later versions of KMDF.
57 #define SIMUL_PARALLEL_REQUESTS 0x30
58 
59 // Power policy types //////////////
60 #define AUTO_SUSPEND 0x81
61 #define SUSPEND_DELAY 0x83
62 
63 // Device Information types ////////
64 #define DEVICE_SPEED 0x01
65 
66 // Device Speeds
67 #define LowSpeed 0x01
68 #define FullSpeed 0x02
69 #define HighSpeed 0x03
70 
72 typedef struct _WINUSB_PIPE_INFORMATION
73 {
76 
78  UCHAR PipeId;
79 
82 
84  UCHAR Interval;
85 
89 USBK_C_ASSERT(WINUSB_PIPE_INFORMATION,sizeof(WINUSB_PIPE_INFORMATION) == 12);
90 
92 typedef struct _WINUSB_PIPE_INFORMATION_EX
93 {
96 
98  UCHAR PipeId;
99 
102 
104  UCHAR Interval;
105 
107 
113 
117 USBK_C_ASSERT(WINUSB_PIPE_INFORMATION_EX, sizeof(WINUSB_PIPE_INFORMATION_EX) == 16);
118 
119 #include <pshpack1.h>
120 
122 
129 typedef struct _WINUSB_SETUP_PACKET
130 {
132  UCHAR RequestType;
133 
135  UCHAR Request;
136 
138  USHORT Value;
139 
141  USHORT Index;
142 
144  USHORT Length;
145 
149 USBK_C_ASSERT(WINUSB_SETUP_PACKET,sizeof(WINUSB_SETUP_PACKET) == 8);
150 
151 #include <poppack.h>
152 
153 #endif // __WUSBIO_H__ __WINUSB_COMPAT_IO_H__
154 
155 #include <pshpack1.h>
156 
161 typedef struct _KISO_PACKET
163 {
165 
170  UINT Offset;
171 
173 
176  USHORT Length;
177 
179 
184  USHORT Status;
185 
186 } KISO_PACKET;
187 
190 
192 typedef struct _KISO_WUSB_PACKET
193 {
195 
200  UINT Offset;
201 
203 
206  UINT Length;
207 
209 
214  UINT Status;
215 
219 
220 #pragma warning(disable:4200)
221 
223 typedef enum _KISO_FLAG
224 {
225  KISO_FLAG_NONE = 0,
226 
228 
244 } KISO_FLAG;
245 
247 
300 typedef struct _KISO_CONTEXT
301 {
304 
306 
318 
320 
323  SHORT ErrorCount;
324 
326  /*
327  * \note This field is assigned by the user application only and used by the driver upon transfer submission
328  * and completion.
329  */
331 
333 
353 
355  /*
356  * \note This field is assigned by the user application, used by the driver upon transfer submission, and
357  * updated by the driver upon transfer completion.
358  */
359  KISO_PACKET IsoPackets[0];
360 } KISO_CONTEXT;
361 USBK_C_ASSERT(KISO_CONTEXT,sizeof(KISO_CONTEXT) == 16);
362 
365 
367 
369 typedef struct _KISOCH_PACKET_INFORMATION
370 {
372 
379 
381 
387 
388 
390 
396 
398 
401 
404 #pragma warning(default:4200)
405 
406 #include <poppack.h>
407 
408 #endif // __LUSBK_SHARED_H_
409 
KISO_FLAG Flags
Additional ISO transfer flags. See KISO_FLAG.
Definition: lusbk_shared.h:303
KISO_CONTEXT * PKISO_CONTEXT
pointer to a KISO_CONTEXT structure
Definition: lusbk_shared.h:364
USBD_PIPE_TYPE PipeType
A USBD_PIPE_TYPE enumeration value that specifies the pipe type.
Definition: lusbk_shared.h:75
USHORT Value
The meaning of this member varies according to the request. For an explanation of this member...
Definition: lusbk_shared.h:138
UCHAR RequestType
The request type. The values that are assigned to this member are defined in Table 9...
Definition: lusbk_shared.h:132
USHORT MaximumPacketSize
The maximum size, in bytes, of the packets that are transmitted on the pipe.
Definition: lusbk_shared.h:81
USBD_PIPE_TYPE PipeType
A USBD_PIPE_TYPE enumeration value that specifies the pipe type.
Definition: lusbk_shared.h:95
The WINUSB_SETUP_PACKET structure describes a USB setup packet.
Definition: lusbk_shared.h:129
KISO_WUSB_PACKET * PKISO_WUSB_PACKET
pointer to a KISO_PACKET structure
Definition: lusbk_shared.h:218
UINT StartFrame
Specifies the frame number that the transfer should begin on (0 for ASAP).
Definition: lusbk_shared.h:317
The WINUSB_PIPE_INFORMATION structure contains pipe information that the UsbK_QueryPipe routine retri...
Definition: lusbk_shared.h:72
UCHAR PipeId
The pipe identifier (ID)
Definition: lusbk_shared.h:98
WINUSB_PIPE_INFORMATION_EX * PWINUSB_PIPE_INFORMATION_EX
Pointer to a WINUSB_PIPE_INFORMATION_EX structure.
Definition: lusbk_shared.h:116
WINUSB_PIPE_INFORMATION * PWINUSB_PIPE_INFORMATION
Pointer to a WINUSB_PIPE_INFORMATION structure.
Definition: lusbk_shared.h:88
USHORT Length
Set by the host controller to indicate the actual number of bytes received by the device for isochron...
Definition: lusbk_shared.h:176
USHORT Index
The meaning of this member varies according to the request. For an explanation of this member...
Definition: lusbk_shared.h:141
UINT UrbHdrStatus
Contains the URB Hdr.Status value on return from the host controller driver.
Definition: lusbk_shared.h:352
UINT Offset
Specifies the offset, in bytes, of the buffer for this packet from the beginning of the entire isochr...
Definition: lusbk_shared.h:200
ULONG MaximumBytesPerInterval
The maximum number of bytes that can be transmitted in single interval.
Definition: lusbk_shared.h:112
Indicates a bulk endpoint.
Definition: lusbk_shared.h:27
The WINUSB_PIPE_INFORMATION_EX structure contains pipe information that the UsbK_QueryPipeEx routine ...
Definition: lusbk_shared.h:92
Structure describing an isochronous transfer packet for libusbK.
Definition: lusbk_shared.h:162
Structure describing a user defined isochronous transfer.
Definition: lusbk_shared.h:300
Do not start the transfer immediately, instead use KISO_CONTEXT::StartFrame.
Definition: lusbk_shared.h:243
USHORT MaximumPacketSize
The maximum size, in bytes, of the packets that are transmitted on the pipe.
Definition: lusbk_shared.h:101
WINUSB_SETUP_PACKET * PWINUSB_SETUP_PACKET
pointer to a WINUSB_SETUP_PACKET structure
Definition: lusbk_shared.h:148
SHORT NumberOfPackets
Specifies the number of packets that are described by the variable-length array member IsoPacket...
Definition: lusbk_shared.h:330
UINT Offset
Specifies the offset, in bytes, of the buffer for this packet from the beginning of the entire isochr...
Definition: lusbk_shared.h:170
Structure describing an isochronous transfer packet for winusb.
Definition: lusbk_shared.h:192
UINT Status
Contains the 16 least significant USBD status bits, on return from the host controller driver...
Definition: lusbk_shared.h:214
USHORT Status
Contains the 16 least significant USBD status bits, on return from the host controller driver...
Definition: lusbk_shared.h:184
UINT Length
Set by the host controller to indicate the actual number of bytes received by the device for isochron...
Definition: lusbk_shared.h:206
Indicates an isochronous endpoint.
Definition: lusbk_shared.h:24
KISOCH_PACKET_INFORMATION * PKISOCH_PACKET_INFORMATION
pointer to a KISOCH_PACKET_INFORMATION structure
Definition: lusbk_shared.h:400
UCHAR Interval
The pipe interval.
Definition: lusbk_shared.h:84
Indicates an interrupt endpoint.
Definition: lusbk_shared.h:30
USHORT Length
The number of bytes to transfer. (not including the WINUSB_SETUP_PACKET itself)
Definition: lusbk_shared.h:144
UCHAR PipeId
The pipe identifier (ID)
Definition: lusbk_shared.h:78
SHORT ErrorCount
Contains the number of packets that completed with an error condition on return from the host control...
Definition: lusbk_shared.h:323
UINT PollingPeriodMicroseconds
How often a pipe transfers data.
Definition: lusbk_shared.h:386
UINT BytesPerMillisecond
Number of bytes transferred per millisecond (or whole frame).
Definition: lusbk_shared.h:395
KISO_PACKET * PKISO_PACKET
pointer to a KISO_PACKET structure
Definition: lusbk_shared.h:189
Structure describing additional information about how an isochronous pipe transfers data...
Definition: lusbk_shared.h:369
Indicates a control endpoint.
Definition: lusbk_shared.h:21
UCHAR Request
The device request. The values that are assigned to this member are defined in Table 9...
Definition: lusbk_shared.h:135
UINT PacketsPerFrame
Number of ISO packets transferred per whole USB frame (1 millisecond).
Definition: lusbk_shared.h:378
KISO_FLAG
Additional ISO transfer flags.
Definition: lusbk_shared.h:223
USBD_PIPE_TYPE
Values used in the bmAttributes field of a USB_ENDPOINT_DESCRIPTOR.
Definition: lusbk_shared.h:18
UCHAR Interval
The pipe interval.
Definition: lusbk_shared.h:104