mirror of https://github.com/acidanthera/audk.git
Update Usb.h definitions.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3163 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
97a079edfb
commit
196d5cd166
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Support for USB 1.1 standard.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
Copyright (c) 2006 - 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
|
||||
|
@ -15,233 +15,24 @@
|
|||
#ifndef __USB_H__
|
||||
#define __USB_H__
|
||||
|
||||
//
|
||||
// USB Descriptor types
|
||||
//
|
||||
#define USB_DT_DEVICE 0x01
|
||||
#define USB_DT_CONFIG 0x02
|
||||
#define USB_DT_STRING 0x03
|
||||
#define USB_DT_INTERFACE 0x04
|
||||
#define USB_DT_ENDPOINT 0x05
|
||||
#define USB_DT_HUB 0x29
|
||||
#define USB_DT_HID 0x21
|
||||
|
||||
//
|
||||
// USB request type
|
||||
// Definitions defined in UEFI spec
|
||||
//
|
||||
#define USB_TYPE_STANDARD (0x00 << 5)
|
||||
#define USB_TYPE_CLASS (0x01 << 5)
|
||||
#define USB_TYPE_VENDOR (0x02 << 5)
|
||||
#define USB_TYPE_RESERVED (0x03 << 5)
|
||||
|
||||
//
|
||||
// USB request targer device
|
||||
//
|
||||
#define USB_RECIP_DEVICE 0x00
|
||||
#define USB_RECIP_INTERFACE 0x01
|
||||
#define USB_RECIP_ENDPOINT 0x02
|
||||
#define USB_RECIP_OTHER 0x03
|
||||
|
||||
//
|
||||
// Request target types.
|
||||
//
|
||||
#define USB_RT_DEVICE 0x00
|
||||
#define USB_RT_INTERFACE 0x01
|
||||
#define USB_RT_ENDPOINT 0x02
|
||||
#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
|
||||
#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
|
||||
|
||||
//
|
||||
// USB Transfer Results
|
||||
//
|
||||
#define EFI_USB_NOERROR 0x00
|
||||
#define EFI_USB_ERR_NOTEXECUTE 0x01
|
||||
#define EFI_USB_ERR_STALL 0x02
|
||||
#define EFI_USB_ERR_BUFFER 0x04
|
||||
#define EFI_USB_ERR_BABBLE 0x08
|
||||
#define EFI_USB_ERR_NAK 0x10
|
||||
#define EFI_USB_ERR_CRC 0x20
|
||||
#define EFI_USB_ERR_TIMEOUT 0x40
|
||||
#define EFI_USB_ERR_BITSTUFF 0x80
|
||||
#define EFI_USB_ERR_SYSTEM 0x100
|
||||
|
||||
//
|
||||
//Use 200 ms to increase the error handling response time
|
||||
//
|
||||
#define EFI_USB_INTERRUPT_DELAY 2000000
|
||||
|
||||
//
|
||||
// USB transation direction
|
||||
//
|
||||
typedef enum {
|
||||
EfiUsbDataIn,
|
||||
EfiUsbDataOut,
|
||||
EfiUsbNoData
|
||||
} EFI_USB_DATA_DIRECTION;
|
||||
|
||||
//
|
||||
// Usb Data recipient type
|
||||
//
|
||||
typedef enum {
|
||||
EfiUsbDevice,
|
||||
EfiUsbInterface,
|
||||
EfiUsbEndpoint
|
||||
} EFI_USB_RECIPIENT;
|
||||
|
||||
typedef enum {
|
||||
EfiUsbEndpointHalt,
|
||||
EfiUsbDeviceRemoteWakeup
|
||||
} EFI_USB_STANDARD_FEATURE_SELECTOR;
|
||||
|
||||
#pragma pack(1)
|
||||
//
|
||||
// Usb device request structure
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 RequestType;
|
||||
UINT8 Request;
|
||||
UINT16 Value;
|
||||
UINT16 Index;
|
||||
UINT16 Length;
|
||||
} EFI_USB_DEVICE_REQUEST;
|
||||
|
||||
//
|
||||
// Standard USB request
|
||||
//
|
||||
#define USB_DEV_GET_STATUS 0x00
|
||||
|
||||
#define USB_DEV_CLEAR_FEATURE 0x01
|
||||
|
||||
#define USB_DEV_SET_FEATURE 0x03
|
||||
|
||||
#define USB_DEV_SET_ADDRESS 0x05
|
||||
#define USB_DEV_SET_ADDRESS_REQ_TYPE 0x00
|
||||
|
||||
#define USB_DEV_GET_DESCRIPTOR 0x06
|
||||
#define USB_DEV_GET_DESCRIPTOR_REQ_TYPE 0x80
|
||||
|
||||
#define USB_DEV_SET_DESCRIPTOR 0x07
|
||||
#define USB_DEV_SET_DESCRIPTOR_REQ_TYPE 0x00
|
||||
|
||||
#define USB_DEV_GET_CONFIGURATION 0x08
|
||||
#define USB_DEV_GET_CONFIGURATION_REQ_TYPE 0x80
|
||||
|
||||
#define USB_DEV_SET_CONFIGURATION 0x09
|
||||
#define USB_DEV_SET_CONFIGURATION_REQ_TYPE 0x00
|
||||
|
||||
#define USB_DEV_GET_INTERFACE 0x0A
|
||||
#define USB_DEV_GET_INTERFACE_REQ_TYPE 0x81
|
||||
|
||||
#define USB_DEV_SET_INTERFACE 0x0B
|
||||
#define USB_DEV_SET_INTERFACE_REQ_TYPE 0x01
|
||||
|
||||
#define USB_DEV_SYNCH_FRAME 0x0C
|
||||
#define USB_DEV_SYNCH_FRAME_REQ_TYPE 0x82
|
||||
|
||||
//
|
||||
// Device descriptor. refer USB1.1
|
||||
//
|
||||
typedef struct usb_device_descriptor {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT16 BcdUSB;
|
||||
UINT8 DeviceClass;
|
||||
UINT8 DeviceSubClass;
|
||||
UINT8 DeviceProtocol;
|
||||
UINT8 MaxPacketSize0;
|
||||
UINT16 IdVendor;
|
||||
UINT16 IdProduct;
|
||||
UINT16 BcdDevice;
|
||||
UINT8 StrManufacturer;
|
||||
UINT8 StrProduct;
|
||||
UINT8 StrSerialNumber;
|
||||
UINT8 NumConfigurations;
|
||||
} EFI_USB_DEVICE_DESCRIPTOR;
|
||||
|
||||
//
|
||||
// Endpoint descriptor
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT8 EndpointAddress;
|
||||
UINT8 Attributes;
|
||||
UINT16 MaxPacketSize;
|
||||
UINT8 Interval;
|
||||
} EFI_USB_ENDPOINT_DESCRIPTOR;
|
||||
|
||||
//
|
||||
// Interface descriptor
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT8 InterfaceNumber;
|
||||
UINT8 AlternateSetting;
|
||||
UINT8 NumEndpoints;
|
||||
UINT8 InterfaceClass;
|
||||
UINT8 InterfaceSubClass;
|
||||
UINT8 InterfaceProtocol;
|
||||
UINT8 Interface;
|
||||
} EFI_USB_INTERFACE_DESCRIPTOR;
|
||||
|
||||
//
|
||||
// USB alternate setting
|
||||
//
|
||||
typedef struct {
|
||||
EFI_USB_INTERFACE_DESCRIPTOR *Interface;
|
||||
} USB_ALT_SETTING;
|
||||
|
||||
//
|
||||
// Configuration descriptor
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT16 TotalLength;
|
||||
UINT8 NumInterfaces;
|
||||
UINT8 ConfigurationValue;
|
||||
UINT8 Configuration;
|
||||
UINT8 Attributes;
|
||||
UINT8 MaxPower;
|
||||
} EFI_USB_CONFIG_DESCRIPTOR;
|
||||
|
||||
//
|
||||
// Supported String Languages
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT16 SupportedLanID[1];
|
||||
} EFI_USB_SUPPORTED_LANGUAGES;
|
||||
|
||||
//
|
||||
// String descriptor
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
CHAR16 String[1];
|
||||
} EFI_USB_STRING_DESCRIPTOR;
|
||||
|
||||
//
|
||||
// Hub descriptor
|
||||
//
|
||||
#define MAXBYTES 8
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT8 NbrPorts;
|
||||
UINT8 HubCharacteristics[2];
|
||||
UINT8 PwrOn2PwrGood;
|
||||
UINT8 HubContrCurrent;
|
||||
UINT8 Filler[MAXBYTES];
|
||||
} EFI_USB_HUB_DESCRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
UINT16 PortStatus;
|
||||
UINT16 PortChangeStatus;
|
||||
} EFI_USB_PORT_STATUS;
|
||||
#define EFI_USB_NOERROR 0x00
|
||||
#define EFI_USB_ERR_NOTEXECUTE 0x01
|
||||
#define EFI_USB_ERR_STALL 0x02
|
||||
#define EFI_USB_ERR_BUFFER 0x04
|
||||
#define EFI_USB_ERR_BABBLE 0x08
|
||||
#define EFI_USB_ERR_NAK 0x10
|
||||
#define EFI_USB_ERR_CRC 0x20
|
||||
#define EFI_USB_ERR_TIMEOUT 0x40
|
||||
#define EFI_USB_ERR_BITSTUFF 0x80
|
||||
#define EFI_USB_ERR_SYSTEM 0x100
|
||||
|
||||
//
|
||||
// Constant value for Port Status & Port Change Status
|
||||
|
@ -263,7 +54,16 @@ typedef struct {
|
|||
#define USB_PORT_STAT_C_RESET 0x0010
|
||||
|
||||
//
|
||||
// Used for set/clear port feature request
|
||||
// USB data transfer direction
|
||||
//
|
||||
typedef enum {
|
||||
EfiUsbDataIn,
|
||||
EfiUsbDataOut,
|
||||
EfiUsbNoData
|
||||
} EFI_USB_DATA_DIRECTION;
|
||||
|
||||
//
|
||||
// Usb port features
|
||||
//
|
||||
typedef enum {
|
||||
EfiUsbPortEnable = 1,
|
||||
|
@ -278,6 +78,147 @@ typedef enum {
|
|||
EfiUsbPortResetChange = 20
|
||||
} EFI_USB_PORT_FEATURE;
|
||||
|
||||
|
||||
//
|
||||
// USB standard descriptors and reqeust
|
||||
//
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT8 RequestType;
|
||||
UINT8 Request;
|
||||
UINT16 Value;
|
||||
UINT16 Index;
|
||||
UINT16 Length;
|
||||
} EFI_USB_DEVICE_REQUEST;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT16 BcdUSB;
|
||||
UINT8 DeviceClass;
|
||||
UINT8 DeviceSubClass;
|
||||
UINT8 DeviceProtocol;
|
||||
UINT8 MaxPacketSize0;
|
||||
UINT16 IdVendor;
|
||||
UINT16 IdProduct;
|
||||
UINT16 BcdDevice;
|
||||
UINT8 StrManufacturer;
|
||||
UINT8 StrProduct;
|
||||
UINT8 StrSerialNumber;
|
||||
UINT8 NumConfigurations;
|
||||
} EFI_USB_DEVICE_DESCRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT16 TotalLength;
|
||||
UINT8 NumInterfaces;
|
||||
UINT8 ConfigurationValue;
|
||||
UINT8 Configuration;
|
||||
UINT8 Attributes;
|
||||
UINT8 MaxPower;
|
||||
} EFI_USB_CONFIG_DESCRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT8 InterfaceNumber;
|
||||
UINT8 AlternateSetting;
|
||||
UINT8 NumEndpoints;
|
||||
UINT8 InterfaceClass;
|
||||
UINT8 InterfaceSubClass;
|
||||
UINT8 InterfaceProtocol;
|
||||
UINT8 Interface;
|
||||
} EFI_USB_INTERFACE_DESCRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
UINT8 EndpointAddress;
|
||||
UINT8 Attributes;
|
||||
UINT16 MaxPacketSize;
|
||||
UINT8 Interval;
|
||||
} EFI_USB_ENDPOINT_DESCRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescriptorType;
|
||||
CHAR16 String[1];
|
||||
} EFI_USB_STRING_DESCRIPTOR;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
typedef struct {
|
||||
UINT16 PortStatus;
|
||||
UINT16 PortChangeStatus;
|
||||
} EFI_USB_PORT_STATUS;
|
||||
|
||||
|
||||
//
|
||||
// Following are definitions not specified by UEFI spec.
|
||||
// Add new definitions below this line
|
||||
//
|
||||
enum {
|
||||
//
|
||||
// USB request type
|
||||
//
|
||||
USB_REQ_TYPE_STANDARD = (0x00 << 5),
|
||||
USB_REQ_TYPE_CLASS = (0x01 << 5),
|
||||
USB_REQ_TYPE_VENDOR = (0x02 << 5),
|
||||
|
||||
//
|
||||
// Standard control transfer request type, or the value
|
||||
// to fill in EFI_USB_DEVICE_REQUEST.Request
|
||||
//
|
||||
USB_REQ_GET_STATUS = 0x00,
|
||||
USB_REQ_CLEAR_FEATURE = 0x01,
|
||||
USB_REQ_SET_FEATURE = 0x03,
|
||||
USB_REQ_SET_ADDRESS = 0x05,
|
||||
USB_REQ_GET_DESCRIPTOR = 0x06,
|
||||
USB_REQ_SET_DESCRIPTOR = 0x07,
|
||||
USB_REQ_GET_CONFIG = 0x08,
|
||||
USB_REQ_SET_CONFIG = 0x09,
|
||||
USB_REQ_GET_INTERFACE = 0x0A,
|
||||
USB_REQ_SET_INTERFACE = 0x0B,
|
||||
USB_REQ_SYNCH_FRAME = 0x0C,
|
||||
|
||||
//
|
||||
// Usb control transfer target
|
||||
//
|
||||
USB_TARGET_DEVICE = 0,
|
||||
USB_TARGET_INTERFACE = 0x01,
|
||||
USB_TARGET_ENDPOINT = 0x02,
|
||||
USB_TARGET_OTHER = 0x03,
|
||||
|
||||
//
|
||||
// USB Descriptor types
|
||||
//
|
||||
USB_DESC_TYPE_DEVICE = 0x01,
|
||||
USB_DESC_TYPE_CONFIG = 0x02,
|
||||
USB_DESC_TYPE_STRING = 0x03,
|
||||
USB_DESC_TYPE_INTERFACE = 0x04,
|
||||
USB_DESC_TYPE_ENDPOINT = 0x05,
|
||||
USB_DESC_TYPE_HID = 0x21,
|
||||
|
||||
//
|
||||
// Features to be cleared by CLEAR_FEATURE requests
|
||||
//
|
||||
USB_FEATURE_ENDPOINT_HALT = 0,
|
||||
|
||||
//
|
||||
// USB endpoint types: 00: control, 01: isochronous, 10: bulk, 11: interrupt
|
||||
//
|
||||
USB_ENDPOINT_CONTROL = 0x00,
|
||||
USB_ENDPOINT_ISO = 0x01,
|
||||
USB_ENDPOINT_BULK = 0x02,
|
||||
USB_ENDPOINT_INTERRUPT = 0x03,
|
||||
|
||||
USB_ENDPOINT_TYPE_MASK = 0x03,
|
||||
USB_ENDPOINT_DIR_IN = 0x80,
|
||||
|
||||
//
|
||||
//Use 200 ms to increase the error handling response time
|
||||
//
|
||||
EFI_USB_INTERRUPT_DELAY = 2000000,
|
||||
};
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue