]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/UhciDxe/UhciQueue.c
update
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / UhciQueue.c
index 843c9e38aa64c987a43e45315eab21460c3658b0..3bf802eecfe00f9bc07e87e086e460a203babaeb 100644 (file)
@@ -1,6 +1,8 @@
 /** @file\r
 \r
-Copyright (c) 2007, Intel Corporation\r
+  The UHCI register operation routines.\r
+\r
+Copyright (c) 2007 - 2008, 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
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -9,32 +11,21 @@ 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
-  UhciQueue.c\r
-\r
-Abstract:\r
-\r
-  The UHCI register operation routines.\r
-\r
-Revision History\r
-\r
-\r
 **/\r
 \r
 #include "Uhci.h"\r
 \r
 \r
 /**\r
-  Map address of request structure buffer\r
+  Map address of request structure buffer.\r
 \r
-  @param  Uhc         The UHCI device\r
-  @param  Request     The user request buffer\r
-  @param  MappedAddr  Mapped address of request\r
-  @param  Map         Identificaion of this mapping to return\r
+  @param  Uhc                The UHCI device.\r
+  @param  Request            The user request buffer.\r
+  @param  MappedAddr         Mapped address of request.\r
+  @param  Map                Identificaion of this mapping to return.\r
 \r
-  @return EFI_SUCCESS      : Success\r
-  @return EFI_DEVICE_ERROR : Fail to map the user request\r
+  @return EFI_SUCCESS        Success.\r
+  @return EFI_DEVICE_ERROR   Fail to map the user request.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -68,18 +59,18 @@ UhciMapUserRequest (
 \r
 \r
 /**\r
-  Map address of user data buffer\r
+  Map address of user data buffer.\r
 \r
-  @param  Uhc         The UHCI device\r
-  @param  Direction   direction of the data transfer\r
-  @param  Data        The user data buffer\r
-  @param  Len         Length of the user data\r
-  @param  PktId       Packet identificaion\r
-  @param  MappedAddr  mapped address to return\r
-  @param  Map         identificaion of this mapping to return\r
+  @param  Uhc                The UHCI device.\r
+  @param  Direction          Direction of the data transfer.\r
+  @param  Data               The user data buffer.\r
+  @param  Len                Length of the user data.\r
+  @param  PktId              Packet identificaion.\r
+  @param  MappedAddr         Mapped address to return.\r
+  @param  Map                Identificaion of this mapping to return.\r
 \r
-  @return EFI_SUCCESS      : Success\r
-  @return EFI_DEVICE_ERROR : Fail to map the user data\r
+  @return EFI_SUCCESS        Success.\r
+  @return EFI_DEVICE_ERROR   Fail to map the user data.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -145,7 +136,6 @@ UhciMapUserData (
     }\r
 \r
     *PktId      = OUTPUT_PACKET_ID;\r
-    *Len        = 0;\r
     *MappedAddr = NULL;\r
     *Map        = NULL;\r
     break;\r
@@ -159,14 +149,11 @@ EXIT:
 }\r
 \r
 \r
-\r
 /**\r
-  Link the TD To QH\r
+  Link the TD To QH.\r
 \r
-  @param  Qh          The queue head for the TD to link to\r
-  @param  Td          The TD to link\r
-\r
-  @return VOID\r
+  @param  Qh          The queue head for the TD to link to.\r
+  @param  Td          The TD to link.\r
 \r
 **/\r
 VOID\r
