ReactOS 0.4.16-dev-319-g6cf4263
usbutil.hpp
Go to the documentation of this file.
1//
2// Copyright (C) Microsoft. All rights reserved.
3//
4#ifndef __FX_USB_UTIL_H__
5#define __FX_USB_UTIL_H__
6
8__inline
10 __inout_xcount((BitNumber / sizeof(UCHAR)) + 1) PUCHAR BitArray,
11 __in UCHAR BitNumber
12 )
13/*++
14
15Routine Description:
16 The following function sets a bit in the array and returns a value indicating
17 the bits previous state.
18
19Arguments:
20 BitArray - the array to check
21
22 BitNumber - zero based index into BitArray
23
24Return Value:
25 TRUE if the bit was already set
26 FALSE if was previously clear
27
28 --*/
29{
31 UCHAR bit;
32
33 index = (BitNumber) / sizeof(UCHAR);
34 bit = (UCHAR) (1 << (BitNumber % sizeof(UCHAR)) );
35
36 if ((BitArray[index] & bit) == 0x0) {
37 //
38 // bit not set
39 //
40 BitArray[index] |= bit;
41 return FALSE;
42 }
43
44 return TRUE;
45}
46
47VOID
48__inline
50 __inout_xcount((BitNumber / sizeof(UCHAR)) + 1) PUCHAR BitArray,
51 __in UCHAR BitNumber
52 )
53/*++
54
55Routine Description:
56 Clear the bit in the BitArray
57
58Arguments:
59 BitArray - bit array to change
60
61 BitNumber - zero based bit index into the array to clear
62
63 --*/
64{
66 UCHAR bit;
67
68 index = BitNumber / sizeof(UCHAR);
69 bit = (UCHAR) (1 << (BitNumber % sizeof(UCHAR)) );
70
71 BitArray[index] &= ~bit;
72}
73
74VOID
77 __in PURB Urb,
78 __in FX_URB_TYPE FxUrbType,
81 USBD_HANDLE UsbdHandle
82 );
83
86 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
90 __in FX_URB_TYPE FxUrbType,
93 USBD_HANDLE UsbdHandle
94 );
95
101 );
102
103PURB
105 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
108 __in ULONG DefaultMaxPacketSize
109 );
110
113 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
116 );
117
121 __in size_t BufferLength,
124 );
125
130
133 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
136 __in PVOID End,
138 __in size_t SizeToValidate,
140 __in ULONG MaximumNumDescriptorsToValidate
141 );
142
143#if (FX_CORE_MODE == FX_CORE_USER_MODE)
144VOID
147 __in_xcount(Urb->Length) PUMURB_HEADER Urb,
148 __in IWudfFile* HostFile,
150 );
151
152VOID
154 __inout PUMURB UmUrb,
155 __in WINUSB_INTERFACE_HANDLE WinUsbHandle,
159 );
160
161VOID
163 __inout PUMURB UmUrb,
164 __in WINUSB_INTERFACE_HANDLE WinUsbHandle,
167 );
168
169VOID
171 __inout PUMURB UmUrb,
172 __in WINUSB_INTERFACE_HANDLE WinUsbHandle,
175 );
176#endif // (FX_CORE_MODE == FX_CORE_USER_MODE)
177
178#endif // __FX_USB_UTIL_H__
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define index(s, c)
Definition: various.h:29
Definition: bufpool.h:45
#define __in
Definition: dbghelp.h:35
#define __inout
Definition: dbghelp.h:50
#define __in_opt
Definition: dbghelp.h:38
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define __drv_when(cond, annotes)
Definition: driverspecs.h:335
return pTarget Start()
return pRequest Reuse(ReuseParams)
@ FxUrbTypeUsbdAllocated
Definition: fxusbdevice.hpp:28
enum _FX_URB_TYPE FX_URB_TYPE
GLuint index
Definition: glext.h:6031
long LONG
Definition: pedump.c:60
#define __inout_xcount(size)
Definition: specstrings.h:113
#define __in_xcount(size)
Definition: specstrings.h:109
Definition: umusb.h:173
Definition: usb.h:529
Definition: usbdlib.h:7
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
_In_ ULONG _In_ PVOID _In_ LONG DescriptorType
Definition: usbdlib.h:160
_In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceList
Definition: usbdlib.h:181
_In_ PVOID _In_ LONG _In_ LONG AlternateSetting
Definition: usbdlib.h:170
_In_ PVOID _In_ LONG InterfaceNumber
Definition: usbdlib.h:169
PUSB_COMMON_DESCRIPTOR FxUsbFindDescriptorType(__in PVOID Buffer, __in size_t BufferLength, __in PVOID Start, __in LONG DescriptorType)
Definition: usbutil.cpp:174
VOID __inline FxBitArrayClear(__inout_xcount((BitNumber/sizeof(UCHAR))+1) PUCHAR BitArray, __in UCHAR BitNumber)
Definition: usbutil.hpp:49
FxUsbValidateDescriptorOp
Definition: usbutil.hpp:126
@ FxUsbValidateDescriptorOpAtLeast
Definition: usbutil.hpp:128
@ FxUsbValidateDescriptorOpEqual
Definition: usbutil.hpp:127
NTSTATUS FxUsbValidateDescriptorType(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor, __in PVOID Start, __in PVOID End, __in LONG DescriptorType, __in size_t SizeToValidate, __in FxUsbValidateDescriptorOp Op, __in ULONG MaximumNumDescriptorsToValidate)
Definition: usbutil.cpp:207
VOID FxUsbUmInitInformationUrb(__inout PUMURB UmUrb, __in WINUSB_INTERFACE_HANDLE WinUsbHandle, __in ULONG BufferLength, __in PVOID Buffer)
Definition: usbutil.cpp:596
NTSTATUS FxFormatUrbRequest(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxIoTarget *Target, __in FxRequestBase *Request, __in FxRequestBuffer *Buffer, __in FX_URB_TYPE FxUrbType, __drv_when(FxUrbType==FxUrbTypeUsbdAllocated, __in) __drv_when(FxUrbType !=FxUrbTypeUsbdAllocated, __in_opt) USBD_HANDLE UsbdHandle)
Definition: usbutil.cpp:62
VOID FxUsbUmInitDescriptorUrb(__inout PUMURB UmUrb, __in WINUSB_INTERFACE_HANDLE WinUsbHandle, __in UCHAR DescriptorType, __in ULONG BufferLength, __in PVOID Buffer)
Definition: usbutil.cpp:556
NTSTATUS FxUsbValidateConfigDescriptorHeaders(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor, __in size_t ConfigDescriptorLength)
Definition: usbutil.cpp:111
PUSB_INTERFACE_DESCRIPTOR FxUsbParseConfigurationDescriptor(__in PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc, __in UCHAR InterfaceNumber=-1, __in UCHAR AlternateSetting=1)
Definition: usbutil.cpp:307
PURB FxUsbCreateConfigRequest(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc, __in PUSBD_INTERFACE_LIST_ENTRY InterfaceList, __in ULONG DefaultMaxPacketSize)
Definition: usbutil.cpp:364
VOID FxUsbUmFormatRequest(__in FxRequestBase *Request, __in_xcount(Urb->Length) PUMURB_HEADER Urb, __in IWudfFile *HostFile, __in BOOLEAN Reuse=FALSE)
Definition: usbutil.cpp:486
VOID FxFormatUsbRequest(__in FxRequestBase *Request, __in PURB Urb, __in FX_URB_TYPE FxUrbType, __drv_when(FxUrbType==FxUrbTypeUsbdAllocated, __in) __drv_when(FxUrbType !=FxUrbTypeUsbdAllocated, __in_opt) USBD_HANDLE UsbdHandle)
Definition: usbutil.cpp:29
BOOLEAN __inline FxBitArraySet(__inout_xcount((BitNumber/sizeof(UCHAR))+1) PUCHAR BitArray, __in UCHAR BitNumber)
Definition: usbutil.hpp:9
VOID FxUsbUmInitControlTransferUrb(__inout PUMURB UmUrb, __in WINUSB_INTERFACE_HANDLE WinUsbHandle, __in ULONG BufferLength, __in PVOID Buffer)
Definition: usbutil.cpp:578
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
_Must_inspect_result_ _In_ WDFUSBDEVICE _Out_writes_bytes_to_opt_ ConfigDescriptorLength PVOID ConfigDescriptor
Definition: wdfusb.h:1036
_Must_inspect_result_ _In_ WDFUSBDEVICE _Out_writes_bytes_to_opt_ ConfigDescriptorLength PVOID _Inout_ PUSHORT ConfigDescriptorLength
Definition: wdfusb.h:1040
unsigned char UCHAR
Definition: xmlstorage.h:181