ReactOS  0.4.13-dev-651-g5dbc677
interfaces.h
Go to the documentation of this file.
1 #ifndef INTERFACES_HPP
2 #define INTERFACES_HPP
3 
4 //=========================================================================================
5 //
6 // class IUSBHardwareDevice
7 //
8 // Description: This class provides access to the usb hardware controller
9 //
10 
11 #define DEFINE_ABSTRACT_USBEHCIHARDWARE() \
12  STDMETHOD_(VOID, SetAsyncListRegister)( THIS_ \
13  IN ULONG PhysicalAddress) PURE; \
14  \
15  STDMETHOD_(VOID, SetPeriodicListRegister)( THIS_ \
16  IN ULONG PhysicalAddress) PURE; \
17  \
18  STDMETHOD_(struct _QUEUE_HEAD *, GetAsyncListQueueHead)( THIS) PURE; \
19  \
20  STDMETHOD_(ULONG, GetPeriodicListRegister)( THIS) PURE; \
21  \
22  STDMETHOD_(VOID, SetCommandRegister)( THIS_ \
23  IN struct _EHCI_USBCMD_CONTENT *UsbCmd) PURE; \
24  \
25  STDMETHOD_(VOID, GetCommandRegister)( THIS_ \
26  OUT struct _EHCI_USBCMD_CONTENT *UsbCmd) PURE;
27 
28 #define IMP_IUSBEHCIHARDWARE \
29  STDMETHODIMP_(VOID) SetAsyncListRegister( \
30  IN ULONG PhysicalAddress); \
31  \
32  STDMETHODIMP_(VOID) SetPeriodicListRegister( \
33  IN ULONG PhysicalAddress); \
34  \
35  STDMETHODIMP_(struct _QUEUE_HEAD *) GetAsyncListQueueHead(); \
36  \
37  STDMETHODIMP_(ULONG) GetPeriodicListRegister(); \
38  \
39  STDMETHODIMP_(VOID) SetCommandRegister( \
40  IN struct _EHCI_USBCMD_CONTENT *UsbCmd); \
41  STDMETHODIMP_(VOID) GetCommandRegister( \
42  OUT struct _EHCI_USBCMD_CONTENT *UsbCmd);
43 
44 DECLARE_INTERFACE_(IEHCIHardwareDevice, IUSBHardwareDevice)
45 {
49 };
50 
51 typedef IEHCIHardwareDevice *PEHCIHARDWAREDEVICE;
52 
53 //=========================================================================================
54 //
55 // class IUSBRequest
56 //
57 // Description: This class is used to issue request to usb controller. The class is
58 // initialized using InitializeXXX methods. You also need to call SetEndpoint to define the endpoint
59 // In addition you can call SetCompletionDetails if you need to wait for the end of
60 // the request or want to complete an irp. You call AddUSBRequest to add the request to the queue.
61 // Once the request is completed the CompletionCallback is invoked. The CompletionCallback
62 // will take care of any completion details which have been set. If the request is cancelled, the
63 // CancelCallback routine is invoked.
64 //
65 
66 struct _QUEUE_HEAD;
67 struct _USB_ENDPOINT;
68 
69 #define DEFINE_ABSTRACT_USBEHCIREQUEST() \
70  STDMETHOD_(VOID, CompletionCallback)( THIS_ \
71  IN NTSTATUS NtStatusCode, \
72  IN ULONG UrbStatusCode, \
73  IN struct _QUEUE_HEAD *QueueHead) PURE; \
74  \
75  STDMETHOD_(NTSTATUS, GetQueueHead)( THIS_ \
76  IN struct _QUEUE_HEAD ** OutHead) PURE; \
77  \
78  STDMETHOD_(BOOLEAN, ShouldReleaseRequestAfterCompletion)( THIS) PURE; \
79  \
80  \
81  STDMETHOD_(VOID, FreeQueueHead)( THIS_ \
82  IN struct _QUEUE_HEAD * QueueHead) PURE; \
83  \
84  STDMETHOD_(BOOLEAN, IsQueueHeadComplete)( THIS_ \
85  IN struct _QUEUE_HEAD * QueueHead) PURE; \
86  \
87  STDMETHOD_(USB_DEVICE_SPEED, GetSpeed)( THIS) PURE; \
88  \
89  STDMETHOD_(UCHAR, GetInterval)( THIS) PURE;
90 
91 #define IMP_IEHCIREQUEST \
92  STDMETHODIMP_(VOID) CompletionCallback( \
93  IN NTSTATUS NtStatusCode, \
94  IN ULONG UrbStatusCode, \
95  IN struct _QUEUE_HEAD *QueueHead); \
96  \
97  STDMETHODIMP_(NTSTATUS) GetQueueHead( \
98  IN struct _QUEUE_HEAD ** OutHead); \
99  \
100  STDMETHODIMP_(BOOLEAN) ShouldReleaseRequestAfterCompletion(); \
101  \
102  STDMETHODIMP_(VOID) FreeQueueHead(struct _QUEUE_HEAD * QueueHead); \
103  \
104  STDMETHODIMP_(BOOLEAN) IsQueueHeadComplete( \
105  IN struct _QUEUE_HEAD * QueueHead); \
106  \
107  STDMETHODIMP_(USB_DEVICE_SPEED) GetSpeed( THIS); \
108  \
109  STDMETHODIMP_(UCHAR) GetInterval( THIS);
110 
111 DECLARE_INTERFACE_(IEHCIRequest, IUSBRequest)
112 {
116 };
117 
118 
119 typedef IEHCIRequest *PEHCIREQUEST;
120 
121 //=========================================================================================
122 //
123 // class IUSBQueue
124 //
125 // Description: This class manages pending requests
126 //
127 
128 #define DEFINE_ABSTRACT_USBEHCIQUEUE() \
129  STDMETHOD_(VOID, InterruptCallback)( THIS_ \
130  IN NTSTATUS Status, \
131  OUT PULONG ShouldRingDoorBell) PURE; \
132  \
133  STDMETHOD_(VOID, CompleteAsyncRequests)( THIS) PURE;
134 
135 #define IMP_IEHCIQUEUE \
136  STDMETHODIMP_(VOID) InterruptCallback( \
137  IN NTSTATUS Status, \
138  OUT PULONG ShouldRingDoorBell); \
139  \
140  STDMETHODIMP_(VOID) CompleteAsyncRequests();
141 
142 DECLARE_INTERFACE_(IEHCIQueue, IUSBQueue)
143 {
147 };
148 
149 typedef IEHCIQueue *PEHCIQUEUE;
150 
151 #endif /* INTERFACES_HPP */
#define DEFINE_ABSTRACT_UNKNOWN()
Definition: ksiface.h:5
DECLARE_INTERFACE_(IEHCIHardwareDevice, IUSBHardwareDevice)
Definition: interfaces.h:44
#define DEFINE_ABSTRACT_USBEHCIQUEUE()
Definition: interfaces.h:128
#define DEFINE_ABSTRACT_USBEHCIHARDWARE()
Definition: interfaces.h:11
#define DEFINE_ABSTRACT_USBREQUEST()
IEHCIHardwareDevice * PEHCIHARDWAREDEVICE
Definition: interfaces.h:49
#define DEFINE_ABSTRACT_USBQUEUE()
#define DEFINE_ABSTRACT_USBEHCIREQUEST()
Definition: interfaces.h:69
IEHCIRequest * PEHCIREQUEST
Definition: interfaces.h:116
#define DEFINE_ABSTRACT_USBHARDWAREDEVICE()
IEHCIQueue * PEHCIQUEUE
Definition: interfaces.h:147