@@ -183,12 +170,10 @@ UhciLinkTdToQh (
 \r
 \r
 /**\r
-  Unlink TD from the QH\r
-\r
-  @param  Qh          The queue head to unlink from\r
-  @param  Td          The TD to unlink\r
+  Unlink TD from the QH.\r
 \r
-  @return VOID\r
+  @param  Qh          The queue head to unlink from.\r
+  @param  Td          The TD to unlink.\r
 \r
 **/\r
 VOID\r
@@ -205,15 +190,12 @@ UhciUnlinkTdFromQh (
 \r
 \r
 /**\r
-  Append a new TD To the previous TD\r
-\r
-  @param  PrevTd      Previous UHCI_TD_SW to be linked to\r
-  @param  ThisTd      TD to link\r
+  Append a new TD To the previous TD.\r
 \r
-  @return VOID\r
+  @param  PrevTd      Previous UHCI_TD_SW to be linked to.\r
+  @param  ThisTd      TD to link.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 UhciAppendTd (\r
   IN UHCI_TD_SW     *PrevTd,\r
@@ -228,12 +210,12 @@ UhciAppendTd (
 \r
 \r
 /**\r
-  Delete a list of TDs\r
+  Delete a list of TDs.\r
 \r
-  @param  Uhc         The UHCI device\r
-  @param  FirstTd     TD link list head\r
+  @param  Uhc         The UHCI device.\r
+  @param  FirstTd     TD link list head.\r
 \r
-  @return VOID\r
+  @return None.\r
 \r
 **/\r
 VOID\r
@@ -256,12 +238,12 @@ UhciDestoryTds (
 \r
 \r
 /**\r
-  Create an initialize a new queue head\r
+  Create an initialize a new queue head.\r
 \r
-  @param  Uhc         The UHCI device\r
-  @param  Interval    The polling interval for the queue\r
+  @param  Uhc         The UHCI device.\r
+  @param  Interval    The polling interval for the queue.\r
 \r
-  @return The newly created queue header\r
+  @return The newly created queue header.\r
 \r
 **/\r
 UHCI_QH_SW *\r
@@ -280,7 +262,7 @@ UhciCreateQh (
 \r
   Qh->QhHw.HorizonLink  = QH_HLINK (NULL, TRUE);\r
   Qh->QhHw.VerticalLink = QH_VLINK (NULL, TRUE);\r
-  Qh->Interval          = Interval;\r
+  Qh->Interval          = UhciConvertPollRate(Interval);\r
   Qh->TDs               = NULL;\r
   Qh->NextQh            = NULL;\r
 \r
@@ -289,14 +271,13 @@ UhciCreateQh (
 \r
 \r
 /**\r
-  Create and intialize a TD\r
+  Create and intialize a TD.\r
 \r
-  @param  Uhc         The UHCI device\r
+  @param  Uhc         The UHCI device.\r
 \r
-  @return The newly allocated and initialized TD\r
+  @return The newly allocated and initialized TD.\r
 \r
 **/\r
-STATIC\r
 UHCI_TD_SW *\r
 UhciCreateTd (\r
   IN  USB_HC_DEV          *Uhc\r
@@ -319,17 +300,16 @@ UhciCreateTd (
 \r
 \r
 /**\r
-  Create and initialize a TD for Setup Stage of a control transfer\r
+  Create and initialize a TD for Setup Stage of a control transfer.\r
 \r
-  @param  Uhc         The UHCI device\r
-  @param  DevAddr     Device address\r
-  @param  Request     Device request\r
-  @param  IsLow       Full speed or low speed\r
+  @param  Uhc         The UHCI device.\r
+  @param  DevAddr     Device address.\r
+  @param  Request     Device request.\r
+  @param  IsLow       Full speed or low speed.\r
 \r
-  @return The created setup Td Pointer\r
+  @return The created setup Td Pointer.\r
 \r
 **/\r
-STATIC\r
 UHCI_TD_SW *\r
 UhciCreateSetupTd (\r
   IN  USB_HC_DEV          *Uhc,\r
@@ -368,21 +348,20 @@ UhciCreateSetupTd (
 \r
 \r
 /**\r
-  Create a TD for data\r
+  Create a TD for data.\r
 \r
-  @param  Uhc         The UHCI device\r
-  @param  DevAddr     Device address\r
-  @param  Endpoint    Endpoint number\r
-  @param  DataPtr     Data buffer\r
-  @param  Len         Data length\r
-  @param  PktId       Packet ID\r
-  @param  Toggle      Data toggle value\r
-  @param  IsLow       Full speed or low speed\r
+  @param  Uhc         The UHCI device.\r
+  @param  DevAddr     Device address.\r
+  @param  Endpoint    Endpoint number.\r
+  @param  DataPtr     Data buffer.\r
+  @param  Len         Data length.\r
+  @param  PktId       Packet ID.\r
+  @param  Toggle      Data toggle value.\r
+  @param  IsLow       Full speed or low speed.\r
 \r
-  @return Data Td pointer if success, otherwise NUL\r
+  @return Data Td pointer if success, otherwise NULL.\r
 \r
 **/\r
-STATIC\r
 UHCI_TD_SW *\r
 UhciCreateDataTd (\r
   IN  USB_HC_DEV          *Uhc,\r
@@ -430,17 +409,16 @@ UhciCreateDataTd (
 \r
 \r
 /**\r
-  Create TD for the Status Stage of control transfer\r
+  Create TD for the Status Stage of control transfer.\r
 \r
-  @param  Uhc         The UHCI device\r
-  @param  DevAddr     Device address\r
-  @param  PktId       Packet ID\r
-  @param  IsLow       Full speed or low speed\r
+  @param  Uhc         The UHCI device.\r
+  @param  DevAddr     Device address.\r
+  @param  PktId       Packet ID.\r
+  @param  IsLow       Full speed or low speed.\r
 \r
-  @return Status Td Pointer\r
+  @return Status Td Pointer.\r
 \r
 **/\r
-STATIC\r
 UHCI_TD_SW *\r
 UhciCreateStatusTd (\r
   IN  USB_HC_DEV          *Uhc,\r
@@ -479,18 +457,18 @@ UhciCreateStatusTd (
 \r
 \r
 /**\r
-  Create Tds list for Control Transfer\r
+  Create Tds list for Control Transfer.\r
 \r
-  @param  Uhc         The UHCI device\r
-  @param  DeviceAddr  The device address\r
-  @param  DataPktId   Packet Identification of Data Tds\r
-  @param  Request     A pointer to request structure buffer to transfer\r
-  @param  Data        A pointer to user data buffer to transfer\r
-  @param  DataLen     Length of user data to transfer\r
-  @param  MaxPacket   Maximum packet size for control transfer\r
-  @param  IsLow       Full speed or low speed\r
+  @param  Uhc         The UHCI device.\r
+  @param  DeviceAddr  The device address.\r
+  @param  DataPktId   Packet Identification of Data Tds.\r
+  @param  Request     A pointer to request structure buffer to transfer.\r
+  @param  Data        A pointer to user data buffer to transfer.\r
+  @param  DataLen     Length of user data to transfer.\r
+  @param  MaxPacket   Maximum packet size for control transfer.\r
+  @param  IsLow       Full speed or low speed.\r
 \r
-  @return The Td list head for the control transfer\r
+  @return The Td list head for the control transfer.\r
 \r
 **/\r
 UHCI_TD_SW *\r
@@ -610,19 +588,19 @@ FREE_TD:
 \r
 \r
 /**\r
-  Create Tds list for Bulk/Interrupt Transfer\r
-\r
-  @param  Uhc         USB_HC_DEV\r
-  @param  DevAddr     Address of Device\r
-  @param  EndPoint    Endpoint Number\r
-  @param  PktId       Packet Identification of Data Tds\r
-  @param  Data        A pointer to user data buffer to transfer\r
-  @param  DataLen     Length of user data to transfer\r
-  @param  DataToggle  Data Toggle Pointer\r
-  @param  MaxPacket   Maximum packet size for Bulk/Interrupt transfer\r
-  @param  IsLow       Is Low Speed Device\r
-\r
-  @return The Tds list head for the bulk transfer\r
+  Create Tds list for Bulk/Interrupt Transfer.\r
+\r
+  @param  Uhc         USB_HC_DEV.\r
+  @param  DevAddr     Address of Device.\r
+  @param  EndPoint    Endpoint Number.\r
+  @param  PktId       Packet Identification of Data Tds.\r
+  @param  Data        A pointer to user data buffer to transfer.\r
+  @param  DataLen     Length of user data to transfer.\r
+  @param  DataToggle  Data Toggle Pointer.\r
+  @param  MaxPacket   Maximum packet size for Bulk/Interrupt transfer.\r
+  @param  IsLow       Is Low Speed Device.\r
+\r
+  @return The Tds list head for the bulk transfer.\r
 \r
 **/\r
 UHCI_TD_SW *\r