[USBAUDIO]
[reactos.git] / reactos / drivers / usb / usbuhci / interfaces.h
1 #ifndef INTERFACES_HPP
2 #define INTERFACES_HPP
3
4 //---------------------------------------------------------------------------
5 //
6 // Object Hierachy
7 // --------------------------------------------------------------------
8 // | IRootHCDController |
9 // | IHCDController Intel USB Universal Host Controller - 3A37 |
10 // | IHCDController - Intel USB Universal HostController - 3A38 |
11 // | IHCDController - Intel USB Universal HostController - 3A38 |
12 // |------------------------------------------------------------------|
13 //
14 //
15 // IHCDController Intel USB Universal Host Controller - 3A37
16 // IHubController
17 // IUSBHardwareDevice
18 // IDMAMemoryManager
19 // IUSBQueue <- interacts with -> IUSBRequest
20 //
21 //
22 // Each IHCDController creates an IUSBHardwareDevice class upon initialization. The
23 // IUSBHardwardeDevice class is used to abstract usb controller specifics. The IHubController
24 // manages all attached devices and handles hub control ioctl requests.
25 //
26 // Each IUSBHardwareDevice has one IDMAMemoryManager and one IUSBQueue. The IDMAMemoryManager
27 // is used to handle dma memory allocations. The IUSBQueue manages requests which are send to the
28 // usb hardware. See IUSBRequest class for details.
29 //
30
31
32 struct _UHCI_QUEUE_HEAD;
33 struct IDMAMemoryManager;
34 struct IUSBQueue;
35
36 //=========================================================================================
37 //
38 // class IUSBHardwareDevice
39 //
40 // Description: This class provides access to the usb hardware controller
41 //
42
43 #define DEFINE_ABSTRACT_USBUHCIHARDWAREDEVICE() \
44 STDMETHOD_(VOID, GetQueueHead)( THIS_ \
45 IN ULONG QueueHeadIndex, \
46 IN struct _UHCI_QUEUE_HEAD **OutQueueHead) PURE;
47
48 #define IMP_IUHCIHARDWAREDEVICE \
49 STDMETHODIMP_(VOID) GetQueueHead( \
50 IN ULONG QueueHeadIndex, \
51 IN struct _UHCI_QUEUE_HEAD **OutQueueHead);
52
53 DECLARE_INTERFACE_(IUHCIHardwareDevice, IUSBHardwareDevice)
54 {
55 DEFINE_ABSTRACT_UNKNOWN()
56 DEFINE_ABSTRACT_USBHARDWAREDEVICE()
57 DEFINE_ABSTRACT_USBUHCIHARDWAREDEVICE()
58 };
59
60 typedef IUHCIHardwareDevice *PUHCIHARDWAREDEVICE;
61
62 //=========================================================================================
63 //
64 // class IUSBRequest
65 //
66 // Description: This class is used to issue request to usb controller. The class is
67 // initialized using InitializeXXX methods. You also need to call SetEndpoint to define the endpoint
68 // In addition you can call SetCompletionDetails if you need to wait for the end of
69 // the request or want to complete an irp. You call AddUSBRequest to add the request to the queue.
70 // Once the request is completed the CompletionCallback is invoked. The CompletionCallback
71 // will take care of any completion details which have been set. If the request is cancelled, the
72 // CancelCallback routine is invoked.
73 //
74
75
76
77 #define DEFINE_ABSTRACT_USBUHCIREQUEST() \
78 STDMETHOD_(NTSTATUS, GetEndpointDescriptor)( THIS_ \
79 IN struct _UHCI_QUEUE_HEAD**OutDescriptor) PURE; \
80 \
81 STDMETHOD_(UCHAR, GetInterval)( THIS) PURE; \
82 \
83 STDMETHOD_(USB_DEVICE_SPEED, GetDeviceSpeed)( THIS) PURE; \
84 \
85 STDMETHOD_(VOID, CompletionCallback)( THIS) PURE; \
86 \
87 STDMETHOD_(VOID, FreeEndpointDescriptor)( THIS_ \
88 IN struct _UHCI_QUEUE_HEAD *OutDescriptor) PURE;
89
90
91 #define IMP_IUHCIREQUEST \
92 STDMETHODIMP_(NTSTATUS) GetEndpointDescriptor(THIS_ \
93 IN struct _UHCI_QUEUE_HEAD**OutDescriptor); \
94 \
95 STDMETHODIMP_(UCHAR) GetInterval(THIS); \
96 \
97 STDMETHODIMP_(USB_DEVICE_SPEED) GetDeviceSpeed(THIS); \
98 \
99 STDMETHODIMP_(VOID) CompletionCallback(THIS); \
100 \
101 STDMETHODIMP_(VOID) FreeEndpointDescriptor(THIS_ \
102 IN struct _UHCI_QUEUE_HEAD * OutDescriptor);
103
104 DECLARE_INTERFACE_(IUHCIRequest, IUSBRequest)
105 {
106 DEFINE_ABSTRACT_UNKNOWN()
107 DEFINE_ABSTRACT_USBREQUEST()
108 DEFINE_ABSTRACT_USBUHCIREQUEST()
109 };
110
111
112 typedef IUHCIRequest *PUHCIREQUEST;
113
114 //=========================================================================================
115 //
116 // class IUSBQueue
117 //
118 // Description: This class manages pending requests
119 //
120
121 #define DEFINE_ABSTRACT_USBUHCIQUEUE() \
122 STDMETHOD_(VOID, TransferInterrupt)( \
123 IN UCHAR ErrorInterrupt) PURE;
124
125 #define IMP_IUHCIQUEUE \
126 STDMETHODIMP_(VOID) TransferInterrupt( \
127 IN UCHAR ErrorInterrupt);
128
129 DECLARE_INTERFACE_(IUHCIQueue, IUSBQueue)
130 {
131 DEFINE_ABSTRACT_UNKNOWN()
132 DEFINE_ABSTRACT_USBQUEUE()
133 DEFINE_ABSTRACT_USBUHCIQUEUE()
134 };
135
136 typedef IUHCIQueue *PUHCIQUEUE;
137
138 #endif /* INTERFACES_HPP */