ULONG
NTAPI
-USBPORT_DbgPrint(IN PVOID Context,
+USBPORT_DbgPrint(IN PVOID MiniPortExtension,
IN ULONG Level,
IN PCH Format,
...)
ULONG
NTAPI
-USBPORT_TestDebugBreak(IN PVOID Context)
+USBPORT_TestDebugBreak(IN PVOID MiniPortExtension)
{
DPRINT("USBPORT_TestDebugBreak: UNIMPLEMENTED. FIXME. \n");
return 0;
ULONG
NTAPI
-USBPORT_AssertFailure(PVOID Context,
+USBPORT_AssertFailure(PVOID MiniPortExtension,
PVOID FailedAssertion,
PVOID FileName,
ULONG LineNumber,
VOID
NTAPI
-USBPORT_BugCheck(IN PVOID Context)
+USBPORT_BugCheck(IN PVOID MiniPortExtension)
{
DPRINT1("USBPORT_BugCheck: FIXME \n");
//KeBugCheckEx(BUGCODE_USB_DRIVER, ...);
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,
MPSTATUS
NTAPI
-USBPORT_GetMiniportRegistryKeyValue(IN PVOID Context,
+USBPORT_GetMiniportRegistryKeyValue(IN PVOID MiniPortExtension,
IN BOOL UseDriverKey,
IN PCWSTR SourceString,
IN SIZE_T LengthStr,
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;
MPSTATUS
NTAPI
-USBPORT_ReadWriteConfigSpace(IN PVOID Context,
+USBPORT_ReadWriteConfigSpace(IN PVOID MiniPortExtension,
IN BOOLEAN IsReadData,
IN PVOID Buffer,
IN ULONG Offset,
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;
NTSTATUS
NTAPI
-USBPORT_Wait(IN PVOID Context,
+USBPORT_Wait(IN PVOID MiniPortExtension,
IN ULONG Milliseconds)
{
LARGE_INTEGER Interval = {{0, 0}};
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);
ULONG
NTAPI
-USBPORT_InvalidateController(IN PVOID Context,
+USBPORT_InvalidateController(IN PVOID MiniPortExtension,
IN ULONG Type)
{
PUSBPORT_DEVICE_EXTENSION FdoExtension;
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;
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)
{
ULONG
NTAPI
-USBPORT_RequestAsyncCallback(IN PVOID Context,
+USBPORT_RequestAsyncCallback(IN PVOID MiniPortExtension,
IN ULONG TimerValue,
IN PVOID Buffer,
IN SIZE_T Length,
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;
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;
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;
}
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;
}
#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
#define USBPORT_RESOURCES_INTERRUPT 2
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,
#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;
ULONG MiniPortFlags;
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;