[USBEHCI_NEW]
[reactos.git] / drivers / usb / usbehci_new / hcd_controller.cpp
1 /*
2 * PROJECT: ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/usb/usbehci_new/hcd_controller.cpp
5 * PURPOSE: USB EHCI device driver.
6 * PROGRAMMERS:
7 * Michael Martin (michael.martin@reactos.org)
8 * Johannes Anderwald (johannes.anderwald@reactos.org)
9 */
10
11 #include "usbehci.h"
12
13 class CHCDController : public IHCDController
14 {
15 public:
16 STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
17
18 STDMETHODIMP_(ULONG) AddRef()
19 {
20 InterlockedIncrement(&m_Ref);
21 return m_Ref;
22 }
23 STDMETHODIMP_(ULONG) Release()
24 {
25 InterlockedDecrement(&m_Ref);
26
27 if (!m_Ref)
28 {
29 delete this;
30 return 0;
31 }
32 return m_Ref;
33 }
34
35 // interface functions
36 NTSTATUS Initialize(IN PROOTHDCCONTROLLER RootHCDController, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject);
37 NTSTATUS HandlePnp(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp);
38 NTSTATUS HandlePower(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp);
39 NTSTATUS HandleDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp);
40
41 // constructor / destructor
42 CHCDController(IUnknown *OuterUnknown){}
43 virtual ~CHCDController(){}
44
45 protected:
46 LONG m_Ref;
47 };
48
49 //=================================================================================================
50 // COM
51 //
52 NTSTATUS
53 STDMETHODCALLTYPE
54 CHCDController::QueryInterface(
55 IN REFIID refiid,
56 OUT PVOID* Output)
57 {
58 UNICODE_STRING GuidString;
59
60 if (IsEqualGUIDAligned(refiid, IID_IUnknown))
61 {
62 *Output = PVOID(PUNKNOWN(this));
63 PUNKNOWN(*Output)->AddRef();
64 return STATUS_SUCCESS;
65 }
66
67 return STATUS_UNSUCCESSFUL;
68 }
69
70 NTSTATUS
71 CHCDController::Initialize(
72 IN PROOTHDCCONTROLLER RootHCDController,
73 IN PDRIVER_OBJECT DriverObject,
74 IN PDEVICE_OBJECT PhysicalDeviceObject)
75 {
76 UNIMPLEMENTED
77 return STATUS_NOT_IMPLEMENTED;
78 }
79
80 NTSTATUS
81 CHCDController::HandleDeviceControl(
82 IN PDEVICE_OBJECT DeviceObject,
83 IN PIRP Irp)
84 {
85 UNIMPLEMENTED
86 return STATUS_NOT_IMPLEMENTED;
87 }
88
89 NTSTATUS
90 CHCDController::HandlePnp(
91 IN PDEVICE_OBJECT DeviceObject,
92 IN PIRP Irp)
93 {
94 UNIMPLEMENTED
95
96 Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
97 IoCompleteRequest(Irp, IO_NO_INCREMENT);
98
99 return STATUS_NOT_IMPLEMENTED;
100 }
101
102 NTSTATUS
103 CHCDController::HandlePower(
104 IN PDEVICE_OBJECT DeviceObject,
105 IN PIRP Irp)
106 {
107 UNIMPLEMENTED
108
109 Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
110 IoCompleteRequest(Irp, IO_NO_INCREMENT);
111
112 return STATUS_NOT_IMPLEMENTED;
113 }
114
115
116
117
118 NTSTATUS
119 CreateHCDController(
120 PHCDCONTROLLER *OutHcdController)
121 {
122 PHCDCONTROLLER This;
123
124 This = new(NonPagedPool, 0) CHCDController(0);
125 if (!This)
126 return STATUS_INSUFFICIENT_RESOURCES;
127
128 This->AddRef();
129
130 // return result
131 *OutHcdController = (PHCDCONTROLLER)This;
132
133 return STATUS_SUCCESS;
134 }