TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbDesc.h
Go to the documentation of this file.
1
10#ifndef _USB_DESCRIPTOR_H_
11#define _USB_DESCRIPTOR_H_
12
13#define USB_MAX_INTERFACE_SETTING 256
14
15//
16// The RequestType in EFI_USB_DEVICE_REQUEST is composed of
17// three fields: One bit direction, 2 bit type, and 5 bit
18// target.
19//
20#define USB_REQUEST_TYPE(Dir, Type, Target) \
21 ((UINT8)((((Dir) == EfiUsbDataIn ? 0x01 : 0) << 7) | (Type) | (Target)))
22
23//
24// A common header for usb standard descriptor.
25// Each stand descriptor has a length and type.
26//
27#pragma pack(1)
28typedef struct {
29 UINT8 Len;
30 UINT8 Type;
32#pragma pack()
33
34//
35// Each USB device has a device descriptor. Each device may
36// have several configures. Each configure contains several
37// interfaces. Each interface may have several settings. Each
38// setting has several endpoints.
39//
40// EFI_USB_..._DESCRIPTOR must be the first member of the
41// structure.
42//
43typedef struct {
45 UINT8 Toggle;
47
48typedef struct {
50 USB_ENDPOINT_DESC **Endpoints;
52
53//
54// An interface may have several settings. Use a
55// fixed max number of settings to simplify code.
56// It should sufice in most environments.
57//
58typedef struct {
59 USB_INTERFACE_SETTING *Settings[USB_MAX_INTERFACE_SETTING];
60 UINTN NumOfSetting;
61 UINTN ActiveIndex; // Index of active setting
63
64typedef struct {
66 USB_INTERFACE_DESC **Interfaces;
68
69typedef struct {
71 USB_CONFIG_DESC **Configs;
73
96 IN USB_DEVICE *UsbDev,
97 IN EFI_USB_DATA_DIRECTION Direction,
98 IN UINTN Type,
99 IN UINTN Target,
100 IN UINTN Request,
101 IN UINT16 Value,
102 IN UINT16 Index,
103 IN OUT VOID *Buf,
104 IN UINTN Length
105 );
106
120 IN USB_DEVICE *UsbDev
121 );
122
131VOID
133 IN USB_DEVICE_DESC *DevDesc
134 );
135
150 IN USB_DEVICE *UsbDev,
151 IN UINT8 StringIndex,
152 IN UINT16 LangId
153 );
154
168 IN USB_DEVICE *UsbDev
169 );
170
183 IN USB_DEVICE *UsbDev,
184 IN UINT8 Address
185 );
186
201 IN USB_DEVICE *UsbDev,
202 IN UINT8 ConfigIndex
203 );
204
221 IN EFI_USB_IO_PROTOCOL *UsbIo,
222 IN UINTN Target,
223 IN UINT16 Feature,
224 IN UINT16 Index
225 );
226
227#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_USB_DATA_DIRECTION
Definition: UsbIo.h:44
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
EFI_STATUS UsbIoClearFeature(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINTN Target, IN UINT16 Feature, IN UINT16 Index)
Definition: UsbDesc.c:983
EFI_USB_STRING_DESCRIPTOR * UsbGetOneString(IN USB_DEVICE *UsbDev, IN UINT8 StringIndex, IN UINT16 LangId)
Definition: UsbDesc.c:633
EFI_STATUS UsbBuildDescTable(IN USB_DEVICE *UsbDev)
Definition: UsbDesc.c:811
EFI_STATUS UsbSetConfig(IN USB_DEVICE *UsbDev, IN UINT8 ConfigIndex)
Definition: UsbDesc.c:946
EFI_STATUS UsbSetAddress(IN USB_DEVICE *UsbDev, IN UINT8 Address)
Definition: UsbDesc.c:911
EFI_STATUS UsbCtrlRequest(IN USB_DEVICE *UsbDev, IN EFI_USB_DATA_DIRECTION Direction, IN UINTN Type, IN UINTN Target, IN UINTN Request, IN UINT16 Value, IN UINT16 Index, IN OUT VOID *Buf, IN UINTN Length)
Definition: UsbDesc.c:451
EFI_STATUS UsbGetMaxPacketSize0(IN USB_DEVICE *UsbDev)
Definition: UsbDesc.c:548
VOID UsbFreeDevDesc(IN USB_DEVICE_DESC *DevDesc)
Definition: UsbDesc.c:101