ReactOS  0.4.14-dev-77-gd9e7c48
libusb.h
Go to the documentation of this file.
1 #ifndef LIBUSB_H__
2 #define LIBUSB_H__
3 
4 #include <ntddk.h>
5 #include <hubbusif.h>
6 #include <usbbusif.h>
7 
8 extern "C"
9 {
10  #include <usbdlib.h>
11 }
12 
13 //
14 // FIXME:
15 // #include <usbprotocoldefs.h>
16 //
17 #include <stdio.h>
18 #include <wdmguid.h>
19 
20 //
21 // FIXME:
22 // the following includes are required to get kcom to compile
23 //
24 #include <portcls.h>
25 #include <kcom.h>
26 
27 PVOID
28 __cdecl
29 operator new(
30  size_t iSize,
31  POOL_TYPE poolType,
32  ULONG tag);
33 
34 
35 #include "common_interfaces.h"
36 
37 //
38 // flags for handling USB_REQUEST_SET_FEATURE / USB_REQUEST_GET_FEATURE
39 //
40 #define PORT_ENABLE 1
41 #define PORT_SUSPEND 2
42 #define PORT_OVER_CURRENT 3
43 #define PORT_RESET 4
44 #define PORT_POWER 8
45 #define C_PORT_CONNECTION 16
46 #define C_PORT_ENABLE 17
47 #define C_PORT_SUSPEND 18
48 #define C_PORT_OVER_CURRENT 19
49 #define C_PORT_RESET 20
50 
51 typedef struct
52 {
53  BOOLEAN IsFDO; // is device a FDO or PDO
54  BOOLEAN IsHub; // is device a hub / child - not yet used
55  PDISPATCHIRP Dispatcher; // dispatches the code
57 
58 
59 typedef struct _WORK_ITEM_DATA
60 {
61  WORK_QUEUE_ITEM WorkItem; // work item
62  PVOID CallbackContext; // callback context
63  PRH_INIT_CALLBACK CallbackRoutine; // callback routine
65 
66 //
67 // tag for allocations
68 //
69 #define TAG_USBLIB 'LBSU'
70 
71 //
72 // assert for c++ - taken from portcls
73 //
74 #define PC_ASSERT(exp) \
75  (VOID)((!(exp)) ? \
76  RtlAssert((PVOID) #exp, (PVOID)__FILE__, __LINE__, NULL ), FALSE : TRUE)
77 
78 // hcd_controller.cpp
79 extern "C"
80 {
82 
83 // hardware.cpp
85 
86 // misc.cpp
89 
90 // root_hub_controller.cpp
92 
93 // memory_manager.cpp
95 
96 // usb_device.cpp
98 
99 // libusb.cpp
102 
103 }
104 
105 #endif /* LIBUSB_H__ */
struct COMMON_DEVICE_EXTENSION * PCOMMON_DEVICE_EXTENSION
struct _COMMON_DEVICE_EXTENSION COMMON_DEVICE_EXTENSION
IUSBHardwareDevice * PUSBHARDWAREDEVICE
NTSTATUS NTAPI GetBusInterface(PDEVICE_OBJECT DeviceObject, PBUS_INTERFACE_STANDARD busInterface)
Definition: misc.cpp:88
#define __cdecl
Definition: accygwin.h:79
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI CreateUSBDevice(PUSBDEVICE *OutDevice)
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1114
NTSTATUS NTAPI CreateDMAMemoryManager(PDMAMEMORYMANAGER *OutMemoryManager)
IUSBDevice * PUSBDEVICE
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTSTATUS NTAPI CreateHCDController(PHCDCONTROLLER *HcdController)
PRH_INIT_CALLBACK CallbackRoutine
Definition: libusb.h:63
unsigned char BOOLEAN
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
IDispatchIrp * PDISPATCHIRP
WORK_QUEUE_ITEM WorkItem
Definition: usbhub.h:38
NTSTATUS NTAPI SyncForwardIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: misc.cpp:37
INT POOL_TYPE
Definition: typedefs.h:76
NTSTATUS NTAPI CreateUSBHardware(PUSBHARDWAREDEVICE *OutHardware)
Definition: hardware.cpp:1474
RH_INIT_CALLBACK * PRH_INIT_CALLBACK
Definition: hubbusif.h:270
PDISPATCHIRP Dispatcher
Definition: libusb.h:55
struct _WORK_ITEM_DATA INIT_ROOT_HUB_CONTEXT
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
NTSTATUS NTAPI CreateHubController(PHUBCONTROLLER *OutHubController)
NTSTATUS NTAPI USBLIB_Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: libusb.cpp:99
PVOID CallbackContext
Definition: libusb.h:62
IDMAMemoryManager * PDMAMEMORYMANAGER
struct _WORK_ITEM_DATA * PINIT_ROOT_HUB_CONTEXT
unsigned int ULONG
Definition: retypes.h:1
IHubController * PHUBCONTROLLER
NTSTATUS NTAPI USBLIB_AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject)
Definition: libusb.cpp:56
char * tag
Definition: main.c:59
IHCDController * PHCDCONTROLLER