ReactOS  0.4.13-dev-257-gfabbd7c
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 #define _NEW_DELETE_OPERATORS_
26 #include <kcom.h>
27 
28 PVOID
29 __cdecl
30 operator new(
31  size_t iSize,
32  POOL_TYPE poolType,
33  ULONG tag);
34 
35 
36 #include "common_interfaces.h"
37 
38 //
39 // flags for handling USB_REQUEST_SET_FEATURE / USB_REQUEST_GET_FEATURE
40 //
41 #define PORT_ENABLE 1
42 #define PORT_SUSPEND 2
43 #define PORT_OVER_CURRENT 3
44 #define PORT_RESET 4
45 #define PORT_POWER 8
46 #define C_PORT_CONNECTION 16
47 #define C_PORT_ENABLE 17
48 #define C_PORT_SUSPEND 18
49 #define C_PORT_OVER_CURRENT 19
50 #define C_PORT_RESET 20
51 
52 typedef struct
53 {
54  BOOLEAN IsFDO; // is device a FDO or PDO
55  BOOLEAN IsHub; // is device a hub / child - not yet used
56  PDISPATCHIRP Dispatcher; // dispatches the code
58 
59 
60 typedef struct _WORK_ITEM_DATA
61 {
62  WORK_QUEUE_ITEM WorkItem; // work item
63  PVOID CallbackContext; // callback context
64  PRH_INIT_CALLBACK CallbackRoutine; // callback routine
66 
67 //
68 // tag for allocations
69 //
70 #define TAG_USBLIB 'LBSU'
71 
72 //
73 // assert for c++ - taken from portcls
74 //
75 #define PC_ASSERT(exp) \
76  (VOID)((!(exp)) ? \
77  RtlAssert((PVOID) #exp, (PVOID)__FILE__, __LINE__, NULL ), FALSE : TRUE)
78 
79 // hcd_controller.cpp
80 extern "C"
81 {
83 
84 // hardware.cpp
86 
87 // misc.cpp
90 
91 // root_hub_controller.cpp
93 
94 // memory_manager.cpp
96 
97 // usb_device.cpp
99 
100 // libusb.cpp
103 
104 }
105 
106 #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)
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:64
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:56
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:63
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