]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
modify coding style to pass ecc tool and provide comments that complied with Doxgen.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbBus.c
index f2b7f8bd9391d4da3b5b500311028119098beabb..13038fa8af163c9a3f372e79f75721844a03c677 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+    Usb Bus Driver Binding and Bus IO Protocol.\r
+\r
 Copyright (c) 2004 - 2007, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-  Module Name:\r
-\r
-    UsbBus.c\r
-\r
-  Abstract:\r
-\r
-    Usb Bus Driver Binding and Bus IO Protocol\r
-\r
-  Revision History\r
-\r
-\r
 **/\r
 \r
 #include "UsbBus.h"\r
@@ -49,7 +40,6 @@ EFI_GUID  mUsbBusProtocolGuid = EFI_USB_BUS_PROTOCOL_GUID;
   @retval Others                 Failed to execute the transfer\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoControlTransfer (\r
@@ -191,22 +181,21 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Execute a bulk transfer to the device endpoint\r
+  Execute a bulk transfer to the device endpoint.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  Endpoint               The device endpoint\r
-  @param  Data                   The data to transfer\r
-  @param  DataLength             The length of the data to transfer\r
-  @param  Timeout                Time to wait before timeout\r
-  @param  UsbStatus              The result of USB transfer\r
+  @param  This                   The USB IO instance.\r
+  @param  Endpoint               The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of the data to transfer.\r
+  @param  Timeout                Time to wait before timeout.\r
+  @param  UsbStatus              The result of USB transfer.\r
 \r
-  @retval EFI_SUCCESS            The bulk transfer is OK\r
-  @retval EFI_INVALID_PARAMETER  Some parameters are invalid\r
+  @retval EFI_SUCCESS            The bulk transfer is OK.\r
+  @retval EFI_INVALID_PARAMETER  Some parameters are invalid.\r
   @retval Others                 Failed to execute transfer, reason returned in\r
-                                 UsbStatus\r
+                                 UsbStatus.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoBulkTransfer (\r
@@ -286,22 +275,21 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Execute a synchronous interrupt transfer\r
+  Execute a synchronous interrupt transfer.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  Endpoint               The device endpoint\r
-  @param  Data                   The data to transfer\r
-  @param  DataLength             The length of the data to transfer\r
-  @param  Timeout                Time to wait before timeout\r
-  @param  UsbStatus              The result of USB transfer\r
+  @param  This                   The USB IO instance.\r
+  @param  Endpoint               The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of the data to transfer.\r
+  @param  Timeout                Time to wait before timeout.\r
+  @param  UsbStatus              The result of USB transfer.\r
 \r
-  @retval EFI_SUCCESS            The synchronous interrupt transfer is OK\r
-  @retval EFI_INVALID_PARAMETER  Some parameters are invalid\r
+  @retval EFI_SUCCESS            The synchronous interrupt transfer is OK.\r
+  @retval EFI_INVALID_PARAMETER  Some parameters are invalid.\r
   @retval Others                 Failed to execute transfer, reason returned in\r
-                                 UsbStatus\r
+                                 UsbStatus.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoSyncInterruptTransfer (\r
@@ -363,25 +351,24 @@ ON_EXIT:
 \r
 /**\r
   Queue a new asynchronous interrupt transfer, or remove the old\r
-  request if (IsNewTransfer == FALSE)\r
+  request if (IsNewTransfer == FALSE).\r
 \r
-  @param  This                   The USB_IO instance\r
-  @param  Endpoint               The device endpoint\r
+  @param  This                   The USB_IO instance.\r
+  @param  Endpoint               The device endpoint.\r
   @param  IsNewTransfer          Whether this is a new request, if it's old, remove\r
-                                 the request\r
-  @param  PollInterval           The interval to poll the transfer result, (in ms)\r
-  @param  DataLength             The length of perodic data transfer\r
+                                 the request.\r
+  @param  PollInterval           The interval to poll the transfer result, (in ms).\r
+  @param  DataLength             The length of perodic data transfer.\r
   @param  Callback               The function to call periodicaly when transfer is\r
-                                 ready\r
-  @param  Context                The context to the callback\r
+                                 ready.\r
+  @param  Context                The context to the callback.\r
 \r
-  @retval EFI_SUCCESS            New transfer is queued or old request is removed\r
-  @retval EFI_INVALID_PARAMETER  Some parameters are invalid\r
+  @retval EFI_SUCCESS            New transfer is queued or old request is removed.\r
+  @retval EFI_INVALID_PARAMETER  Some parameters are invalid.\r
   @retval Others                 Failed to queue the new request or remove the old\r
-                                 request\r
+                                 request.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoAsyncInterruptTransfer (\r
@@ -441,18 +428,17 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Execute a synchronous isochronous transfer\r
+  Execute a synchronous isochronous transfer.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  DeviceEndpoint         The device endpoint\r
-  @param  Data                   The data to transfer\r
-  @param  DataLength             The length of the data to transfer\r
-  @param  UsbStatus              The result of USB transfer\r
+  @param  This                   The USB IO instance.\r
+  @param  DeviceEndpoint         The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of the data to transfer.\r
+  @param  UsbStatus              The result of USB transfer.\r
 \r
-  @retval EFI_UNSUPPORTED        Currently isochronous transfer isn't supported\r
+  @retval EFI_UNSUPPORTED        Currently isochronous transfer isn't supported.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoIsochronousTransfer (\r
@@ -468,19 +454,19 @@ UsbIoIsochronousTransfer (
 \r
 \r
 /**\r
-  Queue an asynchronous isochronous transfer\r
+  Queue an asynchronous isochronous transfer.\r
 \r
-  @param  This                   The USB_IO instance\r
-  @param  DeviceEndpoint         The device endpoint\r
-  @param  DataLength             The length of perodic data transfer\r
+  @param  This                   The USB_IO instance.\r
+  @param  DeviceEndpoint         The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of perodic data transfer.\r
   @param  IsochronousCallBack    The function to call periodicaly when transfer is\r
-                                 ready\r
-  @param  Context                The context to the callback\r
+                                 ready.\r
+  @param  Context                The context to the callback.\r
 \r
-  @retval EFI_UNSUPPORTED        Currently isochronous transfer isn't supported\r
+  @retval EFI_UNSUPPORTED        Currently isochronous transfer isn't supported.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoAsyncIsochronousTransfer (\r
@@ -497,16 +483,15 @@ UsbIoAsyncIsochronousTransfer (
 \r
 \r
 /**\r
-  Retrieve the device descriptor of the device\r
+  Retrieve the device descriptor of the device.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  Descriptor             The variable to receive the device descriptor\r
+  @param  This                   The USB IO instance.\r
+  @param  Descriptor             The variable to receive the device descriptor.\r
 \r
-  @retval EFI_SUCCESS            The device descriptor is returned\r
-  @retval EFI_INVALID_PARAMETER  The parameter is invalid\r
+  @retval EFI_SUCCESS            The device descriptor is returned.\r
+  @retval EFI_INVALID_PARAMETER  The parameter is invalid.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetDeviceDescriptor (\r
@@ -535,17 +520,16 @@ UsbIoGetDeviceDescriptor (
 \r
 \r
 /**\r
-  Return the configuration descriptor of the current active configuration\r
+  Return the configuration descriptor of the current active configuration.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  Descriptor             The USB configuration descriptor\r
+  @param  This                   The USB IO instance.\r
+  @param  Descriptor             The USB configuration descriptor.\r
 \r
-  @retval EFI_SUCCESS            The active configuration descriptor is returned\r
-  @retval EFI_INVALID_PARAMETER  Some parameter is invalid\r
+  @retval EFI_SUCCESS            The active configuration descriptor is returned.\r
+  @retval EFI_INVALID_PARAMETER  Some parameter is invalid.\r
   @retval EFI_NOT_FOUND          Currently no active configuration is selected.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetActiveConfigDescriptor (\r
@@ -582,16 +566,15 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Retrieve the active interface setting descriptor for this USB IO instance\r
+  Retrieve the active interface setting descriptor for this USB IO instance.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  Descriptor             The variable to receive active interface setting\r
+  @param  This                   The USB IO instance.\r
+  @param  Descriptor             The variable to receive active interface setting.\r
 \r
-  @retval EFI_SUCCESS            The active interface setting is returned\r
-  @retval EFI_INVALID_PARAMETER  Some parameter is invalid\r
+  @retval EFI_SUCCESS            The active interface setting is returned.\r
+  @retval EFI_INVALID_PARAMETER  Some parameter is invalid.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetInterfaceDescriptor (\r
@@ -617,18 +600,17 @@ UsbIoGetInterfaceDescriptor (
 \r
 \r
 /**\r
-  Retrieve the endpoint descriptor from this interface setting\r
+  Retrieve the endpoint descriptor from this interface setting.\r
 \r
-  @param  This                   The USB IO instance\r
+  @param  This                   The USB IO instance.\r
   @param  Index                  The index (start from zero) of the endpoint to\r
-                                 retrieve\r
-  @param  Descriptor             The variable to receive the descriptor\r
+                                 retrieve.\r
+  @param  Descriptor             The variable to receive the descriptor.\r
 \r
-  @retval EFI_SUCCESS            The endpoint descriptor is returned\r
-  @retval EFI_INVALID_PARAMETER  Some parameter is invalid\r
+  @retval EFI_SUCCESS            The endpoint descriptor is returned.\r
+  @retval EFI_INVALID_PARAMETER  Some parameter is invalid.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetEndpointDescriptor (\r
@@ -666,16 +648,15 @@ UsbIoGetEndpointDescriptor (
 \r
 \r
 /**\r
-  Retrieve the supported language ID table from the device\r
+  Retrieve the supported language ID table from the device.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  LangIDTable            The table to return the language IDs\r
-  @param  TableSize              The number of supported languanges\r
+  @param  This                   The USB IO instance.\r
+  @param  LangIDTable            The table to return the language IDs.\r
+  @param  TableSize              The number of supported languanges.\r
 \r
-  @retval EFI_SUCCESS            The language ID is return\r
+  @retval EFI_SUCCESS            The language ID is return.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetSupportedLanguages (\r
@@ -702,18 +683,17 @@ UsbIoGetSupportedLanguages (
 \r
 \r
 /**\r
-  Retrieve an indexed string in the language of LangID\r
+  Retrieve an indexed string in the language of LangID.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  LangID                 The language ID of the string to retrieve\r
-  @param  StringIndex            The index of the string\r
-  @param  String                 The variable to receive the string\r
+  @param  This                   The USB IO instance.\r
+  @param  LangID                 The language ID of the string to retrieve.\r
+  @param  StringIndex            The index of the string.\r
+  @param  String                 The variable to receive the string.\r
 \r
-  @retval EFI_SUCCESS            The string is returned\r
-  @retval EFI_NOT_FOUND          No such string existed\r
+  @retval EFI_SUCCESS            The string is returned.\r
+  @retval EFI_NOT_FOUND          No such string existed.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetStringDescriptor (\r
@@ -793,10 +773,10 @@ ON_EXIT:
   Reset the device, then if that succeeds, reconfigure the\r
   device with its address and current active configuration.\r
 \r
-  @param  This                   The USB IO instance\r
+  @param  This                   The USB IO instance.\r
 \r
-  @retval EFI_SUCCESS            The device is reset and configured\r
-  @retval Others                 Failed to reset the device\r
+  @retval EFI_SUCCESS            The device is reset and configured.\r
+  @retval Others                 Failed to reset the device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -873,15 +853,15 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Install Usb Bus Protocol on host controller, and start the Usb bus\r
+  Install Usb Bus Protocol on host controller, and start the Usb bus.\r
 \r
-  @param This                    The USB bus driver binding instance\r
-  @param Controller              The controller to check\r
-  @param RemainingDevicePath     The remaining device patch\r
+  @param This                    The USB bus driver binding instance.\r
+  @param Controller              The controller to check.\r
+  @param RemainingDevicePath     The remaining device patch.\r
 \r
-  @retval EFI_SUCCESS            The controller is controlled by the usb bus\r
-  @retval EFI_ALREADY_STARTED    The controller is already controlled by the usb bus\r
-  @retval EFI_OUT_OF_RESOURCES   Failed to allocate resources\r
+  @retval EFI_SUCCESS            The controller is controlled by the usb bus.\r
+  @retval EFI_ALREADY_STARTED    The controller is already controlled by the usb bus.\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate resources.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1074,29 +1054,22 @@ EFI_USB_IO_PROTOCOL mUsbIoProtocol = {
 };\r
 \r
 \r
+/**\r
+  The USB bus driver entry pointer.\r
+\r
+  @param ImageHandle       The driver image handle.\r
+  @param SystemTable       The system table.\r
+\r
+  @return EFI_SUCCESS      The component name protocol is installed.\r
+  @return Others           Failed to init the usb driver.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbBusDriverEntryPoint (\r
   IN EFI_HANDLE           ImageHandle,\r
   IN EFI_SYSTEM_TABLE     *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The USB bus driver entry pointer\r
-\r
-Arguments:\r
-\r
-  ImageHandle - The driver image handle\r
-  SystemTable - The system table\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - The component name protocol is installed\r
-  Others      - Failed to init the usb driver\r
-\r
---*/\r
 {\r
   return EfiLibInstallDriverBindingComponentName2 (\r
            ImageHandle,\r
@@ -1110,14 +1083,14 @@ Returns:
 \r
 \r
 /**\r
-  Check whether USB bus driver support this device\r
+  Check whether USB bus driver support this device.\r
 \r
-  @param  This                   The USB bus driver binding protocol\r
-  @param  Controller             The controller handle to test againist\r
-  @param  RemainingDevicePath    The remaining device path\r
+  @param  This                   The USB bus driver binding protocol.\r
+  @param  Controller             The controller handle to test againist.\r
+  @param  RemainingDevicePath    The remaining device path.\r
 \r
   @retval EFI_SUCCESS            The bus supports this controller.\r
-  @retval EFI_UNSUPPORTED        This device isn't supported\r
+  @retval EFI_UNSUPPORTED        This device isn't supported.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1231,16 +1204,16 @@ UsbBusControllerDriverSupported (
 \r
 \r
 /**\r
-  Start to process the controller\r
+  Start to process the controller.\r
 \r
-  @param  This                   The USB bus driver binding instance\r
-  @param  Controller             The controller to check\r
-  @param  RemainingDevicePath    The remaining device patch\r
+  @param  This                   The USB bus driver binding instance.\r
+  @param  Controller             The controller to check.\r
+  @param  RemainingDevicePath    The remaining device patch.\r
 \r
-  @retval EFI_SUCCESS            The controller is controlled by the usb bus\r
+  @retval EFI_SUCCESS            The controller is controlled by the usb bus.\r
   @retval EFI_ALREADY_STARTED    The controller is already controlled by the usb\r
-                                 bus\r
-  @retval EFI_OUT_OF_RESOURCES   Failed to allocate resources\r
+                                 bus.\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate resources.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1312,16 +1285,16 @@ UsbBusControllerDriverStart (
 \r
 \r
 /**\r
-  Stop handle the controller by this USB bus driver\r
+  Stop handle the controller by this USB bus driver.\r
 \r
-  @param  This                   The USB bus driver binding protocol\r
-  @param  Controller             The controller to release\r
+  @param  This                   The USB bus driver binding protocol.\r
+  @param  Controller             The controller to release.\r
   @param  NumberOfChildren       The child of USB bus that opened controller\r
-                                 BY_CHILD\r
-  @param  ChildHandleBuffer      The array of child handle\r
+                                 BY_CHILD.\r
+  @param  ChildHandleBuffer      The array of child handle.\r
 \r
-  @retval EFI_SUCCESS            The controller or children are stopped\r
-  @retval EFI_DEVICE_ERROR       Failed to stop the driver\r
+  @retval EFI_SUCCESS            The controller or children are stopped.\r
+  @retval EFI_DEVICE_ERROR       Failed to stop the driver.\r
 \r
 **/\r
 EFI_STATUS\r