UsbDesc.h revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/** @file
Manage Usb Descriptor List
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
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
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_DESCRIPTOR_H_
#define _USB_DESCRIPTOR_H_
#define USB_MAX_INTERFACE_SETTING 8
//
// The RequestType in EFI_USB_DEVICE_REQUEST is composed of
// three fields: One bit direction, 2 bit type, and 5 bit
// target.
//
//
// A common header for usb standard descriptor.
// Each stand descriptor has a length and type.
//
#pragma pack(1)
typedef struct {
#pragma pack()
//
// Each USB device has a device descriptor. Each device may
// have several configures. Each configure contains several
// interfaces. Each interface may have several settings. Each
// setting has several endpoints.
//
// EFI_USB_..._DESCRIPTOR must be the first member of the
// structure.
//
typedef struct {
typedef struct {
//
// An interface may have several settings. Use a
// fixed max number of settings to simplify code.
// It should sufice in most environments.
//
typedef struct {
typedef struct {
typedef struct {
/**
USB standard control transfer support routine. This
function is used by USB device. It is possible that
the device's interfaces are still waiting to be
enumerated.
@param UsbDev The usb device.
@param Direction The direction of data transfer.
@param Type Standard / class specific / vendor specific.
@param Target The receiving target.
@param Request Which request.
@param Value The wValue parameter of the request.
@param Index The wIndex parameter of the request.
@param Buf The buffer to receive data into / transmit from.
@param Length The length of the buffer.
@retval EFI_SUCCESS The control request is executed.
@retval EFI_DEVICE_ERROR Failed to execute the control transfer.
**/
);
/**
Return the max packet size for endpoint zero. This function
is the first function called to get descriptors during bus
enumeration.
@param UsbDev The usb device.
@retval EFI_SUCCESS The max packet size of endpoint zero is retrieved.
@retval EFI_DEVICE_ERROR Failed to retrieve it.
**/
);
/**
Free a device descriptor with its configurations.
@param DevDesc The device descriptor.
@return None.
**/
);
/**
Retrieve the indexed string for the language. It requires two
steps to get a string, first to get the string's length. Then
the string itself.
@param UsbDev The usb device.
@param StringIndex The index of the string to retrieve.
@param LangId Language ID.
@return The created string descriptor or NULL.
**/
);
/**
Build the whole array of descriptors. This function must
be called after UsbGetMaxPacketSize0 returns the max packet
size correctly for endpoint 0.
@param UsbDev The Usb device.
@retval EFI_SUCCESS The descriptor table is build.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource for the descriptor.
**/
);
/**
Set the device's address.
@param UsbDev The device to set address to.
@param Address The address to set.
@retval EFI_SUCCESS The device is set to the address.
@retval Others Failed to set the device address.
**/
);
/**
Set the device's configuration. This function changes
the device's internal state. UsbSelectConfig changes
the Usb bus's internal state.
@param UsbDev The USB device to set configure to.
@param ConfigIndex The configure index to set.
@retval EFI_SUCCESS The device is configured now.
@retval Others Failed to set the device configure.
**/
);
/**
Usb UsbIo interface to clear the feature. This is should
only be used by HUB which is considered a device driver
on top of the UsbIo interface.
@param UsbIo The UsbIo interface.
@param Feature The feature to clear.
@param Index The wIndex parameter.
@retval EFI_SUCCESS The device feature is cleared.
@retval Others Failed to clear the feature.
**/
);
#endif