Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenusbdlib.h
Go to the documentation of this file.
00001 #pragma once 00002 00003 #ifndef DECLSPEC_EXPORT 00004 #define DECLSPEC_EXPORT __declspec(dllexport) 00005 #endif 00006 00007 typedef struct _USBD_INTERFACE_LIST_ENTRY { 00008 PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor; 00009 PUSBD_INTERFACE_INFORMATION Interface; 00010 } USBD_INTERFACE_LIST_ENTRY, *PUSBD_INTERFACE_LIST_ENTRY; 00011 00012 #define UsbBuildInterruptOrBulkTransferRequest(urb,length, pipeHandle, transferBuffer, transferBufferMDL, transferBufferLength, transferFlags, link) { \ 00013 (urb)->UrbHeader.Function = URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER; \ 00014 (urb)->UrbHeader.Length = (length); \ 00015 (urb)->UrbBulkOrInterruptTransfer.PipeHandle = (pipeHandle); \ 00016 (urb)->UrbBulkOrInterruptTransfer.TransferBufferLength = (transferBufferLength); \ 00017 (urb)->UrbBulkOrInterruptTransfer.TransferBufferMDL = (transferBufferMDL); \ 00018 (urb)->UrbBulkOrInterruptTransfer.TransferBuffer = (transferBuffer); \ 00019 (urb)->UrbBulkOrInterruptTransfer.TransferFlags = (transferFlags); \ 00020 (urb)->UrbBulkOrInterruptTransfer.UrbLink = (link); \ 00021 } 00022 00023 #define UsbBuildGetDescriptorRequest(urb, length, descriptorType, descriptorIndex, languageId, transferBuffer, transferBufferMDL, transferBufferLength, link) { \ 00024 (urb)->UrbHeader.Function = URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE; \ 00025 (urb)->UrbHeader.Length = (length); \ 00026 (urb)->UrbControlDescriptorRequest.TransferBufferLength = (transferBufferLength); \ 00027 (urb)->UrbControlDescriptorRequest.TransferBufferMDL = (transferBufferMDL); \ 00028 (urb)->UrbControlDescriptorRequest.TransferBuffer = (transferBuffer); \ 00029 (urb)->UrbControlDescriptorRequest.DescriptorType = (descriptorType); \ 00030 (urb)->UrbControlDescriptorRequest.Index = (descriptorIndex); \ 00031 (urb)->UrbControlDescriptorRequest.LanguageId = (languageId); \ 00032 (urb)->UrbControlDescriptorRequest.UrbLink = (link); \ 00033 } 00034 00035 #define UsbBuildGetStatusRequest(urb, op, index, transferBuffer, transferBufferMDL, link) { \ 00036 (urb)->UrbHeader.Function = (op); \ 00037 (urb)->UrbHeader.Length = sizeof(struct _URB_CONTROL_GET_STATUS_REQUEST); \ 00038 (urb)->UrbControlGetStatusRequest.TransferBufferLength = sizeof(USHORT); \ 00039 (urb)->UrbControlGetStatusRequest.TransferBufferMDL = (transferBufferMDL); \ 00040 (urb)->UrbControlGetStatusRequest.TransferBuffer = (transferBuffer); \ 00041 (urb)->UrbControlGetStatusRequest.Index = (index); \ 00042 (urb)->UrbControlGetStatusRequest.UrbLink = (link); \ 00043 } 00044 00045 #define UsbBuildFeatureRequest(urb, op, featureSelector, index, link) { \ 00046 (urb)->UrbHeader.Function = (op); \ 00047 (urb)->UrbHeader.Length = sizeof(struct _URB_CONTROL_FEATURE_REQUEST); \ 00048 (urb)->UrbControlFeatureRequest.FeatureSelector = (featureSelector); \ 00049 (urb)->UrbControlFeatureRequest.Index = (index); \ 00050 (urb)->UrbControlFeatureRequest.UrbLink = (link); \ 00051 } 00052 00053 #define UsbBuildSelectConfigurationRequest(urb, length, configurationDescriptor) { \ 00054 (urb)->UrbHeader.Function = URB_FUNCTION_SELECT_CONFIGURATION; \ 00055 (urb)->UrbHeader.Length = (length); \ 00056 (urb)->UrbSelectConfiguration.ConfigurationDescriptor = (configurationDescriptor); \ 00057 } 00058 00059 #define UsbBuildSelectInterfaceRequest(urb, length, configurationHandle, interfaceNumber, alternateSetting) { \ 00060 (urb)->UrbHeader.Function = URB_FUNCTION_SELECT_INTERFACE; \ 00061 (urb)->UrbHeader.Length = (length); \ 00062 (urb)->UrbSelectInterface.Interface.AlternateSetting = (alternateSetting); \ 00063 (urb)->UrbSelectInterface.Interface.InterfaceNumber = (interfaceNumber); \ 00064 (urb)->UrbSelectInterface.Interface.Length = (length - sizeof(struct _URB_HEADER) - sizeof(USBD_CONFIGURATION_HANDLE)); \ 00065 (urb)->UrbSelectInterface.ConfigurationHandle = (configurationHandle); \ 00066 } 00067 00068 #define UsbBuildVendorRequest(urb, cmd, length, transferFlags, reservedbits, request, value, index, transferBuffer, transferBufferMDL, transferBufferLength, link) { \ 00069 (urb)->UrbHeader.Function = cmd; \ 00070 (urb)->UrbHeader.Length = (length); \ 00071 (urb)->UrbControlVendorClassRequest.TransferBufferLength = (transferBufferLength); \ 00072 (urb)->UrbControlVendorClassRequest.TransferBufferMDL = (transferBufferMDL); \ 00073 (urb)->UrbControlVendorClassRequest.TransferBuffer = (transferBuffer); \ 00074 (urb)->UrbControlVendorClassRequest.RequestTypeReservedBits = (reservedbits); \ 00075 (urb)->UrbControlVendorClassRequest.Request = (request); \ 00076 (urb)->UrbControlVendorClassRequest.Value = (value); \ 00077 (urb)->UrbControlVendorClassRequest.Index = (index); \ 00078 (urb)->UrbControlVendorClassRequest.TransferFlags = (transferFlags); \ 00079 (urb)->UrbControlVendorClassRequest.UrbLink = (link); \ 00080 } 00081 00082 #if (NTDDI_VERSION >= NTDDI_WINXP) 00083 00084 #define UsbBuildOsFeatureDescriptorRequest(urb, length, interface, index, transferBuffer, transferBufferMDL, transferBufferLength, link) { \ 00085 (urb)->UrbHeader.Function = URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR; \ 00086 (urb)->UrbHeader.Length = (length); \ 00087 (urb)->UrbOSFeatureDescriptorRequest.TransferBufferLength = (transferBufferLength); \ 00088 (urb)->UrbOSFeatureDescriptorRequest.TransferBufferMDL = (transferBufferMDL); \ 00089 (urb)->UrbOSFeatureDescriptorRequest.TransferBuffer = (transferBuffer); \ 00090 (urb)->UrbOSFeatureDescriptorRequest.InterfaceNumber = (interface); \ 00091 (urb)->UrbOSFeatureDescriptorRequest.MS_FeatureDescriptorIndex = (index); \ 00092 urb)->UrbOSFeatureDescriptorRequest.UrbLink = (link); \ 00093 } 00094 00095 #endif /* NTDDI_VERSION >= NTDDI_WINXP */ 00096 00097 #define URB_STATUS(urb) ((urb)->UrbHeader.Status) 00098 00099 #define GET_SELECT_CONFIGURATION_REQUEST_SIZE(totalInterfaces, totalPipes) \ 00100 (sizeof(struct _URB_SELECT_CONFIGURATION) + \ 00101 ((totalInterfaces-1) * sizeof(USBD_INTERFACE_INFORMATION)) + \ 00102 ((totalPipes-totalInterfaces)*sizeof(USBD_PIPE_INFORMATION))) 00103 00104 #define GET_SELECT_INTERFACE_REQUEST_SIZE(totalPipes) \ 00105 (sizeof(struct _URB_SELECT_INTERFACE) + \ 00106 ((totalPipes-1)*sizeof(USBD_PIPE_INFORMATION))) 00107 00108 #define GET_USBD_INTERFACE_SIZE(numEndpoints) \ 00109 (sizeof(USBD_INTERFACE_INFORMATION) + \ 00110 (sizeof(USBD_PIPE_INFORMATION)*(numEndpoints)) - sizeof(USBD_PIPE_INFORMATION)) 00111 00112 #define GET_ISO_URB_SIZE(n) (sizeof(struct _URB_ISOCH_TRANSFER)+ \ 00113 sizeof(USBD_ISO_PACKET_DESCRIPTOR)*n) 00114 00115 #ifndef _USBD_ 00116 00117 _IRQL_requires_max_(DISPATCH_LEVEL) 00118 DECLSPEC_IMPORT 00119 VOID 00120 NTAPI 00121 USBD_GetUSBDIVersion( 00122 _Out_ PUSBD_VERSION_INFORMATION VersionInformation); 00123 00124 DECLSPEC_IMPORT 00125 PUSB_INTERFACE_DESCRIPTOR 00126 NTAPI 00127 USBD_ParseConfigurationDescriptor( 00128 _In_ PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, 00129 _In_ UCHAR InterfaceNumber, 00130 _In_ UCHAR AlternateSetting); 00131 00132 DECLSPEC_IMPORT 00133 PURB 00134 NTAPI 00135 USBD_CreateConfigurationRequest( 00136 _In_ PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, 00137 _Out_ PUSHORT Siz); 00138 00139 _IRQL_requires_max_(APC_LEVEL) 00140 DECLSPEC_IMPORT 00141 PUSB_COMMON_DESCRIPTOR 00142 NTAPI 00143 USBD_ParseDescriptors( 00144 _In_ PVOID DescriptorBuffer, 00145 _In_ ULONG TotalLength, 00146 _In_ PVOID StartPosition, 00147 _In_ LONG DescriptorType); 00148 00149 _IRQL_requires_max_(APC_LEVEL) 00150 DECLSPEC_IMPORT 00151 PUSB_INTERFACE_DESCRIPTOR 00152 NTAPI 00153 USBD_ParseConfigurationDescriptorEx( 00154 _In_ PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, 00155 _In_ PVOID StartPosition, 00156 _In_ LONG InterfaceNumber, 00157 _In_ LONG AlternateSetting, 00158 _In_ LONG InterfaceClass, 00159 _In_ LONG InterfaceSubClass, 00160 _In_ LONG InterfaceProtocol); 00161 00162 _IRQL_requires_max_(DISPATCH_LEVEL) 00163 DECLSPEC_IMPORT 00164 PURB 00165 NTAPI 00166 USBD_CreateConfigurationRequestEx( 00167 _In_ PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, 00168 _In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceList); 00169 00170 _IRQL_requires_max_(PASSIVE_LEVEL) 00171 DECLSPEC_EXPORT 00172 ULONG 00173 NTAPI 00174 USBD_GetInterfaceLength( 00175 _In_ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor, 00176 _In_ PUCHAR BufferEnd); 00177 00178 _IRQL_requires_max_(PASSIVE_LEVEL) 00179 DECLSPEC_EXPORT 00180 VOID 00181 NTAPI 00182 USBD_RegisterHcFilter( 00183 _In_ PDEVICE_OBJECT DeviceObject, 00184 _In_ PDEVICE_OBJECT FilterDeviceObject); 00185 00186 _IRQL_requires_max_(APC_LEVEL) 00187 DECLSPEC_EXPORT 00188 NTSTATUS 00189 NTAPI 00190 USBD_GetPdoRegistryParameter( 00191 _In_ PDEVICE_OBJECT PhysicalDeviceObject, 00192 _Inout_updates_bytes_(ParameterLength) PVOID Parameter, 00193 _In_ ULONG ParameterLength, 00194 _In_reads_bytes_(KeyNameLength) PWSTR KeyName, 00195 _In_ ULONG KeyNameLength); 00196 00197 DECLSPEC_EXPORT 00198 NTSTATUS 00199 NTAPI 00200 USBD_QueryBusTime( 00201 _In_ PDEVICE_OBJECT RootHubPdo, 00202 _Out_ PULONG CurrentFrame); 00203 00204 #if (NTDDI_VERSION >= NTDDI_WINXP) 00205 00206 _IRQL_requires_max_(DISPATCH_LEVEL) 00207 DECLSPEC_IMPORT 00208 ULONG 00209 NTAPI 00210 USBD_CalculateUsbBandwidth( 00211 _In_ ULONG MaxPacketSize, 00212 _In_ UCHAR EndpointType, 00213 _In_ BOOLEAN LowSpeed); 00214 00215 #endif 00216 00217 #if (NTDDI_VERSION >= NTDDI_VISTA) 00218 00219 _IRQL_requires_max_(DISPATCH_LEVEL) 00220 DECLSPEC_IMPORT 00221 USBD_STATUS 00222 NTAPI 00223 USBD_ValidateConfigurationDescriptor( 00224 _In_reads_bytes_(BufferLength) PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc, 00225 _In_ ULONG BufferLength, 00226 _In_ USHORT Level, 00227 _Out_ PUCHAR *Offset, 00228 _In_opt_ ULONG Tag); 00229 00230 #endif 00231 00232 #endif /* ! _USBD_ */ 00233 Generated on Sat May 26 2012 04:28:58 for ReactOS by
1.7.6.1
|