ReactOS 0.4.17-dev-1281-g065abb3
pipe.cpp File Reference
#include "ucx01000.h"
#include <debug.h>
Include dependency graph for pipe.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define UCX_KB(x)   ((x) * 1024UL)
 
#define UCX_MB(x)   ((x) * 1024UL * 1024UL)
 

Functions

static ULONG NTAPI UcxSpeedRow (_In_ USB_DEVICE_SPEED Speed)
 
static BOOLEAN NTAPI UcxIsSlowSpeed (_In_ USB_DEVICE_SPEED Speed)
 
ULONG NTAPI UcxComputeMaxTransferSize (_In_ USB_DEVICE_SPEED Speed, _In_ USHORT BcdUsb, _In_ const UcxEndpointInit *Init)
 
static VOID NTAPI UcxUntrackEndpoint (_In_ UcxEndpoint *Endpoint)
 

Variables

static const ULONG UcxMaxTransferTable [4][5]
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file pipe.cpp.

◆ UCX_KB

#define UCX_KB (   x)    ((x) * 1024UL)

Definition at line 15 of file pipe.cpp.

◆ UCX_MB

#define UCX_MB (   x)    ((x) * 1024UL * 1024UL)

Definition at line 16 of file pipe.cpp.

Function Documentation

◆ UcxComputeMaxTransferSize()

ULONG NTAPI UcxComputeMaxTransferSize ( _In_ USB_DEVICE_SPEED  Speed,
_In_ USHORT  BcdUsb,
_In_ const UcxEndpointInit *  Init 
)

Definition at line 49 of file pipe.cpp.

53{
54 ULONG Row = UcxSpeedRow(Speed);
55 USHORT MaxPacket;
56 ULONG PacketBytes;
57
58 if (Init->TransferType != UcxTransferType::Isochronous)
59 {
60 if (Init->TransferType == UcxTransferType::Control &&
61 UcxIsSlowSpeed(Speed) &&
62 UcxDriver.Allow64KLowOrFullSpeedControl)
63 {
64 return UCX_KB(64);
65 }
66
67 return UcxMaxTransferTable[Row][(ULONG)Init->TransferType];
68 }
69
70 if (Row == (ULONG)UsbSuperSpeed)
71 {
72 if (Init->Companion.bmAttributes.Isochronous.SspCompanion)
73 return 1024 * Init->IsochCompanion.dwBytesPerInterval;
74
75 return 1024 * Init->Companion.wBytesPerInterval;
76 }
77
78 /* Before USB 2.5 the top bits carry the additional transactions per microframe */
79 MaxPacket = Init->Descriptor.wMaxPacketSize;
80 if (BcdUsb < 0x0250)
81 PacketBytes = (MaxPacket & 0x7FF) * (((MaxPacket >> 11) & 0x3) + 1);
82 else
83 PacketBytes = MaxPacket;
84
85 return ((Row == (ULONG)UsbHighSpeed) ? 1024 : 256) * PacketBytes;
86}
InitializeListHead & UcxDriver
Definition: driver.cpp:138
#define UCX_KB(x)
Definition: pipe.cpp:15
static const ULONG UcxMaxTransferTable[4][5]
Definition: pipe.cpp:19
static ULONG NTAPI UcxSpeedRow(_In_ USB_DEVICE_SPEED Speed)
Definition: pipe.cpp:32
static BOOLEAN NTAPI UcxIsSlowSpeed(_In_ USB_DEVICE_SPEED Speed)
Definition: pipe.cpp:41
unsigned short USHORT
Definition: pedump.c:61
uint32_t ULONG
Definition: typedefs.h:59
@ UsbSuperSpeed
Definition: usb200.h:45
@ UsbHighSpeed
Definition: usb200.h:44

Referenced by UcxEndpoint::Initialize().

◆ UcxIsSlowSpeed()

static BOOLEAN NTAPI UcxIsSlowSpeed ( _In_ USB_DEVICE_SPEED  Speed)
static

Definition at line 41 of file pipe.cpp.

43{
44 return Speed == UsbLowSpeed || Speed == UsbFullSpeed;
45}
@ UsbLowSpeed
Definition: usb200.h:42
@ UsbFullSpeed
Definition: usb200.h:43

Referenced by UcxEndpoint::Initialize(), and UcxComputeMaxTransferSize().

◆ UcxSpeedRow()

static ULONG NTAPI UcxSpeedRow ( _In_ USB_DEVICE_SPEED  Speed)
static

Definition at line 32 of file pipe.cpp.

34{
35 return ((ULONG)Speed > (ULONG)UsbSuperSpeed) ? (ULONG)UsbSuperSpeed : (ULONG)Speed;
36}

Referenced by UcxComputeMaxTransferSize().

◆ UcxUntrackEndpoint()

static VOID NTAPI UcxUntrackEndpoint ( _In_ UcxEndpoint *  Endpoint)
static

Takes the endpoint out of the strict pipe handle list, if it is on it.

Definition at line 825 of file pipe.cpp.

827{
828 UcxUsbDevice* Device = Endpoint->m_Device;
829
830 if (!Device->m_StalePipeIoAllowed)
831 return;
832
833 SpinLockGuard Guard(&Device->m_TrackingLock);
834
835 if (UcxIsListEntryLinked(&Endpoint->m_TrackingLink))
836 {
837 RemoveEntryList(&Endpoint->m_TrackingLink);
838 UcxClearListEntry(&Endpoint->m_TrackingLink);
839 }
840}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
_In_ UCXHUB_DEVICE_CONTEXT _In_ UCXENDPOINT Endpoint
Definition: hubucx.h:238
FORCEINLINE BOOLEAN NTAPI UcxIsListEntryLinked(_In_ const LIST_ENTRY *Entry)
Definition: ucxutil.h:94
FORCEINLINE VOID NTAPI UcxClearListEntry(_Out_ PLIST_ENTRY Entry)
Definition: ucxutil.h:84

Referenced by EndpointMachine::DeleteEndpoint(), and EndpointMachine::ParkAsStale().

Variable Documentation

◆ UcxMaxTransferTable

const ULONG UcxMaxTransferTable[4][5]
static
Initial value:
=
{
{ 0, UCX_KB(4), UCX_MB(4), 0, UCX_MB(4) },
{ 0, UCX_KB(4), UCX_MB(4), 0, UCX_MB(4) },
{ 0, UCX_KB(64), UCX_MB(4), 0, UCX_MB(4) },
{ 0, UCX_KB(64), UCX_MB(32), 0, UCX_MB(4) }
}
#define UCX_MB(x)
Definition: pipe.cpp:16

Definition at line 19 of file pipe.cpp.

Referenced by UcxComputeMaxTransferSize().