From ee34d784d4a75948a13ee73a6d73e2055a3153aa Mon Sep 17 00:00:00 2001 From: Mark Tempel Date: Fri, 14 Jan 2005 16:12:34 +0000 Subject: [PATCH] Initial commit of USB support. These are just stubs. They build, but that is about it. Expect heavy development in usbport, and usbuhci. svn path=/trunk/; revision=13044 --- reactos/drivers/usb/Makefile | 50 +++++++ reactos/drivers/usb/miniport/usbehci/makefile | 16 +++ .../drivers/usb/miniport/usbehci/usbehci.c | 41 ++++++ .../drivers/usb/miniport/usbehci/usbehci.h | 45 ++++++ .../drivers/usb/miniport/usbehci/usbehci.rc | 5 + reactos/drivers/usb/miniport/usbohci/makefile | 16 +++ .../drivers/usb/miniport/usbohci/usbohci.c | 41 ++++++ .../drivers/usb/miniport/usbohci/usbohci.h | 45 ++++++ .../drivers/usb/miniport/usbohci/usbohci.rc | 5 + reactos/drivers/usb/miniport/usbuhci/makefile | 16 +++ .../drivers/usb/miniport/usbuhci/usbuhci.c | 41 ++++++ .../drivers/usb/miniport/usbuhci/usbuhci.h | 45 ++++++ .../drivers/usb/miniport/usbuhci/usbuhci.rc | 5 + reactos/drivers/usb/usbhub/makefile | 16 +++ reactos/drivers/usb/usbhub/usbhub.c | 38 +++++ reactos/drivers/usb/usbhub/usbhub.def | 4 + reactos/drivers/usb/usbhub/usbhub.h | 10 ++ reactos/drivers/usb/usbhub/usbhub.rc | 5 + reactos/drivers/usb/usbport/makefile | 16 +++ reactos/drivers/usb/usbport/usbport.c | 81 +++++++++++ reactos/drivers/usb/usbport/usbport.def | 8 ++ reactos/drivers/usb/usbport/usbport.h | 130 ++++++++++++++++++ reactos/drivers/usb/usbport/usbport.rc | 5 + 23 files changed, 684 insertions(+) create mode 100644 reactos/drivers/usb/Makefile create mode 100644 reactos/drivers/usb/miniport/usbehci/makefile create mode 100644 reactos/drivers/usb/miniport/usbehci/usbehci.c create mode 100644 reactos/drivers/usb/miniport/usbehci/usbehci.h create mode 100644 reactos/drivers/usb/miniport/usbehci/usbehci.rc create mode 100644 reactos/drivers/usb/miniport/usbohci/makefile create mode 100644 reactos/drivers/usb/miniport/usbohci/usbohci.c create mode 100644 reactos/drivers/usb/miniport/usbohci/usbohci.h create mode 100644 reactos/drivers/usb/miniport/usbohci/usbohci.rc create mode 100644 reactos/drivers/usb/miniport/usbuhci/makefile create mode 100644 reactos/drivers/usb/miniport/usbuhci/usbuhci.c create mode 100644 reactos/drivers/usb/miniport/usbuhci/usbuhci.h create mode 100644 reactos/drivers/usb/miniport/usbuhci/usbuhci.rc create mode 100644 reactos/drivers/usb/usbhub/makefile create mode 100644 reactos/drivers/usb/usbhub/usbhub.c create mode 100644 reactos/drivers/usb/usbhub/usbhub.def create mode 100644 reactos/drivers/usb/usbhub/usbhub.h create mode 100644 reactos/drivers/usb/usbhub/usbhub.rc create mode 100644 reactos/drivers/usb/usbport/makefile create mode 100644 reactos/drivers/usb/usbport/usbport.c create mode 100644 reactos/drivers/usb/usbport/usbport.def create mode 100644 reactos/drivers/usb/usbport/usbport.h create mode 100644 reactos/drivers/usb/usbport/usbport.rc diff --git a/reactos/drivers/usb/Makefile b/reactos/drivers/usb/Makefile new file mode 100644 index 00000000000..504f8c44f42 --- /dev/null +++ b/reactos/drivers/usb/Makefile @@ -0,0 +1,50 @@ +# +# ReactOS USB Drivers +# + +PATH_TO_TOP = ../.. + +include $(PATH_TO_TOP)/rules.mak + +DRIVERS = usbport miniport/usbuhci miniport/usbehci miniport/usbohci usbhub + +all: $(DRIVERS) + +depends: + +implib: $(DRIVERS:%=%_implib) + +clean: $(DRIVERS:%=%_clean) + +install: $(DRIVERS:%=%_install) + +bootcd: $(DRIVERS:%=%_bootcd) + +.PHONY: all depends implib clean install bootcd + + +# +# USB DRIVERS +# +$(DRIVERS): %: + $(MAKE) -C $* + +$(DRIVERS:%=%_implib): %_implib: + $(MAKE) -C $* implib + +$(DRIVERS:%=%_clean): %_clean: + $(MAKE) -C $* clean + +$(DRIVERS:%=%_install): %_install: + $(MAKE) -C $* install + +$(DRIVERS:%=%_bootcd): %_bootcd: + $(MAKE) -C $* bootcd + +.PHONY: $(DRIVERS) $(DRIVERS:%=%_implib) $(DRIVERS:%=%_clean) $(DRIVERS:%=%_install) $(DRIVERS:%=%_bootcd) + + +etags: + find . -name "*.[ch]" -print | etags --language=c - + +# EOF diff --git a/reactos/drivers/usb/miniport/usbehci/makefile b/reactos/drivers/usb/miniport/usbehci/makefile new file mode 100644 index 00000000000..bf4be62e7e4 --- /dev/null +++ b/reactos/drivers/usb/miniport/usbehci/makefile @@ -0,0 +1,16 @@ +PATH_TO_TOP = ../../../.. + +TARGET_TYPE = driver + +TARGET_NAME = usbehci + +TARGET_DDKLIBS = ntoskrnl.a usbport.a + +TARGET_CFLAGS = -Werror -Wall -I$(PATH_TO_TOP)/ntoskrnl/include -D__USE_W32API + +TARGET_OBJECTS = \ + usbehci.o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/drivers/usb/miniport/usbehci/usbehci.c b/reactos/drivers/usb/miniport/usbehci/usbehci.c new file mode 100644 index 00000000000..9289968a2db --- /dev/null +++ b/reactos/drivers/usb/miniport/usbehci/usbehci.c @@ -0,0 +1,41 @@ +/* + * ReactOS USB EHCI miniport driver + * Copyright (C) 2004 Mark Tempel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +/* INCLUDES *******************************************************************/ + +#include "usbehci.h" +#include "../../usbport/usbport.h" + +/* PUBLIC AND PRIVATE FUNCTIONS ***********************************************/ + +NTSTATUS STDCALL +DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath) +{ + PUSB_CONTROLLER_INTERFACE ControllerInterface; + + USBPORT_AllocateUsbControllerInterface(&ControllerInterface); + + /* + * Set up the list of callbacks here. + * TODO TODO TODO + */ + + return USBPORT_RegisterUSBPortDriver(DriverObject, 0, ControllerInterface); +} diff --git a/reactos/drivers/usb/miniport/usbehci/usbehci.h b/reactos/drivers/usb/miniport/usbehci/usbehci.h new file mode 100644 index 00000000000..7eccf7ae6fc --- /dev/null +++ b/reactos/drivers/usb/miniport/usbehci/usbehci.h @@ -0,0 +1,45 @@ +/* + * ReactOS USB EHCI miniport driver + * + * Copyright (C) 2004 Mark Tempel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef USBEHCI_H +#define USBEHCI_H + +/* INCLUDES *******************************************************************/ + +#include "stddef.h" +#include "windef.h" +//#include +#include + +#ifdef DBG +#define DPRINT(arg) DbgPrint arg; +#else +#define DPRINT(arg) +#endif + +// Export funcs here +/* +BOOL FASTCALL +VBESetColorRegisters( + PVBE_DEVICE_EXTENSION DeviceExtension, + PVIDEO_CLUT ColorLookUpTable, + PSTATUS_BLOCK StatusBlock); +*/ +#endif /* USBEHCI_H */ diff --git a/reactos/drivers/usb/miniport/usbehci/usbehci.rc b/reactos/drivers/usb/miniport/usbehci/usbehci.rc new file mode 100644 index 00000000000..241bf2b6713 --- /dev/null +++ b/reactos/drivers/usb/miniport/usbehci/usbehci.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "USB EHCI miniport Device Driver\0" +#define REACTOS_STR_INTERNAL_NAME "usbehci\0" +#define REACTOS_STR_ORIGINAL_FILENAME "usbehci.sys\0" +#include diff --git a/reactos/drivers/usb/miniport/usbohci/makefile b/reactos/drivers/usb/miniport/usbohci/makefile new file mode 100644 index 00000000000..f16a9d8aea0 --- /dev/null +++ b/reactos/drivers/usb/miniport/usbohci/makefile @@ -0,0 +1,16 @@ +PATH_TO_TOP = ../../../.. + +TARGET_TYPE = driver + +TARGET_NAME = usbohci + +TARGET_DDKLIBS = ntoskrnl.a usbport.a + +TARGET_CFLAGS = -Werror -Wall -I$(PATH_TO_TOP)/ntoskrnl/include -D__USE_W32API + +TARGET_OBJECTS = \ + usbohci.o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/drivers/usb/miniport/usbohci/usbohci.c b/reactos/drivers/usb/miniport/usbohci/usbohci.c new file mode 100644 index 00000000000..f8faf8991ca --- /dev/null +++ b/reactos/drivers/usb/miniport/usbohci/usbohci.c @@ -0,0 +1,41 @@ +/* + * ReactOS USB OpenHCI miniport driver + * Copyright (C) 2004 Mark Tempel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +/* INCLUDES *******************************************************************/ + +#include "usbohci.h" +#include "../../usbport/usbport.h" + +/* PUBLIC AND PRIVATE FUNCTIONS ***********************************************/ + +NTSTATUS STDCALL +DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath) +{ + PUSB_CONTROLLER_INTERFACE ControllerInterface; + + USBPORT_AllocateUsbControllerInterface(&ControllerInterface); + + /* + * Set up the list of callbacks here. + * TODO TODO TODO + */ + + return USBPORT_RegisterUSBPortDriver(DriverObject, 0, ControllerInterface); +} diff --git a/reactos/drivers/usb/miniport/usbohci/usbohci.h b/reactos/drivers/usb/miniport/usbohci/usbohci.h new file mode 100644 index 00000000000..c6f3aa09707 --- /dev/null +++ b/reactos/drivers/usb/miniport/usbohci/usbohci.h @@ -0,0 +1,45 @@ +/* + * ReactOS USB OpenHCI miniport driver + * + * Copyright (C) 2004 Mark Tempel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef USBOHCI_H +#define USBOHCI_H + +/* INCLUDES *******************************************************************/ + +#include "stddef.h" +#include "windef.h" +//#include +#include + +#ifdef DBG +#define DPRINT(arg) DbgPrint arg; +#else +#define DPRINT(arg) +#endif + +// Export funcs here +/* +BOOL FASTCALL +VBESetColorRegisters( + PVBE_DEVICE_EXTENSION DeviceExtension, + PVIDEO_CLUT ColorLookUpTable, + PSTATUS_BLOCK StatusBlock); +*/ +#endif /* USBOHCI_H */ diff --git a/reactos/drivers/usb/miniport/usbohci/usbohci.rc b/reactos/drivers/usb/miniport/usbohci/usbohci.rc new file mode 100644 index 00000000000..2badbbf8b5f --- /dev/null +++ b/reactos/drivers/usb/miniport/usbohci/usbohci.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "USB OpenHCI miniport Device Driver\0" +#define REACTOS_STR_INTERNAL_NAME "usbohci\0" +#define REACTOS_STR_ORIGINAL_FILENAME "usbohci.sys\0" +#include diff --git a/reactos/drivers/usb/miniport/usbuhci/makefile b/reactos/drivers/usb/miniport/usbuhci/makefile new file mode 100644 index 00000000000..b89c935ff71 --- /dev/null +++ b/reactos/drivers/usb/miniport/usbuhci/makefile @@ -0,0 +1,16 @@ +PATH_TO_TOP = ../../../.. + +TARGET_TYPE = driver + +TARGET_NAME = usbuhci + +TARGET_DDKLIBS = ntoskrnl.a usbport.a + +TARGET_CFLAGS = -Werror -Wall -I$(PATH_TO_TOP)/ntoskrnl/include -D__USE_W32API + +TARGET_OBJECTS = \ + usbuhci.o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/drivers/usb/miniport/usbuhci/usbuhci.c b/reactos/drivers/usb/miniport/usbuhci/usbuhci.c new file mode 100644 index 00000000000..52f60932352 --- /dev/null +++ b/reactos/drivers/usb/miniport/usbuhci/usbuhci.c @@ -0,0 +1,41 @@ +/* + * ReactOS USB UHCI miniport driver + * Copyright (C) 2004 Mark Tempel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +/* INCLUDES *******************************************************************/ + +#include "usbuhci.h" +#include "../../usbport/usbport.h" + +/* PUBLIC AND PRIVATE FUNCTIONS ***********************************************/ + +NTSTATUS STDCALL +DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath) +{ + PUSB_CONTROLLER_INTERFACE ControllerInterface; + + USBPORT_AllocateUsbControllerInterface(&ControllerInterface); + + /* + * Set up the list of callbacks here. + * TODO TODO TODO + */ + + return USBPORT_RegisterUSBPortDriver(DriverObject, 0, ControllerInterface); +} diff --git a/reactos/drivers/usb/miniport/usbuhci/usbuhci.h b/reactos/drivers/usb/miniport/usbuhci/usbuhci.h new file mode 100644 index 00000000000..2710effdea8 --- /dev/null +++ b/reactos/drivers/usb/miniport/usbuhci/usbuhci.h @@ -0,0 +1,45 @@ +/* + * ReactOS USB UHCI miniport driver + * + * Copyright (C) 2004 Mark Tempel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef USBUHCI_H +#define USBUHCI_H + +/* INCLUDES *******************************************************************/ + +#include "stddef.h" +#include "windef.h" +//#include +#include + +#ifdef DBG +#define DPRINT(arg) DbgPrint arg; +#else +#define DPRINT(arg) +#endif + +// Export funcs here +/* +BOOL FASTCALL +VBESetColorRegisters( + PVBE_DEVICE_EXTENSION DeviceExtension, + PVIDEO_CLUT ColorLookUpTable, + PSTATUS_BLOCK StatusBlock); +*/ +#endif /* USBUHCI_H */ diff --git a/reactos/drivers/usb/miniport/usbuhci/usbuhci.rc b/reactos/drivers/usb/miniport/usbuhci/usbuhci.rc new file mode 100644 index 00000000000..fbd26dd2978 --- /dev/null +++ b/reactos/drivers/usb/miniport/usbuhci/usbuhci.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "USB UHCI miniport Device Driver\0" +#define REACTOS_STR_INTERNAL_NAME "usbuhci\0" +#define REACTOS_STR_ORIGINAL_FILENAME "usbuhci.sys\0" +#include diff --git a/reactos/drivers/usb/usbhub/makefile b/reactos/drivers/usb/usbhub/makefile new file mode 100644 index 00000000000..644f5bd9a33 --- /dev/null +++ b/reactos/drivers/usb/usbhub/makefile @@ -0,0 +1,16 @@ +PATH_TO_TOP = ../../.. + +TARGET_TYPE = driver + +TARGET_NAME = usbhub + +TARGET_DDKLIBS = ntoskrnl.a + +TARGET_CFLAGS = -Werror -Wall -I$(PATH_TO_TOP)/ntoskrnl/include -D__USE_W32API + +TARGET_OBJECTS = \ + usbhub.o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/drivers/usb/usbhub/usbhub.c b/reactos/drivers/usb/usbhub/usbhub.c new file mode 100644 index 00000000000..00098d4bd11 --- /dev/null +++ b/reactos/drivers/usb/usbhub/usbhub.c @@ -0,0 +1,38 @@ +/* + * ReactOS USB hub driver + * Copyright (C) 2004 Aleksey Bragin + * (C) 2005 Mark Tempel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +/* INCLUDES *******************************************************************/ +#include +#include +#include +#include "..\usbport\usbport.h" + +/* PUBLIC AND PRIVATE FUNCTIONS ***********************************************/ + +/* + * Standard DriverEntry method. + */ +NTSTATUS STDCALL +DriverEntry(IN PVOID Context1, IN PVOID Context2) +{ + return STATUS_SUCCESS; +} + diff --git a/reactos/drivers/usb/usbhub/usbhub.def b/reactos/drivers/usb/usbhub/usbhub.def new file mode 100644 index 00000000000..b1a9fe457c3 --- /dev/null +++ b/reactos/drivers/usb/usbhub/usbhub.def @@ -0,0 +1,4 @@ +; +; Exports definition file for usbhub.sys +; +EXPORTS diff --git a/reactos/drivers/usb/usbhub/usbhub.h b/reactos/drivers/usb/usbhub/usbhub.h new file mode 100644 index 00000000000..01a26a42a1c --- /dev/null +++ b/reactos/drivers/usb/usbhub/usbhub.h @@ -0,0 +1,10 @@ +/* + * Declarations for undocumented usbport.sys calls + * + * Written by Mark Tempel + */ + +#ifndef _USBHUB_H +#define _USBHUB_H + +#endif /* _USBHUB_H */ diff --git a/reactos/drivers/usb/usbhub/usbhub.rc b/reactos/drivers/usb/usbhub/usbhub.rc new file mode 100644 index 00000000000..9f253e2e890 --- /dev/null +++ b/reactos/drivers/usb/usbhub/usbhub.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "USB Hub Driver\0" +#define REACTOS_STR_INTERNAL_NAME "usbhub\0" +#define REACTOS_STR_ORIGINAL_FILENAME "usbhub.sys\0" +#include diff --git a/reactos/drivers/usb/usbport/makefile b/reactos/drivers/usb/usbport/makefile new file mode 100644 index 00000000000..40ead05a02c --- /dev/null +++ b/reactos/drivers/usb/usbport/makefile @@ -0,0 +1,16 @@ +PATH_TO_TOP = ../../.. + +TARGET_TYPE = export_driver + +TARGET_NAME = usbport + +TARGET_DDKLIBS = ntoskrnl.a + +TARGET_CFLAGS = -Werror -Wall -I$(PATH_TO_TOP)/ntoskrnl/include -D__USE_W32API + +TARGET_OBJECTS = \ + usbport.o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/drivers/usb/usbport/usbport.c b/reactos/drivers/usb/usbport/usbport.c new file mode 100644 index 00000000000..acd78980beb --- /dev/null +++ b/reactos/drivers/usb/usbport/usbport.c @@ -0,0 +1,81 @@ +/* + * ReactOS USB Port driver + * Copyright (C) 2004 Aleksey Bragin + * (C) 2005 Mark Tempel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * STATUS: + * 19-Dec-2004 - just a stub for now, but with useful info by Filip + */ + +/* INCLUDES *******************************************************************/ +#include +#include +#include +#include "usbport.h" + +/* PUBLIC AND PRIVATE FUNCTIONS ***********************************************/ + +/* +** Standard DriverEntry method. +** We do nothing here. All real work is done in USBPRORT_RegisterUSBPortDriver. +*/ +NTSTATUS STDCALL +DriverEntry(IN PVOID Context1, IN PVOID Context2) +{ + return STATUS_SUCCESS; +} +/* + * This method is used by miniports to connect set up + */ +NTSTATUS STDCALL +USBPORT_RegisterUSBPortDriver(PDRIVER_OBJECT DriverObject, DWORD Unknown1, + PUSB_CONTROLLER_INTERFACE Interface) +{ + ASSERT(KeGetCurrentIRQL() < DISPATCH_LEVEL); + + return STATUS_SUCCESS; +} + +NTSTATUS STDCALL +USBPORT_GetHciMn(VOID) +{ + return 0x10000001; +} +/* + * This method is to allow miniports to create + */ +NTSTATUS STDCALL +USBPORT_AllocateUsbControllerInterface(OUT PUSB_CONTROLLER_INTERFACE *pControllerInterface) +{ + ASSERT(KeGetCurrentIRQL() < DISPATCH_LEVEL); + ASSERT(0 != ControllerObject); + + *pControllerInterface = (PUSB_CONTROLLER_INTERFACE)ExAllocatePoolWithTag(PagedPool, sizeof(USB_CONTROLLER_INTERFACE),USB_CONTROLLER_INTERFACE_TAG); + RtlZeroMemory(*pControllerInterface, sizeof(USB_CONTROLLER_INTERFACE)); + + return STATUS_SUCCESS; +} + +NTSTATUS STDCALL +USBPORT_FreeUsbControllerInterface(IN PUSB_CONTROLLER_INTERFACE ControllerInterface) +{ + ASSERT(KeGetCurrentIRQL() < DISPATCH_LEVEL); + + ExFreePool(ControllerInterface); + + return STATUS_SUCCESS; +} diff --git a/reactos/drivers/usb/usbport/usbport.def b/reactos/drivers/usb/usbport/usbport.def new file mode 100644 index 00000000000..c647cb15917 --- /dev/null +++ b/reactos/drivers/usb/usbport/usbport.def @@ -0,0 +1,8 @@ +; +; Exports definition file for usbport.sys +; +EXPORTS +USBPORT_RegisterUSBPortDriver@12 +USBPORT_GetHciMn@0 +USBPORT_AllocateUsbControllerInterface@4 +USBPORT_FreeUsbControllerInterface@4 \ No newline at end of file diff --git a/reactos/drivers/usb/usbport/usbport.h b/reactos/drivers/usb/usbport/usbport.h new file mode 100644 index 00000000000..36cfc509be0 --- /dev/null +++ b/reactos/drivers/usb/usbport/usbport.h @@ -0,0 +1,130 @@ +/* + * Declarations for undocumented usbport.sys calls + * + * Written by Filip Navara + * Updates by Mark Tempel + */ + +#ifndef _USBPORT_H +#define _USBPORT_H + +#define USB_CONTROLLER_INTERFACE_TAG 0x001E1E10 + +/**** B E G I N M S I N T E R N A L P R O T O C O L ****/ +typedef DWORD (*POPEN_ENDPOINT)( + DWORD Unknown1, + DWORD Unknown2, + DWORD Unknown3 +); + +typedef NTSTATUS (*PPOKE_ENDPOINT)( + DWORD Unknown1, + DWORD Unknown2, + DWORD Unknown3 +); + +typedef DWORD (*PQUERY_ENDPOINT_REQUIREMENTS)( + DWORD Unknown1, + DWORD Unknown2, + DWORD Unknown3 +); + +typedef VOID (*PCLOSE_ENDPOINT)( + DWORD Unknown1, + DWORD Unknown2 +); + + + +typedef struct { + DWORD Unknown1; /* 2 (UHCI), 3 (EHCI) */ + DWORD Unknown2; /* 2C3 (UHCI), 95 (EHCI) */ + DWORD Unknown3; /* 2EE0 (UHCI), 61A80 (EHCI) */ + DWORD Unknown4; /* - */ + DWORD Unknown5; /* 164 (UHCI), 178 (EHCI) */ + DWORD Unknown6; /* 8C (UHCI), A0 (EHCI) */ + DWORD Unknown7; /* 1C (UHCI), 30 (EHCI) */ /* Offset: 118 */ + DWORD Unknown8; /* - */ + DWORD Unknown9; /* - */ + DWORD Unknown10; /* 2280 (UHCI), 2C800 (EHCI) */ /* Offset: 124 */ + POPEN_ENDPOINT OpenEndpoint; + PPOKE_ENDPOINT PokeEndpoint; + PQUERY_ENDPOINT_REQUIREMENTS QueryEndpointRequirements; + PCLOSE_ENDPOINT CloseEndpoint; + PVOID StartController; /* P00010A1C (2) */ /* Offset: 138 */ + PVOID StopController; /* P00010952 */ /* Offset: 13C */ + PVOID SuspendController; /* P00011584 */ /* Offset: 140 */ + PVOID ResumeController; /* P0001164C */ /* Offset: 144 */ + PVOID InterruptService; /* P00013C72 */ /* Offset: 148 */ + PVOID InterruptDpc; /* P00013D8E */ /* Offset: 14C */ + PVOID SubmitTransfer; /* P00011010 */ /* Offset: 150 */ + PVOID IsochTransfer; /* P000136E8 */ /* Offset: 154 */ + PVOID AbortTransfer; /* P00011092 */ /* Offset: 158 */ + PVOID GetEndpointState; /* P00010F48 */ /* Offset: 15C */ + PVOID SetEndpointState; /* P00010EFA */ /* Offset: 160 */ + PVOID PollEndpoint; /* P00010D32 */ /* Offset: 164 */ + PVOID CheckController; /* P00011794 */ /* Offset: 168 */ + PVOID Get32BitFrameNumber; /* P00010F86 */ /* Offset: 16C */ + PVOID InterruptNextSOF; /* P00013F56 */ /* Offset: 170 */ + PVOID EnableInterrupts; /* P00013ED0 */ /* Offset: 174 */ + PVOID DisableInterrupts; /* P00013E18 */ /* Offset: 178 */ + PVOID PollController; /* P00010FF2 */ /* Offset: 17C */ + PVOID SetEndpointDataToggle; /* P000110E6 */ /* Offset: 180 */ + PVOID GetEndpointStatus; /* P00010ECE */ /* Offset: 184 */ + PVOID SetEndpointStatus; /* P00010E52 */ /* Offset: 188 */ + DWORD Unknown36; /* - */ + PVOID RHGetRootHubData; /* P00011AC6 */ /* Offset: 190 */ + PVOID RHGetStatus; /* P00011B1A */ /* Offset: 194 */ + PVOID RHGetPortStatus; /* P00011BBA */ /* Offset: 198 */ + PVOID RHGetHubStatus; /* P00011B28 */ /* Offset: 19C */ + PVOID RHSetFeaturePortReset; /* P00011F84 */ /* Offset: 1A0 */ + PVOID RHSetFeaturePortPower; /* P00011BB4 */ /* Offset: 1A4 */ + PVOID RHSetFeaturePortEnable; /* P00011BA2 */ /* Offset: 1A8 */ + PVOID RHSetFeaturePortSuspend; /* P00011FF8 */ /* Offset: 1AC */ + PVOID RHClearFeaturePortEnable; /* P00011B90 */ /* Offset: 1B0 */ + PVOID RHClearFeaturePortPower; /* P00011BB4 */ /* Offset: 1B4 */ + PVOID RHClearFeaturePortSuspend; /* P0001210E */ /* Offset: 1B8 */ + PVOID RHClearFeaturePortEnableChange; /* P00012236 */ /* Offset: 1BC */ + PVOID RHClearFeaturePortConnectChange; /* P000121DE */ /* Offset: 1C0 */ + PVOID RHClearFeaturePortResetChange; /* P00012284 */ /* Offset: 1C4 */ + PVOID RHClearFeaturePortSuspendChange; /* P0001229C */ /* Offset: 1C8 */ + PVOID RHClearFeaturePortOvercurrentChange; /* P000122B4 */ /* Offset: 1CC */ + PVOID RHDisableIrq; /* P00013F52 */ /* Offset: 1D0 */ + PVOID RHDisableIrq2; /* P00013F52 */ /* Offset: 1D4 */ + PVOID StartSendOnePacket; /* P00011144 */ /* Offset: 1D8 */ + PVOID EndSendOnePacket; /* P000119B6 */ /* Offset: 1DC */ + PVOID PassThru; /* P000110E0 */ /* Offset: 1E0 */ + DWORD Unknown58[17]; /* - */ + PVOID FlushInterrupts; /* P00013EA0 */ /* Offset: 228 */ + /* ... */ +} USB_CONTROLLER_INTERFACE, *PUSB_CONTROLLER_INTERFACE; +/**** E N D M S I N T E R N A L P R O T O C O L ****/ + +/* + * With this call USB miniport driver registers itself with usbport.sys + * + * Unknown1 - Could be 0x64 or 0xC8. (0x9A also ?) + * Unknown2 - Pointer to structure which contains function entry points + */ +NTSTATUS STDCALL +USBPORT_RegisterUSBPortDriver(PDRIVER_OBJECT DriverObject, DWORD Unknown1, + PUSB_CONTROLLER_INTERFACE Interface); + +/* + * This function always returns 0x10000001 in Windows XP SP1 + */ +NTSTATUS STDCALL +USBPORT_GetHciMn(VOID); + +/* + * This method is provided for miniports to use to allocate their USB_CONTROLLER_INTERFACEs. + */ +NTSTATUS STDCALL +USBPORT_AllocateUsbControllerInterface(OUT PUSB_CONTROLLER_INTERFACE *pControllerInterface); + +/* + * We can't have an allocate without a free. + */ +NTSTATUS STDCALL +USBPORT_FreeUsbControllerInterface(IN PUSB_CONTROLLER_INTERFACE ControllerInterface); +#endif /* _USBPORT_H */ diff --git a/reactos/drivers/usb/usbport/usbport.rc b/reactos/drivers/usb/usbport/usbport.rc new file mode 100644 index 00000000000..e8482bb8fc0 --- /dev/null +++ b/reactos/drivers/usb/usbport/usbport.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "USB Port Driver\0" +#define REACTOS_STR_INTERNAL_NAME "usbport\0" +#define REACTOS_STR_ORIGINAL_FILENAME "usbport.sys\0" +#include