/** @file\r
Common Libarary for PEI USB\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved. <BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved. <BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
);\r
}\r
\r
-/**\r
- Clear Endpoint Halt.\r
-\r
- @param PeiServices General-purpose services that are available to every PEIM.\r
- @param UsbIoPpi Indicates the PEI_USB_IO_PPI instance.\r
- @param EndpointAddress The endpoint address.\r
-\r
- @retval EFI_SUCCESS Endpoint halt is cleared successfully.\r
- @retval EFI_DEVICE_ERROR Cannot clear the endpoint halt status due to a hardware error.\r
- @retval Others Other failure occurs.\r
-\r
-**/\r
-EFI_STATUS\r
-PeiUsbClearEndpointHalt (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN PEI_USB_IO_PPI *UsbIoPpi,\r
- IN UINT8 EndpointAddress\r
- )\r
-{\r
- EFI_STATUS Status;\r
- PEI_USB_DEVICE *PeiUsbDev;\r
- EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;\r
- UINT8 EndpointIndex;\r
-\r
- EndpointIndex = 0;\r
- PeiUsbDev = PEI_USB_DEVICE_FROM_THIS (UsbIoPpi);\r
-\r
- while (EndpointIndex < MAX_ENDPOINT) {\r
- Status = UsbIoPpi->UsbGetEndpointDescriptor (PeiServices, UsbIoPpi, EndpointIndex, &EndpointDescriptor);\r
- if (EFI_ERROR (Status)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- if (EndpointDescriptor->EndpointAddress == EndpointAddress) {\r
- break;\r
- }\r
-\r
- EndpointIndex++;\r
- }\r
-\r
- if (EndpointIndex == MAX_ENDPOINT) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- Status = PeiUsbClearDeviceFeature (\r
- PeiServices,\r
- UsbIoPpi,\r
- EfiUsbEndpoint,\r
- EfiUsbEndpointHalt,\r
- EndpointAddress\r
- );\r
-\r
- //\r
- // set data toggle to zero.\r
- //\r
- if ((PeiUsbDev->DataToggle & (1 << EndpointIndex)) != 0) {\r
- PeiUsbDev->DataToggle = (UINT8) (PeiUsbDev->DataToggle ^ (1 << EndpointIndex));\r
- }\r
-\r
- return Status;\r
-}\r
-\r
/**\r
Judge if the port is connected with a usb device or not.\r
\r