Author: tfaber
Date: Sun Jul 9 21:05:58 2017
New Revision: 75314
URL:
http://svn.reactos.org/svn/reactos?rev=75314&view=rev
Log:
[USBPORT]
Patch by Vadim Galyant:
- Improve variable naming
- Make more consistent use of constants
Modified:
trunk/reactos/drivers/usb/usbport/debug.c
trunk/reactos/drivers/usb/usbport/pnp.c
trunk/reactos/drivers/usb/usbport/roothub.c
trunk/reactos/drivers/usb/usbport/usbport.c
trunk/reactos/drivers/usb/usbport/usbport.h
trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h
Modified: trunk/reactos/drivers/usb/usbport/debug.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbport/debug.…
==============================================================================
--- trunk/reactos/drivers/usb/usbport/debug.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbport/debug.c [iso-8859-1] Sun Jul 9 21:05:58 2017
@@ -9,7 +9,7 @@
ULONG
NTAPI
-USBPORT_DbgPrint(IN PVOID Context,
+USBPORT_DbgPrint(IN PVOID MiniPortExtension,
IN ULONG Level,
IN PCH Format,
...)
@@ -20,7 +20,7 @@
ULONG
NTAPI
-USBPORT_TestDebugBreak(IN PVOID Context)
+USBPORT_TestDebugBreak(IN PVOID MiniPortExtension)
{
DPRINT("USBPORT_TestDebugBreak: UNIMPLEMENTED. FIXME. \n");
return 0;
@@ -28,7 +28,7 @@
ULONG
NTAPI
-USBPORT_AssertFailure(PVOID Context,
+USBPORT_AssertFailure(PVOID MiniPortExtension,
PVOID FailedAssertion,
PVOID FileName,
ULONG LineNumber,
@@ -41,7 +41,7 @@
VOID
NTAPI
-USBPORT_BugCheck(IN PVOID Context)
+USBPORT_BugCheck(IN PVOID MiniPortExtension)
{
DPRINT1("USBPORT_BugCheck: FIXME \n");
//KeBugCheckEx(BUGCODE_USB_DRIVER, ...);
@@ -50,15 +50,15 @@
ULONG
NTAPI
-USBPORT_LogEntry(IN PVOID BusContext,
+USBPORT_LogEntry(IN PVOID MiniPortExtension,
IN ULONG DriverTag,
IN ULONG EnumTag,
IN ULONG P1,
IN ULONG P2,
IN ULONG P3)
{
- DPRINT_MINIPORT("USBPORT_LogEntry: BusContext - %p, EnumTag - %lx, P1 - %lx, P2
- %lx, P3 - %lx\n",
- BusContext,
+ DPRINT_MINIPORT("USBPORT_LogEntry: MiniPortExtension - %p, EnumTag - %lx, P1 -
%lx, P2 - %lx, P3 - %lx\n",
+ MiniPortExtension,
EnumTag,
P1,
P2,
Modified: trunk/reactos/drivers/usb/usbport/pnp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbport/pnp.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbport/pnp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbport/pnp.c [iso-8859-1] Sun Jul 9 21:05:58 2017
@@ -1372,7 +1372,7 @@
if (!(FdoCommonExtension->PnpStateFlags & USBPORT_PNP_STATE_FAILED))
{
USBPORT_InvalidateControllerHandler(FdoDevice,
-
INVALIDATE_CONTROLLER_SURPRISE_REMOVE);
+
USBPORT_INVALIDATE_CONTROLLER_SURPRISE_REMOVE);
}
goto ForwardIrp;
Modified: trunk/reactos/drivers/usb/usbport/roothub.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbport/roothu…
==============================================================================
--- trunk/reactos/drivers/usb/usbport/roothub.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbport/roothub.c [iso-8859-1] Sun Jul 9 21:05:58 2017
@@ -907,7 +907,7 @@
ULONG
NTAPI
-USBPORT_InvalidateRootHub(PVOID Context)
+USBPORT_InvalidateRootHub(PVOID MiniPortExtension)
{
PUSBPORT_DEVICE_EXTENSION FdoExtension;
PDEVICE_OBJECT FdoDevice;
@@ -917,7 +917,7 @@
DPRINT("USBPORT_InvalidateRootHub ... \n");
- FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context -
+ FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension -
sizeof(USBPORT_DEVICE_EXTENSION));
FdoDevice = FdoExtension->CommonExtension.SelfDevice;
Modified: trunk/reactos/drivers/usb/usbport/usbport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbport/usbpor…
==============================================================================
--- trunk/reactos/drivers/usb/usbport/usbport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbport/usbport.c [iso-8859-1] Sun Jul 9 21:05:58 2017
@@ -363,7 +363,7 @@
MPSTATUS
NTAPI
-USBPORT_GetMiniportRegistryKeyValue(IN PVOID Context,
+USBPORT_GetMiniportRegistryKeyValue(IN PVOID MiniPortExtension,
IN BOOL UseDriverKey,
IN PCWSTR SourceString,
IN SIZE_T LengthStr,
@@ -374,18 +374,15 @@
PDEVICE_OBJECT FdoDevice;
NTSTATUS Status;
- DPRINT("USBPORT_GetMiniportRegistryKeyValue: Context - %p, UseDriverKey - %x,
SourceString - %S, LengthStr - %x, Buffer - %p, BufferLength - %x\n",
- Context,
+ DPRINT("USBPORT_GetMiniportRegistryKeyValue: MiniPortExtension - %p,
UseDriverKey - %x, SourceString - %S, LengthStr - %x, Buffer - %p, BufferLength -
%x\n",
+ MiniPortExtension,
UseDriverKey,
SourceString,
LengthStr,
Buffer,
BufferLength);
- //DbgBreakPoint();
-
- //FdoExtension->MiniPortExt = (PVOID)((ULONG_PTR)FdoExtension +
sizeof(USBPORT_DEVICE_EXTENSION));
- FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context -
+ FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension -
sizeof(USBPORT_DEVICE_EXTENSION));
FdoDevice = FdoExtension->CommonExtension.SelfDevice;
@@ -449,7 +446,7 @@
MPSTATUS
NTAPI
-USBPORT_ReadWriteConfigSpace(IN PVOID Context,
+USBPORT_ReadWriteConfigSpace(IN PVOID MiniPortExtension,
IN BOOLEAN IsReadData,
IN PVOID Buffer,
IN ULONG Offset,
@@ -462,7 +459,7 @@
DPRINT("USBPORT_ReadWriteConfigSpace: ... \n");
//FdoExtension->MiniPortExt = (PVOID)((ULONG_PTR)FdoExtension +
sizeof(USBPORT_DEVICE_EXTENSION));
- FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context -
+ FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension -
sizeof(USBPORT_DEVICE_EXTENSION));
FdoDevice = FdoExtension->CommonExtension.SelfDevice;
@@ -536,7 +533,7 @@
NTSTATUS
NTAPI
-USBPORT_Wait(IN PVOID Context,
+USBPORT_Wait(IN PVOID MiniPortExtension,
IN ULONG Milliseconds)
{
LARGE_INTEGER Interval = {{0, 0}};
@@ -640,15 +637,15 @@
switch (Type)
{
- case INVALIDATE_CONTROLLER_RESET:
+ case USBPORT_INVALIDATE_CONTROLLER_RESET:
DPRINT1("USBPORT_InvalidateControllerHandler:
INVALIDATE_CONTROLLER_RESET UNIMPLEMENTED. FIXME. \n");
break;
- case INVALIDATE_CONTROLLER_SURPRISE_REMOVE:
+ case USBPORT_INVALIDATE_CONTROLLER_SURPRISE_REMOVE:
DPRINT1("USBPORT_InvalidateControllerHandler:
INVALIDATE_CONTROLLER_SURPRISE_REMOVE UNIMPLEMENTED. FIXME. \n");
break;
- case INVALIDATE_CONTROLLER_SOFT_INTERRUPT:
+ case USBPORT_INVALIDATE_CONTROLLER_SOFT_INTERRUPT:
if (InterlockedIncrement(&FdoExtension->IsrDpcCounter))
{
InterlockedDecrement(&FdoExtension->IsrDpcCounter);
@@ -663,7 +660,7 @@
ULONG
NTAPI
-USBPORT_InvalidateController(IN PVOID Context,
+USBPORT_InvalidateController(IN PVOID MiniPortExtension,
IN ULONG Type)
{
PUSBPORT_DEVICE_EXTENSION FdoExtension;
@@ -672,7 +669,7 @@
DPRINT("USBPORT_InvalidateController: Invalidate Type - %x\n", Type);
//FdoExtension->MiniPortExt = (PVOID)((ULONG_PTR)FdoExtension +
sizeof(USBPORT_DEVICE_EXTENSION));
- FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context -
+ FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension -
sizeof(USBPORT_DEVICE_EXTENSION));
FdoDevice = FdoExtension->CommonExtension.SelfDevice;
@@ -683,8 +680,8 @@
ULONG
NTAPI
-USBPORT_NotifyDoubleBuffer(IN PVOID Context1,
- IN PVOID Context2,
+USBPORT_NotifyDoubleBuffer(IN PVOID MiniPortExtension,
+ IN PVOID MiniPortTransfer,
IN PVOID Buffer,
IN SIZE_T Length)
{
@@ -2011,7 +2008,7 @@
ULONG
NTAPI
-USBPORT_RequestAsyncCallback(IN PVOID Context,
+USBPORT_RequestAsyncCallback(IN PVOID MiniPortExtension,
IN ULONG TimerValue,
IN PVOID Buffer,
IN SIZE_T Length,
@@ -2024,7 +2021,7 @@
DPRINT("USBPORT_RequestAsyncCallback: ... \n");
- FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context -
+ FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension -
sizeof(USBPORT_DEVICE_EXTENSION));
FdoDevice = FdoExtension->CommonExtension.SelfDevice;
@@ -2096,8 +2093,8 @@
ULONG
NTAPI
-USBPORT_InvalidateEndpoint(IN PVOID Context1,
- IN PVOID Context2)
+USBPORT_InvalidateEndpoint(IN PVOID MiniPortExtension,
+ IN PVOID MiniPortEndpoint)
{
PUSBPORT_DEVICE_EXTENSION FdoExtension;
PDEVICE_OBJECT FdoDevice;
@@ -2105,26 +2102,25 @@
DPRINT_CORE("USBPORT_InvalidateEndpoint: ... \n");
- FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context1 -
+ FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension -
sizeof(USBPORT_DEVICE_EXTENSION));
FdoDevice = FdoExtension->CommonExtension.SelfDevice;
- Endpoint = (PUSBPORT_ENDPOINT)((ULONG_PTR)Context2 -
- sizeof(USBPORT_ENDPOINT));
-
- if (Context2)
- {
- USBPORT_InvalidateEndpointHandler(FdoDevice,
- Endpoint,
- INVALIDATE_ENDPOINT_ONLY);
- }
- else
+ if (!MiniPortEndpoint)
{
USBPORT_InvalidateEndpointHandler(FdoDevice,
NULL,
INVALIDATE_ENDPOINT_ONLY);
- }
+ return 0;
+ }
+
+ Endpoint = (PUSBPORT_ENDPOINT)((ULONG_PTR)MiniPortEndpoint -
+ sizeof(USBPORT_ENDPOINT));
+
+ USBPORT_InvalidateEndpointHandler(FdoDevice,
+ Endpoint,
+ INVALIDATE_ENDPOINT_ONLY);
return 0;
}
@@ -2698,7 +2694,7 @@
DPRINT("USBPORT_RegisterUSBPortDriver: sizeof(USBPORT_DEVICE_EXTENSION) -
%x\n",
sizeof(USBPORT_DEVICE_EXTENSION));
- if (Version < 100) // 100 - USB1.1; 200 - USB2.0
+ if (Version < USB10_MINIPORT_INTERFACE_VERSION)
{
return STATUS_UNSUCCESSFUL;
}
Modified: trunk/reactos/drivers/usb/usbport/usbport.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbport/usbpor…
==============================================================================
--- trunk/reactos/drivers/usb/usbport/usbport.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbport/usbport.h [iso-8859-1] Sun Jul 9 21:05:58 2017
@@ -25,10 +25,6 @@
#define USBPORT_RECIPIENT_ROOT_HUB BMREQUEST_TO_DEVICE
#define USBPORT_RECIPIENT_ROOT_PORT BMREQUEST_TO_OTHER
-
-#define INVALIDATE_CONTROLLER_RESET 1
-#define INVALIDATE_CONTROLLER_SURPRISE_REMOVE 2
-#define INVALIDATE_CONTROLLER_SOFT_INTERRUPT 3
#define INVALIDATE_ENDPOINT_ONLY 0
#define INVALIDATE_ENDPOINT_WORKER_THREAD 1
@@ -414,7 +410,7 @@
NTSTATUS
NTAPI
USBPORT_Wait(
- IN PVOID Context,
+ IN PVOID MiniPortExtension,
IN ULONG Milliseconds);
VOID
@@ -570,7 +566,7 @@
ULONG
NTAPI
USBPORT_DbgPrint(
- IN PVOID Context,
+ IN PVOID MiniPortExtension,
IN ULONG Level,
IN PCH Format,
...);
@@ -578,12 +574,12 @@
ULONG
NTAPI
USBPORT_TestDebugBreak(
- IN PVOID Context);
+ IN PVOID MiniPortExtension);
ULONG
NTAPI
USBPORT_AssertFailure(
- PVOID Context,
+ PVOID MiniPortExtension,
PVOID FailedAssertion,
PVOID FileName,
ULONG LineNumber,
@@ -592,12 +588,12 @@
VOID
NTAPI
USBPORT_BugCheck(
- IN PVOID Context);
+ IN PVOID MiniPortExtension);
ULONG
NTAPI
USBPORT_LogEntry(
- IN PVOID BusContext,
+ IN PVOID MiniPortExtension,
IN ULONG DriverTag,
IN ULONG EnumTag,
IN ULONG P1,
@@ -1090,7 +1086,7 @@
ULONG
NTAPI
USBPORT_InvalidateRootHub(
- PVOID Context);
+ PVOID MiniPortExtension);
VOID
NTAPI
Modified: trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/driver…
==============================================================================
--- trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h [iso-8859-1] (original)
+++ trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h [iso-8859-1] Sun Jul 9
21:05:58 2017
@@ -20,6 +20,21 @@
#define USBPORT_ENDPOINT_RUN 0
#define USBPORT_ENDPOINT_HALT 1
#define USBPORT_ENDPOINT_CONTROL 4
+
+/* Interrupt Endpoint Poll Interval */
+#define ENDPOINT_INTERRUPT_1ms 1
+#define ENDPOINT_INTERRUPT_2ms 2
+#define ENDPOINT_INTERRUPT_4ms 4
+#define ENDPOINT_INTERRUPT_8ms 8
+#define ENDPOINT_INTERRUPT_16ms 16
+#define ENDPOINT_INTERRUPT_32ms 32
+
+#define INTERRUPT_ENDPOINTs (ENDPOINT_INTERRUPT_32ms + \
+ ENDPOINT_INTERRUPT_16ms + \
+ ENDPOINT_INTERRUPT_8ms + \
+ ENDPOINT_INTERRUPT_4ms + \
+ ENDPOINT_INTERRUPT_2ms + \
+ ENDPOINT_INTERRUPT_1ms)
/* Types of resources. For USBPORT_RESOURCES::ResourcesTypes */
#define USBPORT_RESOURCES_PORT 1
@@ -405,6 +420,10 @@
PVOID,
ULONG);
+#define USBPORT_INVALIDATE_CONTROLLER_RESET 1
+#define USBPORT_INVALIDATE_CONTROLLER_SURPRISE_REMOVE 2
+#define USBPORT_INVALIDATE_CONTROLLER_SOFT_INTERRUPT 3
+
typedef ULONG
(NTAPI *PUSBPORT_INVALIDATE_CONTROLLER)(
PVOID,
@@ -452,6 +471,9 @@
#define USB_MINIPORT_FLAGS_POLLING 0x0080
#define USB_MINIPORT_FLAGS_NO_DMA 0x0100
#define USB_MINIPORT_FLAGS_WAKE_SUPPORT 0x0200
+
+#define TOTAL_USB11_BUS_BANDWIDTH 12000
+#define TOTAL_USB20_BUS_BANDWIDTH 400000
typedef struct _USBPORT_REGISTRATION_PACKET {
ULONG MiniPortVersion;
@@ -545,6 +567,9 @@
ULONG Reserved5;
} USBPORT_REGISTRATION_PACKET, *PUSBPORT_REGISTRATION_PACKET;
+#define USB10_MINIPORT_INTERFACE_VERSION 100
+#define USB20_MINIPORT_INTERFACE_VERSION 200
+
typedef struct _USBPORT_MINIPORT_INTERFACE {
PDRIVER_OBJECT DriverObject;
LIST_ENTRY DriverLink;