audk/MdePkg/Include/Library/UsbLib.h

194 lines
4.9 KiB
C

/** @file
Common Dxe Libarary for USB
Copyright (c) 2006, Intel Corporation<BR>
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.
**/
#ifndef __USB_DXE_LIB_H__
#define __USB_DXE_LIB_H__
#include <Protocol/UsbIo.h>
//
// define the timeout time as 3ms
//
#define TIMEOUT_VALUE 3 * 1000
EFI_STATUS
UsbGetHidDescriptor (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 InterfaceNum,
OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
);
EFI_STATUS
UsbGetReportDescriptor (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 InterfaceNum,
IN UINT16 DescriptorSize,
OUT UINT8 *DescriptorBuffer
);
EFI_STATUS
UsbGetProtocolRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 Interface,
IN UINT8 *Protocol
);
EFI_STATUS
UsbSetProtocolRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 Interface,
IN UINT8 Protocol
);
EFI_STATUS
UsbSetIdleRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 Interface,
IN UINT8 ReportId,
IN UINT8 Duration
);
EFI_STATUS
UsbGetIdleRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 Interface,
IN UINT8 ReportId,
OUT UINT8 *Duration
);
EFI_STATUS
UsbSetReportRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 Interface,
IN UINT8 ReportId,
IN UINT8 ReportType,
IN UINT16 ReportLen,
IN UINT8 *Report
);
EFI_STATUS
UsbGetReportRequest (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 Interface,
IN UINT8 ReportId,
IN UINT8 ReportType,
IN UINT16 ReportLen,
IN UINT8 *Report
);
typedef enum {
EfiUsbEndpointHalt,
EfiUsbDeviceRemoteWakeup
} EFI_USB_STANDARD_FEATURE_SELECTOR;
EFI_STATUS
UsbGetDescriptor (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT16 Value,
IN UINT16 Index,
IN UINT16 DescriptorLength,
OUT VOID *Descriptor,
OUT UINT32 *Status
);
EFI_STATUS
UsbSetDescriptor (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT16 Value,
IN UINT16 Index,
IN UINT16 DescriptorLength,
IN VOID *Descriptor,
OUT UINT32 *Status
);
EFI_STATUS
UsbGetInterface (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT16 Index,
OUT UINT8 *AltSetting,
OUT UINT32 *Status
);
EFI_STATUS
UsbSetInterface (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT16 InterfaceNo,
IN UINT16 AltSetting,
OUT UINT32 *Status
);
EFI_STATUS
UsbGetConfiguration (
IN EFI_USB_IO_PROTOCOL *UsbIo,
OUT UINT8 *ConfigValue,
OUT UINT32 *Status
);
EFI_STATUS
UsbSetConfiguration (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT16 Value,
OUT UINT32 *Status
);
EFI_STATUS
UsbSetFeature (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINTN Recipient,
IN UINT16 Value,
IN UINT16 Target,
OUT UINT32 *Status
);
EFI_STATUS
UsbClearFeature (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINTN Recipient,
IN UINT16 Value,
IN UINT16 Target,
OUT UINT32 *Status
);
EFI_STATUS
UsbGetStatus (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINTN Recipient,
IN UINT16 Target,
OUT UINT16 *DevStatus,
OUT UINT32 *Status
);
EFI_STATUS
UsbGetHubDescriptor (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT16 Value,
IN UINT16 Index,
IN UINT16 DescriptorLength,
OUT VOID *Descriptor,
OUT UINT32 *Status
);
//
// Clear endpoint stall
//
EFI_STATUS
UsbClearEndpointHalt (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 EndpointNo,
OUT UINT32 *Status
);
#endif