2007-06-28 00:53:31 +02:00
|
|
|
/** @file
|
2007-07-12 19:31:28 +02:00
|
|
|
Common Dxe Libarary for USB
|
2007-06-19 12:55:24 +02:00
|
|
|
|
2007-06-28 00:53:31 +02:00
|
|
|
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.
|
|
|
|
|
|
|
|
**/
|
2007-06-19 12:55:24 +02:00
|
|
|
|
|
|
|
|
2007-06-28 00:53:31 +02:00
|
|
|
#ifndef __USB_DXE_LIB_H__
|
|
|
|
#define __USB_DXE_LIB_H__
|
2007-06-19 12:55:24 +02:00
|
|
|
|
2007-06-22 18:22:26 +02:00
|
|
|
#include <Protocol/UsbIo.h>
|
2007-07-12 19:31:28 +02:00
|
|
|
|
2007-06-19 12:55:24 +02:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
);
|
|
|
|
|
2007-07-12 19:31:28 +02:00
|
|
|
typedef enum {
|
|
|
|
EfiUsbEndpointHalt,
|
|
|
|
EfiUsbDeviceRemoteWakeup
|
|
|
|
} EFI_USB_STANDARD_FEATURE_SELECTOR;
|
|
|
|
|
2007-06-19 12:55:24 +02:00
|
|
|
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
|
2007-07-12 19:31:28 +02:00
|
|
|
UsbGetInterface (
|
2007-06-19 12:55:24 +02:00
|
|
|
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
|
|
|
IN UINT16 Index,
|
|
|
|
OUT UINT8 *AltSetting,
|
|
|
|
OUT UINT32 *Status
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2007-07-12 19:31:28 +02:00
|
|
|
UsbSetInterface (
|
2007-06-19 12:55:24 +02:00
|
|
|
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
|
|
|
IN UINT16 InterfaceNo,
|
|
|
|
IN UINT16 AltSetting,
|
|
|
|
OUT UINT32 *Status
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2007-07-12 19:31:28 +02:00
|
|
|
UsbGetConfiguration (
|
2007-06-19 12:55:24 +02:00
|
|
|
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
|
|
|
OUT UINT8 *ConfigValue,
|
|
|
|
OUT UINT32 *Status
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2007-07-12 19:31:28 +02:00
|
|
|
UsbSetConfiguration (
|
2007-06-19 12:55:24 +02:00
|
|
|
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
|
|
|
IN UINT16 Value,
|
|
|
|
OUT UINT32 *Status
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2007-07-12 19:31:28 +02:00
|
|
|
UsbSetFeature (
|
2007-06-19 12:55:24 +02:00
|
|
|
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
2007-07-12 19:31:28 +02:00
|
|
|
IN UINTN Recipient,
|
2007-06-19 12:55:24 +02:00
|
|
|
IN UINT16 Value,
|
|
|
|
IN UINT16 Target,
|
|
|
|
OUT UINT32 *Status
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2007-07-12 19:31:28 +02:00
|
|
|
UsbClearFeature (
|
2007-06-19 12:55:24 +02:00
|
|
|
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
2007-07-12 19:31:28 +02:00
|
|
|
IN UINTN Recipient,
|
2007-06-19 12:55:24 +02:00
|
|
|
IN UINT16 Value,
|
|
|
|
IN UINT16 Target,
|
|
|
|
OUT UINT32 *Status
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2007-07-12 19:31:28 +02:00
|
|
|
UsbGetStatus (
|
2007-06-19 12:55:24 +02:00
|
|
|
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
2007-07-12 19:31:28 +02:00
|
|
|
IN UINTN Recipient,
|
2007-06-19 12:55:24 +02:00
|
|
|
IN UINT16 Target,
|
|
|
|
OUT UINT16 *DevStatus,
|
|
|
|
OUT UINT32 *Status
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2007-07-12 19:31:28 +02:00
|
|
|
UsbGetHubDescriptor (
|
2007-06-19 12:55:24 +02:00
|
|
|
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
2007-07-12 19:31:28 +02:00
|
|
|
IN UINT16 Value,
|
|
|
|
IN UINT16 Index,
|
|
|
|
IN UINT16 DescriptorLength,
|
|
|
|
OUT VOID *Descriptor,
|
2007-06-19 12:55:24 +02:00
|
|
|
OUT UINT32 *Status
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Clear endpoint stall
|
|
|
|
//
|
|
|
|
EFI_STATUS
|
|
|
|
UsbClearEndpointHalt (
|
|
|
|
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
|
|
|
IN UINT8 EndpointNo,
|
|
|
|
OUT UINT32 *Status
|
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|