/** @file\r
\r
-Copyright (c) 2007, Intel Corporation\r
+ This file contains URB request, each request is warpped in a\r
+ URB (Usb Request Block).\r
+\r
+Copyright (c) 2007 - 2009, 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
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
- EhciUrb.c\r
-\r
-Abstract:\r
-\r
- This file contains URB request, each request is warpped in a\r
- URB (Usb Request Block)\r
-\r
-Revision History\r
-\r
**/\r
\r
#include "Ehci.h"\r
\r
\r
/**\r
- Create a single QTD to hold the data\r
+ Create a single QTD to hold the data.\r
\r
- @param Ehc The EHCI device\r
- @param Data Current data not associated with a QTD\r
- @param DataLen The length of the data\r
- @param PktId Packet ID to use in the QTD\r
- @param Toggle Data toggle to use in the QTD\r
- @param MaxPacket Maximu packet length of the endpoint\r
+ @param Ehc The EHCI device.\r
+ @param Data Current data not associated with a QTD.\r
+ @param DataLen The length of the data.\r
+ @param PktId Packet ID to use in the QTD.\r
+ @param Toggle Data toggle to use in the QTD.\r
+ @param MaxPacket Maximu packet length of the endpoint.\r
\r
- @return Created QTD or NULL if failed to create one\r
+ @return Created QTD or NULL if failed to create one.\r
\r
**/\r
EHC_QTD *\r
2. Microframe S-mask\r
3. Microframe C-mask\r
\r
- @param Ep The queue head's related endpoint\r
- @param QhHw The queue head to initialize\r
-\r
- @return None\r
+ @param Ep The queue head's related endpoint.\r
+ @param QhHw The queue head to initialize.\r
\r
**/\r
-STATIC\r
VOID\r
EhcInitIntQh (\r
IN USB_ENDPOINT *Ep,\r
\r
\r
/**\r
- Allocate and initialize a EHCI queue head\r
+ Allocate and initialize a EHCI queue head.\r
\r
- @param Ehci The EHCI device\r
- @param Ep The endpoint to create queue head for\r
+ @param Ehci The EHCI device.\r
+ @param Ep The endpoint to create queue head for.\r
\r
- @return Created queue head or NULL if failed to create one\r
+ @return Created queue head or NULL if failed to create one.\r
\r
**/\r
EHC_QH *\r
}\r
\r
\r
-\r
/**\r
Convert the poll interval from application to that\r
be used by EHCI interface data structure. Only need\r
to get the max 2^n that is less than interval. UEFI\r
can't support high speed endpoint with a interval less\r
than 8 microframe because interval is specified in\r
- the unit of ms (millisecond)\r
+ the unit of ms (millisecond).\r
\r
- @param Interval The interval to convert\r
+ @param Interval The interval to convert.\r
\r
- @return The converted interval\r
+ @return The converted interval.\r
\r
**/\r
-STATIC\r
UINTN\r
EhcConvertPollRate (\r
IN UINTN Interval\r
}\r
\r
\r
-\r
/**\r
- Free a list of QTDs\r
+ Free a list of QTDs.\r
\r
- @param Ehc The EHCI device\r
- @param Qtds The list head of the QTD\r
-\r
- @return None\r
+ @param Ehc The EHCI device.\r
+ @param Qtds The list head of the QTD.\r
\r
**/\r
-STATIC\r
VOID\r
EhcFreeQtds (\r
IN USB2_HC_DEV *Ehc,\r
/**\r
Free an allocated URB. It is possible for it to be partially inited.\r
\r
- @param Ehc The EHCI device\r
- @param Urb The URB to free\r
-\r
- @return None\r
+ @param Ehc The EHCI device.\r
+ @param Urb The URB to free.\r
\r
**/\r
VOID\r
}\r
\r
\r
-\r
/**\r
- Create a list of QTDs for the URB\r
+ Create a list of QTDs for the URB.\r
\r
- @param Ehc The EHCI device\r
- @param Urb The URB to create QTDs for\r
+ @param Ehc The EHCI device.\r
+ @param Urb The URB to create QTDs for.\r
\r
- @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for QTD\r
- @retval EFI_SUCCESS The QTDs are allocated for the URB\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for QTD.\r
+ @retval EFI_SUCCESS The QTDs are allocated for the URB.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EhcCreateQtds (\r
IN USB2_HC_DEV *Ehc,\r
\r
\r
/**\r
- Create a new URB and its associated QTD\r
-\r
- @param Ehc The EHCI device\r
- @param DevAddr The device address\r
- @param EpAddr Endpoint addrress & its direction\r
- @param DevSpeed The device speed\r
- @param Toggle Initial data toggle to use\r
- @param MaxPacket The max packet length of the endpoint\r
- @param Hub The transaction translator to use\r
- @param Type The transaction type\r
- @param Request The standard USB request for control transfer\r
- @param Data The user data to transfer\r
- @param DataLen The length of data buffer\r
- @param Callback The function to call when data is transferred\r
- @param Context The context to the callback\r
- @param Interval The interval for interrupt transfer\r
-\r
- @return Created URB or NULL\r
+ Create a new URB and its associated QTD.\r
+\r
+ @param Ehc The EHCI device.\r
+ @param DevAddr The device address.\r
+ @param EpAddr Endpoint addrress & its direction.\r
+ @param DevSpeed The device speed.\r
+ @param Toggle Initial data toggle to use.\r
+ @param MaxPacket The max packet length of the endpoint.\r
+ @param Hub The transaction translator to use.\r
+ @param Type The transaction type.\r
+ @param Request The standard USB request for control transfer.\r
+ @param Data The user data to transfer.\r
+ @param DataLen The length of data buffer.\r
+ @param Callback The function to call when data is transferred.\r
+ @param Context The context to the callback.\r
+ @param Interval The interval for interrupt transfer.\r
+\r
+ @return Created URB or NULL.\r
\r
**/\r
URB *\r
Ep = &Urb->Ep;\r
Ep->DevAddr = DevAddr;\r
Ep->EpAddr = (UINT8) (EpAddr & 0x0F);\r
- Ep->Direction = ((EpAddr & 0x80) ? EfiUsbDataIn : EfiUsbDataOut);\r
+ Ep->Direction = (((EpAddr & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut);\r
Ep->DevSpeed = DevSpeed;\r
Ep->MaxPacket = MaxPacket;\r
\r