summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiUsbLib
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-07-12 17:31:28 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-07-12 17:31:28 +0000
commited838d0c5ec4d4f2f1c1898fff1c6c619ff46352 (patch)
tree037448daf15593f1297124adb9deec57a343d3f0 /MdePkg/Library/UefiUsbLib
parent1e5e7925461761398efdd6a2853b03543a3a9f6d (diff)
downloadedk2-ed838d0c5ec4d4f2f1c1898fff1c6c619ff46352.tar.gz
edk2-ed838d0c5ec4d4f2f1c1898fff1c6c619ff46352.tar.bz2
edk2-ed838d0c5ec4d4f2f1c1898fff1c6c619ff46352.zip
1. Import UsbKbDxe and UsbMouseDxe into MdeModulePkg
2. Updated UefiUsbLib git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3216 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/UefiUsbLib')
-rw-r--r--MdePkg/Library/UefiUsbLib/UefiUsbLib.inf4
-rw-r--r--MdePkg/Library/UefiUsbLib/UefiUsbLib.msa1
-rw-r--r--MdePkg/Library/UefiUsbLib/UsbDxeLib.c528
-rw-r--r--MdePkg/Library/UefiUsbLib/hid.c277
4 files changed, 332 insertions, 478 deletions
diff --git a/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf b/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
index e0c46aeb59..adf275772a 100644
--- a/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
+++ b/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
@@ -25,7 +25,7 @@
FILE_GUID = 87eb5df9-722a-4241-ad7f-370d0b3a56d7
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
- LIBRARY_CLASS = UsbLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
+ LIBRARY_CLASS = UsbLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
@@ -45,8 +45,6 @@
[Sources.common]
hid.c
UsbDxeLib.c
- CommonHeader.h
-
################################################################################
#
diff --git a/MdePkg/Library/UefiUsbLib/UefiUsbLib.msa b/MdePkg/Library/UefiUsbLib/UefiUsbLib.msa
index d552426156..1226226327 100644
--- a/MdePkg/Library/UefiUsbLib/UefiUsbLib.msa
+++ b/MdePkg/Library/UefiUsbLib/UefiUsbLib.msa
@@ -30,6 +30,7 @@
</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
+ <Filename>hid.h</Filename>
<Filename>UsbDxeLib.c</Filename>
<Filename>hid.c</Filename>
</SourceFiles>
diff --git a/MdePkg/Library/UefiUsbLib/UsbDxeLib.c b/MdePkg/Library/UefiUsbLib/UsbDxeLib.c
index 626fa22290..cb8885396d 100644
--- a/MdePkg/Library/UefiUsbLib/UsbDxeLib.c
+++ b/MdePkg/Library/UefiUsbLib/UsbDxeLib.c
@@ -1,13 +1,13 @@
-/*++
+/** @file
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2004 - 2007, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
@@ -19,13 +19,34 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Revision History
---*/
-#include "UefiUsbLibInternal.h"
+**/
//
-// Get Device Descriptor
+// The package level header files this module uses
+//
+#include <PiDxe.h>
+//
+// The Library classes this module consumes
//
+#include <Library/BaseMemoryLib.h>
+#include <Library/UsbLib.h>
+
+/**
+ Usb Get Descriptor
+
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Value Device Request Value
+ @param Index Device Request Index
+ @param DescriptorLength Descriptor Length
+ @param Descriptor Descriptor buffer to contain result
+ @param Status Transfer Status
+
+ @retval EFI_INVALID_PARAMETER Parameter is error
+ @retval EFI_SUCCESS Success
+ @retval EFI_TIMEOUT Device has no response
+
+**/
EFI_STATUS
UsbGetDescriptor (
IN EFI_USB_IO_PROTOCOL *UsbIo,
@@ -35,26 +56,6 @@ UsbGetDescriptor (
OUT VOID *Descriptor,
OUT UINT32 *Status
)
-/*++
-
-Routine Description:
-
- Usb Get Descriptor
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Value - Device Request Value
- Index - Device Request Index
- DescriptorLength - Descriptor Length
- Descriptor - Descriptor buffer to contain result
- Status - Transfer Status
-Returns:
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -65,7 +66,7 @@ Returns:
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_DEV_GET_DESCRIPTOR;
+ DevReq.Request = USB_REQ_GET_DESCRIPTOR;
DevReq.Value = Value;
DevReq.Index = Index;
DevReq.Length = DescriptorLength;
@@ -80,9 +81,23 @@ Returns:
Status
);
}
-//
-// Set Device Descriptor
-//
+
+
+/**
+ Usb Set Descriptor
+
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Value Device Request Value
+ @param Index Device Request Index
+ @param DescriptorLength Descriptor Length
+ @param Descriptor Descriptor buffer to set
+ @param Status Transfer Status
+
+ @retval EFI_INVALID_PARAMETER Parameter is error
+ @retval EFI_SUCCESS Success
+ @retval EFI_TIMEOUT Device has no response
+
+**/
EFI_STATUS
UsbSetDescriptor (
IN EFI_USB_IO_PROTOCOL *UsbIo,
@@ -92,26 +107,6 @@ UsbSetDescriptor (
IN VOID *Descriptor,
OUT UINT32 *Status
)
-/*++
-
-Routine Description:
-
- Usb Set Descriptor
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Value - Device Request Value
- Index - Device Request Index
- DescriptorLength - Descriptor Length
- Descriptor - Descriptor buffer to set
- Status - Transfer Status
-Returns:
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -122,7 +117,7 @@ Returns:
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
DevReq.RequestType = USB_DEV_SET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_DESCRIPTOR;
+ DevReq.Request = USB_REQ_SET_DESCRIPTOR;
DevReq.Value = Value;
DevReq.Index = Index;
DevReq.Length = DescriptorLength;
@@ -138,37 +133,27 @@ Returns:
);
}
-//
-// Get device Interface
-//
+
+/**
+ Usb Get Device Interface
+
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Index Interface index value
+ @param AltSetting Alternate setting
+ @param Status Trasnsfer status
+
+ @retval EFI_INVALID_PARAMETER Parameter is error
+ @retval EFI_SUCCESS Success
+ @retval EFI_TIMEOUT Device has no response
+
+**/
EFI_STATUS
-UsbGetDeviceInterface (
+UsbGetInterface (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT16 Index,
OUT UINT8 *AltSetting,
OUT UINT32 *Status
)
-/*++
-
-Routine Description:
-
- Usb Get Device Interface
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Index - Interface index value
- AltSetting - Alternate setting
- Status - Trasnsfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
-
---*/
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -179,7 +164,7 @@ Returns:
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE;
- DevReq.Request = USB_DEV_GET_INTERFACE;
+ DevReq.Request = USB_REQ_GET_INTERFACE;
DevReq.Index = Index;
DevReq.Length = 1;
@@ -193,36 +178,28 @@ Returns:
Status
);
}
-//
-// Set device interface
-//
-EFI_STATUS
-UsbSetDeviceInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 InterfaceNo,
- IN UINT16 AltSetting,
- OUT UINT32 *Status
- )
-/*++
-Routine Description:
+/**
Usb Set Device Interface
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- InterfaceNo - Interface Number
- AltSetting - Alternate setting
- Status - Trasnsfer status
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param InterfaceNo Interface Number
+ @param AltSetting Alternate setting
+ @param Status Trasnsfer status
-Returns:
+ @retval EFI_INVALID_PARAMETER Parameter is error
+ @retval EFI_SUCCESS Success
+ @retval EFI_TIMEOUT Device has no response
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
+**/
+EFI_STATUS
+UsbSetInterface (
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 InterfaceNo,
+ IN UINT16 AltSetting,
+ OUT UINT32 *Status
+ )
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -233,10 +210,10 @@ Returns:
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
DevReq.RequestType = USB_DEV_SET_INTERFACE_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_INTERFACE;
+ DevReq.Request = USB_REQ_SET_INTERFACE;
DevReq.Value = AltSetting;
DevReq.Index = InterfaceNo;
-
+
return UsbIo->UsbControlTransfer (
UsbIo,
@@ -248,34 +225,26 @@ Returns:
Status
);
}
-//
-// Get device configuration
-//
-EFI_STATUS
-UsbGetDeviceConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- OUT UINT8 *ConfigValue,
- OUT UINT32 *Status
- )
-/*++
-Routine Description:
+/**
Usb Get Device Configuration
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- ConfigValue - Config Value
- Status - Transfer Status
-
-Returns:
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param ConfigValue Config Value
+ @param Status Transfer Status
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
+ @retval EFI_INVALID_PARAMETER Parameter is error
+ @retval EFI_SUCCESS Success
+ @retval EFI_TIMEOUT Device has no response
---*/
+**/
+EFI_STATUS
+UsbGetConfiguration (
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ OUT UINT8 *ConfigValue,
+ OUT UINT32 *Status
+ )
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -286,7 +255,7 @@ Returns:
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_DEV_GET_CONFIGURATION;
+ DevReq.Request = USB_REQ_GET_CONFIG;
DevReq.Length = 1;
return UsbIo->UsbControlTransfer (
@@ -299,34 +268,26 @@ Returns:
Status
);
}
-//
-// Set device configuration
-//
-EFI_STATUS
-UsbSetDeviceConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- OUT UINT32 *Status
- )
-/*++
-Routine Description:
+/**
Usb Set Device Configuration
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Value - Configuration Value to set
- Status - Transfer status
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Value Configuration Value to set
+ @param Status Transfer status
-Returns:
+ @retval EFI_INVALID_PARAMETER Parameter is error
+ @retval EFI_SUCCESS Success
+ @retval EFI_TIMEOUT Device has no response
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
+**/
+EFI_STATUS
+UsbSetConfiguration (
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINT16 Value,
+ OUT UINT32 *Status
+ )
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -337,9 +298,9 @@ Returns:
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_CONFIGURATION;
+ DevReq.Request = USB_REQ_SET_CONFIG;
DevReq.Value = Value;
-
+
return UsbIo->UsbControlTransfer (
UsbIo,
&DevReq,
@@ -350,38 +311,30 @@ Returns:
Status
);
}
-//
-// Set Device Feature
-//
-EFI_STATUS
-UsbSetDeviceFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
- )
-/*++
-Routine Description:
+/**
Usb Set Device Feature
-Arguments:
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Recipient Interface/Device/Endpoint
+ @param Value Request value
+ @param Target Request Index
+ @param Status Transfer status
- UsbIo - EFI_USB_IO_PROTOCOL
- Recipient - Interface/Device/Endpoint
- Value - Request value
- Target - Request Index
- Status - Transfer status
+ @retval EFI_INVALID_PARAMETER Parameter is error
+ @retval EFI_SUCCESS Success
+ @retval EFI_TIMEOUT Device has no response
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
+**/
+EFI_STATUS
+UsbSetFeature (
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINTN Recipient,
+ IN UINT16 Value,
+ IN UINT16 Target,
+ OUT UINT32 *Status
+ )
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -393,22 +346,22 @@ Returns:
switch (Recipient) {
- case EfiUsbDevice:
- DevReq.RequestType = 0x00;
+ case USB_TARGET_DEVICE:
+ DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_D;
break;
- case EfiUsbInterface:
- DevReq.RequestType = 0x01;
+ case USB_TARGET_INTERFACE:
+ DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_I;
break;
- case EfiUsbEndpoint:
- DevReq.RequestType = 0x02;
+ case USB_TARGET_ENDPOINT:
+ DevReq.RequestType = USB_DEV_SET_FEATURE_REQ_TYPE_E;
break;
}
//
// Fill device request, see USB1.1 spec
//
- DevReq.Request = USB_DEV_SET_FEATURE;
+ DevReq.Request = USB_REQ_SET_FEATURE;
DevReq.Value = Value;
DevReq.Index = Target;
@@ -423,38 +376,30 @@ Returns:
Status
);
}
-//
-// Clear Device Feature
-//
-EFI_STATUS
-UsbClearDeviceFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
- )
-/*++
-Routine Description:
+/**
Usb Clear Device Feature
-Arguments:
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Recipient Interface/Device/Endpoint
+ @param Value Request value
+ @param Target Request Index
+ @param Status Transfer status
- UsbIo - EFI_USB_IO_PROTOCOL
- Recipient - Interface/Device/Endpoint
- Value - Request value
- Target - Request Index
- Status - Transfer status
+ @retval EFI_INVALID_PARAMETER Parameter is error
+ @retval EFI_SUCCESS Success
+ @retval EFI_TIMEOUT Device has no response
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
+**/
+EFI_STATUS
+UsbClearFeature (
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINTN Recipient,
+ IN UINT16 Value,
+ IN UINT16 Target,
+ OUT UINT32 *Status
+ )
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -466,22 +411,22 @@ Returns:
switch (Recipient) {
- case EfiUsbDevice:
- DevReq.RequestType = 0x00;
+ case USB_TARGET_DEVICE:
+ DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_D;
break;
- case EfiUsbInterface:
- DevReq.RequestType = 0x01;
+ case USB_TARGET_INTERFACE:
+ DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_I;
break;
- case EfiUsbEndpoint:
- DevReq.RequestType = 0x02;
+ case USB_TARGET_ENDPOINT:
+ DevReq.RequestType = USB_DEV_CLEAR_FEATURE_REQ_TYPE_E;
break;
}
//
// Fill device request, see USB1.1 spec
//
- DevReq.Request = USB_DEV_CLEAR_FEATURE;
+ DevReq.Request = USB_REQ_CLEAR_FEATURE;
DevReq.Value = Value;
DevReq.Index = Target;
@@ -496,38 +441,30 @@ Returns:
Status
);
}
-//
-// Get Device Status
-//
-EFI_STATUS
-UsbGetDeviceStatus (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Target,
- OUT UINT16 *DevStatus,
- OUT UINT32 *Status
- )
-/*++
-Routine Description:
+/**
Usb Get Device Status
-Arguments:
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Recipient Interface/Device/Endpoint
+ @param Target Request index
+ @param DevStatus Device status
+ @param Status Transfer status
- UsbIo - EFI_USB_IO_PROTOCOL
- Recipient - Interface/Device/Endpoint
- Target - Request index
- DevStatus - Device status
- Status - Transfer status
+ @retval EFI_INVALID_PARAMETER Parameter is error
+ @retval EFI_SUCCESS Success
+ @retval EFI_TIMEOUT Device has no response
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
+**/
+EFI_STATUS
+UsbGetStatus (
+ IN EFI_USB_IO_PROTOCOL *UsbIo,
+ IN UINTN Recipient,
+ IN UINT16 Target,
+ OUT UINT16 *DevStatus,
+ OUT UINT32 *Status
+ )
{
EFI_USB_DEVICE_REQUEST DevReq;
@@ -539,22 +476,22 @@ Returns:
switch (Recipient) {
- case EfiUsbDevice:
- DevReq.RequestType = 0x80;
+ case USB_TARGET_DEVICE:
+ DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_D;
break;
- case EfiUsbInterface:
- DevReq.RequestType = 0x81;
+ case USB_TARGET_INTERFACE:
+ DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_I;
break;
- case EfiUsbEndpoint:
- DevReq.RequestType = 0x82;
+ case USB_TARGET_ENDPOINT:
+ DevReq.RequestType = USB_DEV_GET_STATUS_REQ_TYPE_E;
break;
}
//
// Fill device request, see USB1.1 spec
//
- DevReq.Request = USB_DEV_GET_STATUS;
+ DevReq.Request = USB_REQ_GET_STATUS;
DevReq.Value = 0;
DevReq.Index = Target;
DevReq.Length = 2;
@@ -569,86 +506,27 @@ Returns:
Status
);
}
-//
-// Usb Get String
-//
-EFI_STATUS
-UsbGetString (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 LangID,
- IN UINT8 Index,
- IN VOID *Buf,
- IN UINTN BufSize,
- OUT UINT32 *Status
- )
-/*++
-Routine Description:
- Usb Get String
-Arguments:
+/**
+ Clear endpoint stall
- UsbIo - EFI_USB_IO_PROTOCOL
- LangID - Language ID
- Index - Request index
- Buf - Buffer to store string
- BufSize - Buffer size
- Status - Transfer status
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param EndpointNo Endpoint Number
+ @param Status Transfer Status
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- UINT16 Value;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Fill value, see USB1.1 spec
- //
- Value = (UINT16) ((USB_DT_STRING << 8) | Index);
-
- return UsbGetDescriptor (
- UsbIo,
- Value,
- LangID,
- (UINT16) BufSize,
- Buf,
- Status
- );
-}
+ @retval EFI_NOT_FOUND Can't find the Endpoint
+ @retval EFI_DEVICE_ERROR Hardware error
+ @retval EFI_SUCCESS Success
+**/
EFI_STATUS
UsbClearEndpointHalt (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 EndpointNo,
OUT UINT32 *Status
)
-/*++
-
-Routine Description:
-
- Clear endpoint stall
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- EndpointNo - Endpoint Number
- Status - Transfer Status
-
-Returns:
-
- EFI_NOT_FOUND - Can't find the Endpoint
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
-
---*/
{
EFI_STATUS Result;
EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
@@ -689,9 +567,9 @@ Returns:
return EFI_NOT_FOUND;
}
- Result = UsbClearDeviceFeature (
+ Result = UsbClearFeature (
UsbIo,
- EfiUsbEndpoint,
+ USB_TARGET_ENDPOINT,
EfiUsbEndpointHalt,
EndpointDescriptor.EndpointAddress,
Status
diff --git a/MdePkg/Library/UefiUsbLib/hid.c b/MdePkg/Library/UefiUsbLib/hid.c
index a1019a0f2d..3156f63143 100644
--- a/MdePkg/Library/UefiUsbLib/hid.c
+++ b/MdePkg/Library/UefiUsbLib/hid.c
@@ -1,13 +1,13 @@
-/*++
+/** @file
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
@@ -19,36 +19,34 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Revision History
---*/
-#include "UefiUsbLibInternal.h"
+**/
+#include <PiDxe.h>
+#include <Library/UsbLib.h>
//
// Function to get HID descriptor
//
+
+/**
+ Get Hid Descriptor
+
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param InterfaceNum Hid interface number
+ @param HidDescriptor Caller allocated buffer to store Usb hid descriptor if
+ successfully returned.
+
+ @return EFI_SUCCESS
+ @return EFI_DEVICE_ERROR
+ @return EFI_TIMEOUT
+
+**/
EFI_STATUS
UsbGetHidDescriptor (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 InterfaceNum,
OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
)
-/*++
-
- Routine Description:
- Get Hid Descriptor
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- InterfaceNum - Hid interface number
- HidDescriptor - Caller allocated buffer to store Usb hid descriptor
- if successfully returned.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
{
UINT32 Status;
EFI_STATUS Result;
@@ -76,6 +74,21 @@ UsbGetHidDescriptor (
//
// Function to get Report Class descriptor
//
+
+/**
+ get Report Class descriptor
+
+ @param UsbIo EFI_USB_IO_PROTOCOL.
+ @param InterfaceNum Report interface number.
+ @param DescriptorSize Length of DescriptorBuffer.
+ @param DescriptorBuffer Caller allocated buffer to store Usb report descriptor
+ if successfully returned.
+
+ @return EFI_SUCCESS
+ @return EFI_DEVICE_ERROR
+ @return EFI_TIMEOUT
+
+**/
EFI_STATUS
UsbGetReportDescriptor (
IN EFI_USB_IO_PROTOCOL *UsbIo,
@@ -83,24 +96,6 @@ UsbGetReportDescriptor (
IN UINT16 DescriptorSize,
OUT UINT8 *DescriptorBuffer
)
-/*++
-
- Routine Description:
- get Report Class descriptor
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL.
- InterfaceNum - Report interface number.
- DescriptorSize - Length of DescriptorBuffer.
- DescriptorBuffer - Caller allocated buffer to store Usb report descriptor
- if successfully returned.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
{
UINT32 Status;
EFI_STATUS Result;
@@ -131,28 +126,25 @@ UsbGetReportDescriptor (
//
// Following are HID class request
//
+
+/**
+ Get Hid Protocol Request
+
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Interface Which interface the caller wants to get protocol
+ @param Protocol Protocol value returned.
+
+ @return EFI_SUCCESS
+ @return EFI_DEVICE_ERROR
+ @return EFI_TIMEOUT
+
+**/
EFI_STATUS
UsbGetProtocolRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 Interface,
IN UINT8 *Protocol
)
-/*++
-
- Routine Description:
- Get Hid Protocol Request
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to get protocol
- Protocol - Protocol value returned.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
{
UINT32 Status;
EFI_STATUS Result;
@@ -184,28 +176,25 @@ UsbGetProtocolRequest (
}
+
+/**
+ Set Hid Protocol Request
+
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Interface Which interface the caller wants to set protocol
+ @param Protocol Protocol value the caller wants to set.
+
+ @return EFI_SUCCESS
+ @return EFI_DEVICE_ERROR
+ @return EFI_TIMEOUT
+
+**/
EFI_STATUS
UsbSetProtocolRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 Interface,
IN UINT8 Protocol
)
-/*++
-
- Routine Description:
- Set Hid Protocol Request
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set protocol
- Protocol - Protocol value the caller wants to set.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
{
UINT32 Status;
EFI_STATUS Result;
@@ -236,6 +225,20 @@ UsbSetProtocolRequest (
}
+
+/**
+ Set Idel request.
+
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Interface Which interface the caller wants to set.
+ @param ReportId Which report the caller wants to set.
+ @param Duration Idle rate the caller wants to set.
+
+ @return EFI_SUCCESS
+ @return EFI_DEVICE_ERROR
+ @return EFI_TIMEOUT
+
+**/
EFI_STATUS
UsbSetIdleRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
@@ -243,23 +246,6 @@ UsbSetIdleRequest (
IN UINT8 ReportId,
IN UINT8 Duration
)
-/*++
-
- Routine Description:
- Set Idel request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set.
- ReportId - Which report the caller wants to set.
- Duration - Idle rate the caller wants to set.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
{
UINT32 Status;
EFI_STATUS Result;
@@ -289,6 +275,20 @@ UsbSetIdleRequest (
return Result;
}
+
+/**
+ Get Idel request.
+
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Interface Which interface the caller wants to get.
+ @param ReportId Which report the caller wants to get.
+ @param Duration Idle rate the caller wants to get.
+
+ @return EFI_SUCCESS
+ @return EFI_DEVICE_ERROR
+ @return EFI_TIMEOUT
+
+**/
EFI_STATUS
UsbGetIdleRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
@@ -296,23 +296,6 @@ UsbGetIdleRequest (
IN UINT8 ReportId,
OUT UINT8 *Duration
)
-/*++
-
- Routine Description:
- Get Idel request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to get.
- ReportId - Which report the caller wants to get.
- Duration - Idle rate the caller wants to get.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
{
UINT32 Status;
EFI_STATUS Result;
@@ -344,6 +327,22 @@ UsbGetIdleRequest (
}
+
+/**
+ Hid Set Report request.
+
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Interface Which interface the caller wants to set.
+ @param ReportId Which report the caller wants to set.
+ @param ReportType Type of report.
+ @param ReportLen Length of report descriptor.
+ @param Report Report Descriptor buffer.
+
+ @return EFI_SUCCESS
+ @return EFI_DEVICE_ERROR
+ @return EFI_TIMEOUT
+
+**/
EFI_STATUS
UsbSetReportRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
@@ -353,25 +352,6 @@ UsbSetReportRequest (
IN UINT16 ReportLen,
IN UINT8 *Report
)
-/*++
-
- Routine Description:
- Hid Set Report request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set.
- ReportId - Which report the caller wants to set.
- ReportType - Type of report.
- ReportLen - Length of report descriptor.
- Report - Report Descriptor buffer.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
{
UINT32 Status;
EFI_STATUS Result;
@@ -402,6 +382,22 @@ UsbSetReportRequest (
return Result;
}
+
+/**
+ Hid Set Report request.
+
+ @param UsbIo EFI_USB_IO_PROTOCOL
+ @param Interface Which interface the caller wants to set.
+ @param ReportId Which report the caller wants to set.
+ @param ReportType Type of report.
+ @param ReportLen Length of report descriptor.
+ @param Report Caller allocated buffer to store Report Descriptor.
+
+ @return EFI_SUCCESS
+ @return EFI_DEVICE_ERROR
+ @return EFI_TIMEOUT
+
+**/
EFI_STATUS
UsbGetReportRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
@@ -411,25 +407,6 @@ UsbGetReportRequest (
IN UINT16 ReportLen,
IN UINT8 *Report
)
-/*++
-
- Routine Description:
- Hid Set Report request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set.
- ReportId - Which report the caller wants to set.
- ReportType - Type of report.
- ReportLen - Length of report descriptor.
- Report - Caller allocated buffer to store Report Descriptor.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
{
UINT32 Status;
EFI_STATUS Result;