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.

194 lines
6.3 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. mpinit.c
  5. Abstract:
  6. miniport initialization
  7. Environment:
  8. kernel mode only
  9. Notes:
  10. THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  11. KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  12. IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  13. PURPOSE.
  14. Copyright (c) 1999 Microsoft Corporation. All Rights Reserved.
  15. Revision History:
  16. 2-19-99 : created, jdunn
  17. --*/
  18. #include "common.h"
  19. // global registration packet for this miniport
  20. USBPORT_REGISTRATION_PACKET RegistrationPacket;
  21. NTSTATUS
  22. DriverEntry(
  23. PDRIVER_OBJECT DriverObject,
  24. PUNICODE_STRING RegistryPath
  25. )
  26. /*++
  27. Routine Description:
  28. Installable driver initialization entry point.
  29. This entry point is called directly by the I/O system.
  30. Arguments:
  31. DriverObject - pointer to the driver object
  32. RegistryPath - pointer to a unicode string representing the path
  33. to driver-specific key in the registry
  34. Return Value:
  35. STATUS_SUCCESS if successful,
  36. STATUS_UNSUCCESSFUL otherwise
  37. --*/
  38. {
  39. RegistrationPacket.DeviceDataSize =
  40. sizeof(DEVICE_DATA);
  41. RegistrationPacket.EndpointDataSize =
  42. sizeof(ENDPOINT_DATA);
  43. RegistrationPacket.TransferContextSize =
  44. sizeof(TRANSFER_CONTEXT);
  45. // enough for HCCA plus
  46. RegistrationPacket.CommonBufferBytes = OHCI_COMMON_BUFFER_SIZE;
  47. /* miniport Functions */
  48. RegistrationPacket.MINIPORT_OpenEndpoint =
  49. OHCI_OpenEndpoint;
  50. RegistrationPacket.MINIPORT_PokeEndpoint =
  51. OHCI_PokeEndpoint;
  52. RegistrationPacket.MINIPORT_QueryEndpointRequirements =
  53. OHCI_QueryEndpointRequirements;
  54. RegistrationPacket.MINIPORT_CloseEndpoint =
  55. OHCI_CloseEndpoint;
  56. RegistrationPacket.MINIPORT_StartController =
  57. OHCI_StartController;
  58. RegistrationPacket.MINIPORT_StopController =
  59. OHCI_StopController;
  60. RegistrationPacket.MINIPORT_SuspendController =
  61. OHCI_SuspendController;
  62. RegistrationPacket.MINIPORT_ResumeController =
  63. OHCI_ResumeController;
  64. RegistrationPacket.MINIPORT_InterruptService =
  65. OHCI_InterruptService;
  66. RegistrationPacket.MINIPORT_InterruptDpc =
  67. OHCI_InterruptDpc;
  68. RegistrationPacket.MINIPORT_SubmitTransfer =
  69. OHCI_SubmitTransfer;
  70. RegistrationPacket.MINIPORT_SubmitIsoTransfer =
  71. OHCI_SubmitIsoTransfer;
  72. RegistrationPacket.MINIPORT_AbortTransfer =
  73. OHCI_AbortTransfer;
  74. RegistrationPacket.MINIPORT_GetEndpointState =
  75. OHCI_GetEndpointState;
  76. RegistrationPacket.MINIPORT_SetEndpointState =
  77. OHCI_SetEndpointState;
  78. RegistrationPacket.MINIPORT_PollEndpoint =
  79. OHCI_PollEndpoint;
  80. RegistrationPacket.MINIPORT_CheckController =
  81. OHCI_CheckController;
  82. RegistrationPacket.MINIPORT_Get32BitFrameNumber =
  83. OHCI_Get32BitFrameNumber;
  84. RegistrationPacket.MINIPORT_InterruptNextSOF =
  85. OHCI_InterruptNextSOF;
  86. RegistrationPacket.MINIPORT_EnableInterrupts =
  87. OHCI_EnableInterrupts;
  88. RegistrationPacket.MINIPORT_DisableInterrupts =
  89. OHCI_DisableInterrupts;
  90. RegistrationPacket.MINIPORT_PollController =
  91. OHCI_PollController;
  92. RegistrationPacket.MINIPORT_SetEndpointDataToggle =
  93. OHCI_SetEndpointDataToggle;
  94. RegistrationPacket.MINIPORT_GetEndpointStatus =
  95. OHCI_GetEndpointStatus;
  96. RegistrationPacket.MINIPORT_SetEndpointStatus =
  97. OHCI_SetEndpointStatus;
  98. RegistrationPacket.MINIPORT_ResetController =
  99. OHCI_ResetController;
  100. RegistrationPacket.MINIPORT_FlushInterrupts =
  101. OHCI_FlushInterrupts;
  102. /* root hub functions */
  103. RegistrationPacket.MINIPORT_RH_GetRootHubData =
  104. OHCI_RH_GetRootHubData;
  105. RegistrationPacket.MINIPORT_RH_GetStatus =
  106. OHCI_RH_GetStatus;
  107. RegistrationPacket.MINIPORT_RH_GetPortStatus =
  108. OHCI_RH_GetPortStatus;
  109. RegistrationPacket.MINIPORT_RH_GetHubStatus =
  110. OHCI_RH_GetHubStatus;
  111. /* root hub port functions */
  112. RegistrationPacket.MINIPORT_RH_SetFeaturePortReset =
  113. OHCI_RH_SetFeaturePortReset;
  114. RegistrationPacket.MINIPORT_RH_SetFeaturePortPower =
  115. OHCI_RH_SetFeaturePortPower;
  116. RegistrationPacket.MINIPORT_RH_SetFeaturePortEnable =
  117. OHCI_RH_SetFeaturePortEnable;
  118. RegistrationPacket.MINIPORT_RH_SetFeaturePortSuspend =
  119. OHCI_RH_SetFeaturePortSuspend;
  120. RegistrationPacket.MINIPORT_RH_ClearFeaturePortEnable =
  121. OHCI_RH_ClearFeaturePortEnable;
  122. RegistrationPacket.MINIPORT_RH_ClearFeaturePortPower =
  123. OHCI_RH_ClearFeaturePortPower;
  124. RegistrationPacket.MINIPORT_RH_ClearFeaturePortSuspend =
  125. OHCI_RH_ClearFeaturePortSuspend;
  126. RegistrationPacket.MINIPORT_RH_ClearFeaturePortEnableChange =
  127. OHCI_RH_ClearFeaturePortEnableChange;
  128. RegistrationPacket.MINIPORT_RH_ClearFeaturePortConnectChange =
  129. OHCI_RH_ClearFeaturePortConnectChange;
  130. RegistrationPacket.MINIPORT_RH_ClearFeaturePortResetChange =
  131. OHCI_RH_ClearFeaturePortResetChange;
  132. RegistrationPacket.MINIPORT_RH_ClearFeaturePortSuspendChange =
  133. OHCI_RH_ClearFeaturePortSuspendChange;
  134. RegistrationPacket.MINIPORT_RH_ClearFeaturePortOvercurrentChange =
  135. OHCI_RH_ClearFeaturePortOvercurrentChange;
  136. /* optional root hub functions */
  137. RegistrationPacket.MINIPORT_RH_DisableIrq =
  138. OHCI_RH_DisableIrq;
  139. RegistrationPacket.MINIPORT_RH_EnableIrq =
  140. OHCI_RH_EnableIrq;
  141. /* OPTIONAL DEBUG SERVICES */
  142. RegistrationPacket.MINIPORT_StartSendOnePacket =
  143. OHCI_StartSendOnePacket;
  144. RegistrationPacket.MINIPORT_EndSendOnePacket =
  145. OHCI_EndSendOnePacket;
  146. // OHCI needs both IRQ and memory resources
  147. RegistrationPacket.OptionFlags =
  148. USB_MINIPORT_OPT_NEED_IRQ |
  149. USB_MINIPORT_OPT_NEED_MEMORY |
  150. USB_MINIPORT_OPT_POLL_IN_SUSPEND |
  151. USB_MINIPORT_OPT_USB11;
  152. RegistrationPacket.HciType = USB_OHCI;
  153. RegistrationPacket.BusBandwidth = USB_11_BUS_BANDWIDTH;
  154. DriverObject->DriverUnload = OHCI_Unload;
  155. return USBPORT_RegisterUSBPortDriver(
  156. DriverObject,
  157. USB_MINIPORT_HCI_VERSION,
  158. &RegistrationPacket);
  159. }