Author: janderwald
Date: Thu Apr 14 11:58:07 2011
New Revision: 51337
URL:
http://svn.reactos.org/svn/reactos?rev=51337&view=rev
Log:
[USBEHCI_NEW]
- Implement stubs for classes CHCDController and CUSBHardwareDevice
- Implement CreateHCDController, CreateUSBHardware
- Implement CUSBHardwareDevice::QueryInterface, CUSBHardwareDevice::AddRef,
CUSBHardwareDevice::Release
- Implement CHCDController::AddRef, CHCDController::Release,
CHCDController::QueryInterface
Modified:
branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp
branches/usb-bringup/drivers/usb/usbehci_new/hcd_controller.cpp
Modified: branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
==============================================================================
--- branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] (original)
+++ branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] Thu Apr 14
11:58:07 2011
@@ -10,9 +10,193 @@
#include "usbehci.h"
+class CUSBHardwareDevice : public IUSBHardwareDevice
+{
+public:
+ STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
+
+ STDMETHODIMP_(ULONG) AddRef()
+ {
+ InterlockedIncrement(&m_Ref);
+ return m_Ref;
+ }
+ STDMETHODIMP_(ULONG) Release()
+ {
+ InterlockedDecrement(&m_Ref);
+
+ if (!m_Ref)
+ {
+ delete this;
+ return 0;
+ }
+ return m_Ref;
+ }
+ // com
+ NTSTATUS Initialize(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT
FunctionalDeviceObject, PDEVICE_OBJECT PhysicalDeviceObject, PDEVICE_OBJECT
LowerDeviceObject);
+ NTSTATUS PnpStart(PCM_RESOURCE_LIST RawResources, PCM_RESOURCE_LIST
TranslatedResources);
+ NTSTATUS PnpStop(void);
+ NTSTATUS HandlePower(PIRP Irp);
+ NTSTATUS GetDeviceDetails(PULONG VendorId, PULONG DeviceId, PULONG NumberOfPorts,
PULONG Speed);
+ NTSTATUS GetDmaMemoryManager(OUT struct IDMAMemoryManager **OutMemoryManager);
+ NTSTATUS GetUSBQueue(OUT struct IUSBQueue **OutUsbQueue);
+ NTSTATUS ResetController();
+ NTSTATUS ResetPort(ULONG PortIndex);
+ KIRQL AcquireDeviceLock(void);
+ VOID ReleaseDeviceLock(KIRQL OldLevel);
+
+ // constructor / destructor
+ CUSBHardwareDevice(IUnknown *OuterUnknown){}
+ virtual ~CUSBHardwareDevice(){}
+
+protected:
+ LONG m_Ref;
+ KSPIN_LOCK m_Lock;
+
+};
+
+//=================================================================================================
+// COM
+//
+NTSTATUS
+STDMETHODCALLTYPE
+CUSBHardwareDevice::QueryInterface(
+ IN REFIID refiid,
+ OUT PVOID* Output)
+{
+ UNICODE_STRING GuidString;
+
+ if (IsEqualGUIDAligned(refiid, IID_IUnknown))
+ {
+ *Output = PVOID(PUNKNOWN(this));
+ PUNKNOWN(*Output)->AddRef();
+ return STATUS_SUCCESS;
+ }
+
+ return STATUS_UNSUCCESSFUL;
+}
+
+NTSTATUS
+CUSBHardwareDevice::Initialize(
+ PDRIVER_OBJECT DriverObject,
+ PDEVICE_OBJECT FunctionalDeviceObject,
+ PDEVICE_OBJECT PhysicalDeviceObject,
+ PDEVICE_OBJECT LowerDeviceObject)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+NTSTATUS
+CUSBHardwareDevice::PnpStart(
+ PCM_RESOURCE_LIST RawResources,
+ PCM_RESOURCE_LIST TranslatedResources)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+CUSBHardwareDevice::PnpStop(void)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+CUSBHardwareDevice::HandlePower(
+ PIRP Irp)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+CUSBHardwareDevice::GetDeviceDetails(
+ OUT OPTIONAL PULONG VendorId,
+ OUT OPTIONAL PULONG DeviceId,
+ OUT OPTIONAL PULONG NumberOfPorts,
+ OUT OPTIONAL PULONG Speed)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+NTSTATUS
+CUSBHardwareDevice::GetDmaMemoryManager(
+ OUT struct IDMAMemoryManager **OutMemoryManager)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+NTSTATUS
+CUSBHardwareDevice::GetUSBQueue(
+ OUT struct IUSBQueue **OutUsbQueue)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+NTSTATUS
+CUSBHardwareDevice::ResetController(void)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+CUSBHardwareDevice::ResetPort(
+ IN ULONG PortIndex)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+KIRQL
+CUSBHardwareDevice::AcquireDeviceLock(void)
+{
+ KIRQL OldLevel = 0;
+
+ UNIMPLEMENTED
+ return OldLevel;
+}
+
+BOOLEAN
+NTAPI
+InterruptServiceRoutine(
+ IN PKINTERRUPT Interrupt,
+ IN PVOID ServiceContext)
+{
+ UNIMPLEMENTED
+ return FALSE;
+}
+
+VOID
+CUSBHardwareDevice::ReleaseDeviceLock(
+ KIRQL OldLevel)
+{
+ UNIMPLEMENTED
+}
+
+
NTSTATUS
CreateUSBHardware(
PUSBHARDWAREDEVICE *OutHardware)
{
- return STATUS_NOT_IMPLEMENTED;
-}
+ PUSBHARDWAREDEVICE This;
+
+ This = new(NonPagedPool, 0) CUSBHardwareDevice(0);
+ if (!This)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ This->AddRef();
+
+ // return result
+ *OutHardware = (PUSBHARDWAREDEVICE)This;
+
+ return STATUS_SUCCESS;
+}
Modified: branches/usb-bringup/drivers/usb/usbehci_new/hcd_controller.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
==============================================================================
--- branches/usb-bringup/drivers/usb/usbehci_new/hcd_controller.cpp [iso-8859-1]
(original)
+++ branches/usb-bringup/drivers/usb/usbehci_new/hcd_controller.cpp [iso-8859-1] Thu Apr
14 11:58:07 2011
@@ -10,9 +10,125 @@
#include "usbehci.h"
+class CHCDController : public IHCDController
+{
+public:
+ STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
+
+ STDMETHODIMP_(ULONG) AddRef()
+ {
+ InterlockedIncrement(&m_Ref);
+ return m_Ref;
+ }
+ STDMETHODIMP_(ULONG) Release()
+ {
+ InterlockedDecrement(&m_Ref);
+
+ if (!m_Ref)
+ {
+ delete this;
+ return 0;
+ }
+ return m_Ref;
+ }
+
+ // interface functions
+ NTSTATUS Initialize(IN PROOTHDCCONTROLLER RootHCDController, IN PDRIVER_OBJECT
DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject);
+ NTSTATUS HandlePnp(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp);
+ NTSTATUS HandlePower(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp);
+ NTSTATUS HandleDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp);
+
+ // constructor / destructor
+ CHCDController(IUnknown *OuterUnknown){}
+ virtual ~CHCDController(){}
+
+protected:
+ LONG m_Ref;
+};
+
+//=================================================================================================
+// COM
+//
+NTSTATUS
+STDMETHODCALLTYPE
+CHCDController::QueryInterface(
+ IN REFIID refiid,
+ OUT PVOID* Output)
+{
+ UNICODE_STRING GuidString;
+
+ if (IsEqualGUIDAligned(refiid, IID_IUnknown))
+ {
+ *Output = PVOID(PUNKNOWN(this));
+ PUNKNOWN(*Output)->AddRef();
+ return STATUS_SUCCESS;
+ }
+
+ return STATUS_UNSUCCESSFUL;
+}
+
+NTSTATUS
+CHCDController::Initialize(
+ IN PROOTHDCCONTROLLER RootHCDController,
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDEVICE_OBJECT PhysicalDeviceObject)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+CHCDController::HandleDeviceControl(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp)
+{
+ UNIMPLEMENTED
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+CHCDController::HandlePnp(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp)
+{
+ UNIMPLEMENTED
+
+ Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+CHCDController::HandlePower(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp)
+{
+ UNIMPLEMENTED
+
+ Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+
+
+
NTSTATUS
CreateHCDController(
PHCDCONTROLLER *OutHcdController)
{
- return STATUS_NOT_IMPLEMENTED;
+ PHCDCONTROLLER This;
+
+ This = new(NonPagedPool, 0) CHCDController(0);
+ if (!This)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ This->AddRef();
+
+ // return result
+ *OutHcdController = (PHCDCONTROLLER)This;
+
+ return STATUS_SUCCESS;
}