30 DPRINT(
"USBPORT_MakeSplitTransfer: ... \n");
32 SplitSgList = &SplitTransfer->SgList;
37 if (SgLength > MaxTransferSize)
40 SplitTransfer->SgList.SgElementCount = 1;
46 SplitTransfer->TransferParameters.IsTransferSplited =
TRUE;
47 SplitTransfer->TransferParameters.TransferBufferLength = MaxTransferSize;
49 SplitTransfer->SgList.CurrentVa = Transfer->SgList.CurrentVa +
TransferOffset;
54 *SgOffset += MaxTransferSize;
55 TransferRemainLen -= MaxTransferSize;
56 return TransferRemainLen;
60 SplitTransfer->SgList.SgElementCount = 1;
61 TransferRemainLen -= SgLength;
67 SplitTransfer->TransferParameters.TransferBufferLength = SgLength;
68 SplitTransfer->TransferParameters.IsTransferSplited =
TRUE;
70 SplitTransfer->SgList.CurrentVa = Transfer->SgList.CurrentVa +
TransferOffset;
75 *SgOffset += SgLength;
77 SgRemainLen = MaxTransferSize - SgLength;
79 if (SgRemainLen > TransferRemainLen)
81 SgRemainLen = TransferRemainLen;
89 return TransferRemainLen;
94 DPRINT1(
"MakeSplitTransfer: SgRemainLen - %x\n", SgRemainLen);
95 DPRINT1(
"MakeSplitTransfer: SgIdx - %x\n", *SgIdx);
99 SplitTransfer->SgList.SgElementCount++;
107 SplitTransfer->TransferParameters.TransferBufferLength += SgRemainLen;
109 *SgOffset += SgRemainLen;
110 TransferRemainLen -= SgRemainLen;
112 return TransferRemainLen;
125 SIZE_T TransferBufferLength;
133 DPRINT(
"USBPORT_SplitBulkInterruptTransfer: ... \n");
135 MaxTransferSize = Endpoint->EndpointProperties.TotalMaxPacketSize *
136 (Endpoint->EndpointProperties.MaxTransferSize /
137 Endpoint->EndpointProperties.TotalMaxPacketSize);
139 if (Endpoint->EndpointProperties.MaxTransferSize >
PAGE_SIZE)
144 TransferBufferLength = Transfer->TransferParameters.TransferBufferLength;
147 NeedSplits = TransferBufferLength / MaxTransferSize + 1;
151 DPRINT(
"USBPORT_SplitBulkInterruptTransfer: TransferBufferLength - %x, NeedSplits - %x\n",
152 TransferBufferLength, NeedSplits);
156 DPRINT1(
"USBPORT_SplitBulkInterruptTransfer: DbgBreakPoint \n");
161 for (ix = 0; ix < NeedSplits; ++ix)
164 Transfer->FullTransferLength,
169 DPRINT1(
"USBPORT_SplitBulkInterruptTransfer: DbgBreakPoint \n");
182 if (Transfer->TransferParameters.TransferBufferLength == 0)
187 RemainLength = Transfer->TransferParameters.TransferBufferLength;
211 while (RemainLength != 0);
217 DPRINT(
"USBPORT_SplitBulkInterruptTransfer: ... \n");
239 DPRINT(
"USBPORT_SplitTransfer ... \n");
246 if (Transfer->TransferParameters.TransferBufferLength >
247 Endpoint->EndpointProperties.MaxTransferSize)
249 TransferType = Endpoint->EndpointProperties.TransferType;
266 DPRINT1(
"USBPORT_SplitTransfer: Unknown TransferType - %x\n",
283 DPRINT(
"USBPORT_DoneSplitTransfer: ... \n");
290 DPRINT1(
"USBPORT_DoneSplitTransfer: SplitTransfer->USBDStatus - %X\n",
291 SplitTransfer->USBDStatus);
293 ParentTransfer->
USBDStatus = SplitTransfer->USBDStatus;
320 DPRINT(
"USBPORT_CancelSplitTransfer \n");
322 Endpoint = SplitTransfer->Endpoint;
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define IsListEmpty(ListHead)
#define KeReleaseSpinLock(sl, irql)
#define KeAcquireSpinLock(sl, irql)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
NTSYSAPI void WINAPI DbgBreakPoint(void)
#define ExFreePoolWithTag(_P, _T)
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
struct _LIST_ENTRY * Flink
PHYSICAL_ADDRESS SgPhysicalAddress
USBPORT_SCATTER_GATHER_ELEMENT SgElement[2]
ULONG TransferBufferLength
SIZE_T PortTransferLength
ULONG CompletedTransferLen
KSPIN_LOCK TransferSpinLock
struct _USBPORT_TRANSFER * ParentTransfer
LIST_ENTRY SplitTransfersList
USBPORT_TRANSFER_PARAMETERS TransferParameters
SIZE_T FullTransferLength
VOID NTAPI USBPORT_DoneSplitTransfer(IN PUSBPORT_TRANSFER SplitTransfer)
VOID NTAPI USBPORT_CancelSplitTransfer(IN PUSBPORT_TRANSFER SplitTransfer)
VOID NTAPI USBPORT_SplitBulkInterruptTransfer(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint, IN PUSBPORT_TRANSFER Transfer, IN PLIST_ENTRY List)
VOID NTAPI USBPORT_SplitTransfer(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint, IN PUSBPORT_TRANSFER Transfer, IN PLIST_ENTRY List)
ULONG NTAPI USBPORT_MakeSplitTransfer(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_TRANSFER Transfer, IN PUSBPORT_TRANSFER SplitTransfer, IN ULONG MaxTransferSize, IN PULONG SgIdx, IN PULONG SgOffset, IN ULONG TransferRemainLen, IN ULONG TransferOffset)
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
#define USBD_STATUS_SUCCESS
#define USBPORT_TRANSFER_TYPE_INTERRUPT
#define USBPORT_TRANSFER_TYPE_ISOCHRONOUS
#define USBPORT_TRANSFER_TYPE_CONTROL
#define USBPORT_TRANSFER_TYPE_BULK
VOID NTAPI USBPORT_DoneTransfer(IN PUSBPORT_TRANSFER Transfer)
#define TRANSFER_FLAG_PARENT
#define TRANSFER_FLAG_SPLITED
_Must_inspect_result_ _In_ WDFCMRESLIST List
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ WDFREQUEST _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ WDFMEMORY _In_opt_ PWDFMEMORY_OFFSET TransferOffset
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql