Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

242 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. isousb.h
  5. Abstract:
  6. Environment:
  7. Kernel mode
  8. Notes:
  9. Copyright (c) 2000 Microsoft Corporation.
  10. All Rights Reserved.
  11. --*/
  12. #include <initguid.h>
  13. #include <wdm.h>
  14. #include <wdmguid.h>
  15. #include <wmistr.h>
  16. #include <wmilib.h>
  17. #include "usbdi.h"
  18. #include "usbdlib.h"
  19. #include "usbbusif.h"
  20. #ifndef _ISOUSB_H
  21. #define _ISOUSB_H
  22. #define ISOTAG (ULONG) 'OsI'
  23. #undef ExAllocatePool
  24. #define ExAllocatePool(type, size) \
  25. ExAllocatePoolWithTag(type, size, ISOTAG);
  26. #if DBG
  27. #define IsoUsb_DbgPrint(level, _x_) \
  28. if((level) <= DebugLevel) { \
  29. DbgPrint _x_; \
  30. }
  31. #else
  32. #define IsoUsb_DbgPrint(level, _x_)
  33. #endif
  34. typedef struct _GLOBALS {
  35. UNICODE_STRING IsoUsb_RegistryPath;
  36. } GLOBALS;
  37. #define IDLE_INTERVAL 5000
  38. typedef enum _DEVSTATE {
  39. NotStarted, // not started
  40. Stopped, // device stopped
  41. Working, // started and working
  42. PendingStop, // stop pending
  43. PendingRemove, // remove pending
  44. SurpriseRemoved, // removed by surprise
  45. Removed // removed
  46. } DEVSTATE;
  47. typedef enum _QUEUE_STATE {
  48. HoldRequests, // device is not started yet
  49. AllowRequests, // device is ready to process
  50. FailRequests // fail both existing and queued up requests
  51. } QUEUE_STATE;
  52. typedef enum _WDM_VERSION {
  53. WinXpOrBetter,
  54. Win2kOrBetter,
  55. WinMeOrBetter,
  56. Win98OrBetter
  57. } WDM_VERSION;
  58. #define INITIALIZE_PNP_STATE(_Data_) \
  59. (_Data_)->DeviceState = NotStarted;\
  60. (_Data_)->PrevDevState = NotStarted;
  61. #define SET_NEW_PNP_STATE(_Data_, _state_) \
  62. (_Data_)->PrevDevState = (_Data_)->DeviceState;\
  63. (_Data_)->DeviceState = (_state_);
  64. #define RESTORE_PREVIOUS_PNP_STATE(_Data_) \
  65. (_Data_)->DeviceState = (_Data_)->PrevDevState;
  66. #define ISOUSB_MAX_TRANSFER_SIZE 256
  67. #define ISOUSB_TEST_BOARD_TRANSFER_BUFFER_SIZE (64 * 1024)
  68. //
  69. // registry path used for parameters
  70. // global to all instances of the driver
  71. //
  72. #define ISOUSB_REGISTRY_PARAMETERS_PATH \
  73. L"\\REGISTRY\\Machine\\System\\CurrentControlSet\\SERVICES\\ISOUSB\\Parameters"
  74. //
  75. // A structure representing the instance information associated with
  76. // this particular device.
  77. //
  78. typedef struct _DEVICE_EXTENSION {
  79. // Functional Device Object
  80. PDEVICE_OBJECT FunctionalDeviceObject;
  81. // Device object we call when submitting Urbs
  82. PDEVICE_OBJECT TopOfStackDeviceObject;
  83. // The bus driver object
  84. PDEVICE_OBJECT PhysicalDeviceObject;
  85. // Name buffer for our named Functional device object link
  86. // The name is generated based on the driver's class GUID
  87. UNICODE_STRING InterfaceName;
  88. // Bus drivers set the appropriate values in this structure in response
  89. // to an IRP_MN_QUERY_CAPABILITIES IRP. Function and filter drivers might
  90. // alter the capabilities set by the bus driver.
  91. DEVICE_CAPABILITIES DeviceCapabilities;
  92. // Configuration Descriptor
  93. PUSB_CONFIGURATION_DESCRIPTOR UsbConfigurationDescriptor;
  94. // Interface Information structure
  95. PUSBD_INTERFACE_INFORMATION UsbInterface;
  96. // current state of device
  97. DEVSTATE DeviceState;
  98. // state prior to removal query
  99. DEVSTATE PrevDevState;
  100. // obtain and hold this lock while changing the device state,
  101. // the queue state and while processing the queue.
  102. KSPIN_LOCK DevStateLock;
  103. // current system power state
  104. SYSTEM_POWER_STATE SysPower;
  105. // current device power state
  106. DEVICE_POWER_STATE DevPower;
  107. // Pending I/O queue state
  108. QUEUE_STATE QueueState;
  109. // Pending I/O queue
  110. LIST_ENTRY NewRequestsQueue;
  111. // I/O Queue Lock
  112. KSPIN_LOCK QueueLock;
  113. KEVENT RemoveEvent;
  114. KEVENT StopEvent;
  115. ULONG OutStandingIO;
  116. KSPIN_LOCK IOCountLock;
  117. // selective suspend variables
  118. LONG SSEnable;
  119. LONG SSRegistryEnable;
  120. PUSB_IDLE_CALLBACK_INFO IdleCallbackInfo;
  121. PIRP PendingIdleIrp;
  122. LONG IdleReqPend;
  123. LONG FreeIdleIrpCount;
  124. KSPIN_LOCK IdleReqStateLock;
  125. KEVENT NoIdleReqPendEvent;
  126. // default power state to power down to on self-susped
  127. ULONG PowerDownLevel;
  128. // remote wakeup variables
  129. PIRP WaitWakeIrp;
  130. LONG FlagWWCancel;
  131. LONG FlagWWOutstanding;
  132. LONG WaitWakeEnable;
  133. // open handle count
  134. LONG OpenHandleCount;
  135. // selective suspend model uses timers, dpcs and work item.
  136. KTIMER Timer;
  137. KDPC DeferredProcCall;
  138. // This event is cleared when a DPC/Work Item is queued.
  139. // and signaled when the work-item completes.
  140. // This is essential to prevent the driver from unloading
  141. // while we have DPC or work-item queued up.
  142. KEVENT NoDpcWorkItemPendingEvent;
  143. // WMI information
  144. WMILIB_CONTEXT WmiLibInfo;
  145. // WDM version
  146. WDM_VERSION WdmVersion;
  147. // High speed
  148. ULONG IsDeviceHighSpeed;
  149. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  150. typedef struct _IRP_COMPLETION_CONTEXT {
  151. PDEVICE_EXTENSION DeviceExtension;
  152. PKEVENT Event;
  153. } IRP_COMPLETION_CONTEXT, *PIRP_COMPLETION_CONTEXT;
  154. extern ULONG DebugLevel;
  155. extern GLOBALS Globals;
  156. #endif