[USBPORT]

Patch by Vadim Galyant:
- Move isochronous transfer functions to their own file
- Fix return type of PUSBPORT_COMPLETE_TRANSFER
- Improve some debug prints

svn path=/trunk/; revision=75745
This commit is contained in:
Thomas Faber 2017-09-02 22:48:45 +00:00
parent e8937c0896
commit fae06a9723
6 changed files with 58 additions and 23 deletions

View file

@ -7,6 +7,7 @@ list(APPEND SOURCE
endpoint.c
iface.c
ioctl.c
iso.c
pnp.c
power.c
queue.c

View file

@ -0,0 +1,26 @@
#include "usbport.h"
#define NDEBUG
#include <debug.h>
USBD_STATUS
NTAPI
USBPORT_InitializeIsoTransfer(PDEVICE_OBJECT FdoDevice,
struct _URB_ISOCH_TRANSFER * Urb,
PUSBPORT_TRANSFER Transfer)
{
DPRINT1("USBPORT_InitializeIsoTransfer: UNIMPLEMENTED. FIXME.\n");
return USBD_STATUS_NOT_SUPPORTED;
}
ULONG
NTAPI
USBPORT_CompleteIsoTransfer(IN PVOID MiniPortExtension,
IN PVOID MiniPortEndpoint,
IN PVOID TransferParameters,
IN ULONG TransferLength)
{
DPRINT1("USBPORT_CompleteIsoTransfer: UNIMPLEMENTED. FIXME.\n");
return 0;
}

View file

@ -531,7 +531,7 @@ USBPORT_CancelActiveTransferIrp(IN PDEVICE_OBJECT DeviceObject,
PIRP irp;
KIRQL OldIrql;
DPRINT_CORE("USBPORT_CancelTransferIrp: Irp - %p\n", Irp);
DPRINT_CORE("USBPORT_CancelActiveTransferIrp: Irp - %p\n", Irp);
PdoExtension = DeviceObject->DeviceExtension;
FdoDevice = PdoExtension->FdoDevice;
@ -549,7 +549,7 @@ USBPORT_CancelActiveTransferIrp(IN PDEVICE_OBJECT DeviceObject,
Transfer = Urb->UrbControlTransfer.hca.Reserved8[0];
Endpoint = Transfer->Endpoint;
DPRINT_CORE("USBPORT_CancelTransferIrp: irp - %p, Urb - %p, Transfer - %p\n",
DPRINT_CORE("USBPORT_CancelActiveTransferIrp: irp - %p, Urb - %p, Transfer - %p\n",
irp,
Urb,
Transfer);

View file

@ -588,7 +588,7 @@ USBPORT_SoftInterruptDpc(IN PRKDPC Dpc,
PDEVICE_OBJECT FdoDevice;
PUSBPORT_DEVICE_EXTENSION FdoExtension;
DPRINT("USBPORT_SoftInterruptDpc: ... \n");
DPRINT_INT("USBPORT_SoftInterruptDpc: ... \n");
FdoDevice = DeferredContext;
FdoExtension = FdoDevice->DeviceExtension;
@ -606,7 +606,7 @@ USBPORT_SoftInterrupt(IN PDEVICE_OBJECT FdoDevice)
PUSBPORT_DEVICE_EXTENSION FdoExtension;
LARGE_INTEGER DueTime = {{0, 0}};
DPRINT("USBPORT_SoftInterrupt: ... \n");
DPRINT_INT("USBPORT_SoftInterrupt: ... \n");
FdoExtension = FdoDevice->DeviceExtension;
@ -1079,7 +1079,8 @@ USBPORT_InterruptService(IN PKINTERRUPT Interrupt,
FdoExtension = FdoDevice->DeviceExtension;
Packet = &FdoExtension->MiniPortInterface->Packet;
DPRINT_INT("USBPORT_InterruptService: FdoExtension->Flags - %lx\n",
DPRINT_INT("USBPORT_InterruptService: FdoExtension[%p]->Flags - %08X\n",
FdoExtension,
FdoExtension->Flags);
if (FdoExtension->Flags & USBPORT_FLAG_INTERRUPT_ENABLED &&
@ -1936,7 +1937,7 @@ USBPORT_Unload(IN PDRIVER_OBJECT DriverObject)
//MiniPortInterface->DriverUnload(DriverObject); // Call MiniPort _HCI_Unload
}
ULONG
VOID
NTAPI
USBPORT_MiniportCompleteTransfer(IN PVOID MiniPortExtension,
IN PVOID MiniPortEndpoint,
@ -1969,18 +1970,7 @@ USBPORT_MiniportCompleteTransfer(IN PVOID MiniPortExtension,
&Transfer->TransferLink,
&FdoExtension->DoneTransferSpinLock);
return KeInsertQueueDpc(&FdoExtension->TransferFlushDpc, NULL, NULL);
}
ULONG
NTAPI
USBPORT_CompleteIsoTransfer(IN PVOID MiniPortExtension,
IN PVOID MiniPortEndpoint,
IN PVOID TransferParameters,
IN ULONG TransferLength)
{
DPRINT1("USBPORT_CompleteIsoTransfer: UNIMPLEMENTED. FIXME.\n");
return 0;
KeInsertQueueDpc(&FdoExtension->TransferFlushDpc, NULL, NULL);
}
VOID
@ -2309,7 +2299,7 @@ USBPORT_MapTransfer(IN PDEVICE_OBJECT FdoDevice,
do
{
ElementLength = 0x1000 - (PhAddress.LowPart & 0xFFF);
ElementLength = PAGE_SIZE - (PhAddress.LowPart & (PAGE_SIZE - 1));
if (ElementLength > SgCurrentLength)
ElementLength = SgCurrentLength;
@ -2331,9 +2321,9 @@ USBPORT_MapTransfer(IN PDEVICE_OBJECT FdoDevice,
}
while (SgCurrentLength);
if ((PhAddr.LowPart == PhAddress.LowPart) &&
(PhAddr.HighPart == PhAddress.HighPart))
if (PhAddr.QuadPart == PhAddress.QuadPart)
{
DPRINT1("USBPORT_MapTransfer: PhAddr == PhAddress\n");
ASSERT(FALSE);
}

View file

@ -862,6 +862,22 @@ USBPORT_GetSymbolicName(
IN PDEVICE_OBJECT RootHubPdo,
IN PUNICODE_STRING DestinationString);
/* iso.c */
USBD_STATUS
NTAPI
USBPORT_InitializeIsoTransfer(
IN PDEVICE_OBJECT FdoDevice,
IN struct _URB_ISOCH_TRANSFER * Urb,
IN PUSBPORT_TRANSFER Transfer);
ULONG
NTAPI
USBPORT_CompleteIsoTransfer(
IN PVOID MiniPortExtension,
IN PVOID MiniPortEndpoint,
IN PVOID TransferParameters,
IN ULONG TransferLength);
/* pnp.c */
NTSTATUS
NTAPI

View file

@ -43,7 +43,7 @@
typedef struct _USBPORT_RESOURCES {
ULONG ResourcesTypes;
ULONG HcFlavor;
USB_CONTROLLER_FLAVOR HcFlavor;
ULONG InterruptVector;
KIRQL InterruptLevel;
UCHAR Padded1[3];
@ -364,7 +364,7 @@ typedef ULONG
PVOID,
PVOID);
typedef ULONG
typedef VOID
(NTAPI *PUSBPORT_COMPLETE_TRANSFER)(
PVOID,
PVOID,
@ -581,6 +581,8 @@ typedef struct _USBPORT_MINIPORT_INTERFACE {
C_ASSERT(sizeof(USBPORT_MINIPORT_INTERFACE) == 32 + 76 * sizeof(PVOID));
#define USBPORT_TRANSFER_DIRECTION_OUT 1 // From host to device
#define USBPORT_MAX_DEVICE_ADDRESS 127
typedef struct _USBPORT_ENDPOINT_PROPERTIES {
USHORT DeviceAddress;
USHORT EndpointAddress;