TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbFunctionIo.h
Go to the documentation of this file.
1
22#ifndef __USB_FUNCTION_IO_H__
23#define __USB_FUNCTION_IO_H__
24
25#include <Protocol/UsbIo.h>
26
27#define EFI_USBFN_IO_PROTOCOL_GUID \
28 { \
29 0x32d2963a, 0xfe5d, 0x4f30, {0xb6, 0x33, 0x6e, 0x5d, 0xc5, 0x58, 0x3, 0xcc} \
30 }
31
33
34#define EFI_USBFN_IO_PROTOCOL_REVISION 0x00010001
35
36typedef enum _EFI_USBFN_PORT_TYPE {
37 EfiUsbUnknownPort = 0,
38 EfiUsbStandardDownstreamPort,
39 EfiUsbChargingDownstreamPort,
40 EfiUsbDedicatedChargingPort,
41 EfiUsbInvalidDedicatedChargingPort
42} EFI_USBFN_PORT_TYPE;
43
44typedef struct {
45 EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor;
46 EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptorTable;
48
49typedef struct {
50 EFI_USB_CONFIG_DESCRIPTOR *ConfigDescriptor;
51 EFI_USB_INTERFACE_INFO **InterfaceInfoTable;
53
54typedef struct {
55 EFI_USB_DEVICE_DESCRIPTOR *DeviceDescriptor;
56 EFI_USB_CONFIG_INFO **ConfigInfoTable;
58
59typedef enum _EFI_USB_ENDPOINT_TYPE {
60 UsbEndpointControl = 0x00,
61 // UsbEndpointIsochronous = 0x01,
62 UsbEndpointBulk = 0x02,
63 // UsbEndpointInterrupt = 0x03
64} EFI_USB_ENDPOINT_TYPE;
65
66typedef enum _EFI_USBFN_DEVICE_INFO_ID {
67 EfiUsbDeviceInfoUnknown = 0,
68 EfiUsbDeviceInfoSerialNumber,
69 EfiUsbDeviceInfoManufacturerName,
70 EfiUsbDeviceInfoProductName
71} EFI_USBFN_DEVICE_INFO_ID;
72
73typedef enum _EFI_USBFN_ENDPOINT_DIRECTION {
74 EfiUsbEndpointDirectionHostOut = 0,
75 EfiUsbEndpointDirectionHostIn,
76 EfiUsbEndpointDirectionDeviceTx = EfiUsbEndpointDirectionHostIn,
77 EfiUsbEndpointDirectionDeviceRx = EfiUsbEndpointDirectionHostOut
78} EFI_USBFN_ENDPOINT_DIRECTION;
79
80typedef enum _EFI_USBFN_MESSAGE {
81 //
82 // Nothing
83 //
84 EfiUsbMsgNone = 0,
85 //
86 // SETUP packet is received, returned Buffer contains
87 // EFI_USB_DEVICE_REQUEST struct
88 //
89 EfiUsbMsgSetupPacket,
90 //
91 // Indicates that some of the requested data has been received from the
92 // host. It is the responsibility of the class driver to determine if it
93 // needs to wait for any remaining data. Returned Buffer contains
94 // EFI_USBFN_TRANSFER_RESULT struct containing endpoint number, transfer
95 // status and count of bytes received.
96 //
97 EfiUsbMsgEndpointStatusChangedRx,
98 //
99 // Indicates that some of the requested data has been transmitted to the
100 // host. It is the responsibility of the class driver to determine if any
101 // remaining data needs to be resent. Returned Buffer contains
102 // EFI_USBFN_TRANSFER_RESULT struct containing endpoint number, transfer
103 // status and count of bytes sent.
104 //
105 EfiUsbMsgEndpointStatusChangedTx,
106 //
107 // DETACH bus event signaled
108 //
109 EfiUsbMsgBusEventDetach,
110 //
111 // ATTACH bus event signaled
112 //
113 EfiUsbMsgBusEventAttach,
114 //
115 // RESET bus event signaled
116 //
117 EfiUsbMsgBusEventReset,
118 //
119 // SUSPEND bus event signaled
120 //
121 EfiUsbMsgBusEventSuspend,
122 //
123 // RESUME bus event signaled
124 //
125 EfiUsbMsgBusEventResume,
126 //
127 // Bus speed updated, returned buffer indicated bus speed using
128 // following enumeration named EFI_USB_BUS_SPEED
129 //
130 EfiUsbMsgBusEventSpeed
131} EFI_USBFN_MESSAGE;
132
133typedef enum _EFI_USBFN_TRANSFER_STATUS {
134 UsbTransferStatusUnknown = 0,
135 UsbTransferStatusComplete,
136 UsbTransferStatusAborted,
137 UsbTransferStatusActive,
138 UsbTransferStatusNone
139} EFI_USBFN_TRANSFER_STATUS;
140
142 UINTN BytesTransferred;
143 EFI_USBFN_TRANSFER_STATUS TransferStatus;
144 UINT8 EndpointIndex;
145 EFI_USBFN_ENDPOINT_DIRECTION Direction;
146 VOID *Buffer;
148
149typedef enum _EFI_USB_BUS_SPEED {
150 UsbBusSpeedUnknown = 0,
151 UsbBusSpeedLow,
152 UsbBusSpeedFull,
153 UsbBusSpeedHigh,
154 UsbBusSpeedSuper,
155 UsbBusSpeedMaximum = UsbBusSpeedSuper
156} EFI_USB_BUS_SPEED;
157
161 EFI_USB_BUS_SPEED ubs;
163
164typedef enum _EFI_USBFN_POLICY_TYPE {
165 EfiUsbPolicyUndefined = 0,
166 EfiUsbPolicyMaxTransactionSize,
167 EfiUsbPolicyZeroLengthTerminationSupport,
168 EfiUsbPolicyZeroLengthTermination
169} EFI_USBFN_POLICY_TYPE;
170
185typedef
189 OUT EFI_USBFN_PORT_TYPE *PortType
190 );
191
215typedef
219 OUT EFI_USB_DEVICE_INFO *DeviceInfo
220 );
221
245typedef
249 IN EFI_USB_ENDPOINT_TYPE EndpointType,
250 IN EFI_USB_BUS_SPEED BusSpeed,
251 OUT UINT16 *MaxPacketSize
252 );
253
282typedef
286 IN EFI_USBFN_DEVICE_INFO_ID Id,
287 IN OUT UINTN *BufferSize,
288 OUT VOID *Buffer OPTIONAL
289 );
290
303typedef
307 OUT UINT16 *Vid,
308 OUT UINT16 *Pid
309 );
310
329typedef
333 IN UINT8 EndpointIndex,
334 IN EFI_USBFN_ENDPOINT_DIRECTION Direction
335 );
336
356typedef
360 IN UINT8 EndpointIndex,
361 IN EFI_USBFN_ENDPOINT_DIRECTION Direction,
362 IN OUT BOOLEAN *State
363 );
364
385typedef
389 IN UINT8 EndpointIndex,
390 IN EFI_USBFN_ENDPOINT_DIRECTION Direction,
391 IN OUT BOOLEAN *State
392 );
393
420typedef
424 OUT EFI_USBFN_MESSAGE *Message,
425 IN OUT UINTN *PayloadSize,
427 );
428
468typedef
470(EFIAPI *EFI_USBFN_IO_TRANSFER)(
472 IN UINT8 EndpointIndex,
473 IN EFI_USBFN_ENDPOINT_DIRECTION Direction,
474 IN OUT UINTN *BufferSize,
475 IN OUT VOID *Buffer
476 );
477
494typedef
498 OUT UINTN *MaxTransferSize
499 );
500
522typedef
526 IN UINTN Size,
527 OUT VOID **Buffer
528 );
529
545typedef
549 IN VOID *Buffer
550 );
551
564typedef
568 );
569
580typedef
584 );
585
609typedef
613 IN UINT8 EndpointIndex,
614 IN EFI_USBFN_ENDPOINT_DIRECTION Direction,
615 IN EFI_USBFN_POLICY_TYPE PolicyType,
616 IN UINTN BufferSize,
617 IN VOID *Buffer
618 );
619
645typedef
649 IN UINT8 EndpointIndex,
650 IN EFI_USBFN_ENDPOINT_DIRECTION Direction,
651 IN EFI_USBFN_POLICY_TYPE PolicyType,
652 IN OUT UINTN *BufferSize,
653 IN OUT VOID *Buffer
654 );
655
661 UINT32 Revision;
662 EFI_USBFN_IO_DETECT_PORT DetectPort;
663 EFI_USBFN_IO_CONFIGURE_ENABLE_ENDPOINTS ConfigureEnableEndpoints;
664 EFI_USBFN_IO_GET_ENDPOINT_MAXPACKET_SIZE GetEndpointMaxPacketSize;
665 EFI_USBFN_IO_GET_DEVICE_INFO GetDeviceInfo;
666 EFI_USBFN_IO_GET_VENDOR_ID_PRODUCT_ID GetVendorIdProductId;
667 EFI_USBFN_IO_ABORT_TRANSFER AbortTransfer;
668 EFI_USBFN_IO_GET_ENDPOINT_STALL_STATE GetEndpointStallState;
669 EFI_USBFN_IO_SET_ENDPOINT_STALL_STATE SetEndpointStallState;
670 EFI_USBFN_IO_EVENTHANDLER EventHandler;
671 EFI_USBFN_IO_TRANSFER Transfer;
672 EFI_USBFN_IO_GET_MAXTRANSFER_SIZE GetMaxTransferSize;
673 EFI_USBFN_IO_ALLOCATE_TRANSFER_BUFFER AllocateTransferBuffer;
674 EFI_USBFN_IO_FREE_TRANSFER_BUFFER FreeTransferBuffer;
675 EFI_USBFN_IO_START_CONTROLLER StartController;
676 EFI_USBFN_IO_STOP_CONTROLLER StopController;
677 EFI_USBFN_IO_SET_ENDPOINT_POLICY SetEndpointPolicy;
678 EFI_USBFN_IO_GET_ENDPOINT_POLICY GetEndpointPolicy;
679};
680
681extern EFI_GUID gEfiUsbFunctionIoProtocolGuid;
682
683#endif
UINT64 UINTN
#define OPTIONAL
Definition: Base.h:290
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
EFI_STATUS(EFIAPI * EFI_USBFN_IO_GET_ENDPOINT_STALL_STATE)(IN EFI_USBFN_IO_PROTOCOL *This, IN UINT8 EndpointIndex, IN EFI_USBFN_ENDPOINT_DIRECTION Direction, IN OUT BOOLEAN *State)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_GET_ENDPOINT_POLICY)(IN EFI_USBFN_IO_PROTOCOL *This, IN UINT8 EndpointIndex, IN EFI_USBFN_ENDPOINT_DIRECTION Direction, IN EFI_USBFN_POLICY_TYPE PolicyType, IN OUT UINTN *BufferSize, IN OUT VOID *Buffer)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_ALLOCATE_TRANSFER_BUFFER)(IN EFI_USBFN_IO_PROTOCOL *This, IN UINTN Size, OUT VOID **Buffer)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_STOP_CONTROLLER)(IN EFI_USBFN_IO_PROTOCOL *This)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_CONFIGURE_ENABLE_ENDPOINTS)(IN EFI_USBFN_IO_PROTOCOL *This, OUT EFI_USB_DEVICE_INFO *DeviceInfo)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_SET_ENDPOINT_STALL_STATE)(IN EFI_USBFN_IO_PROTOCOL *This, IN UINT8 EndpointIndex, IN EFI_USBFN_ENDPOINT_DIRECTION Direction, IN OUT BOOLEAN *State)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_DETECT_PORT)(IN EFI_USBFN_IO_PROTOCOL *This, OUT EFI_USBFN_PORT_TYPE *PortType)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_ABORT_TRANSFER)(IN EFI_USBFN_IO_PROTOCOL *This, IN UINT8 EndpointIndex, IN EFI_USBFN_ENDPOINT_DIRECTION Direction)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_TRANSFER)(IN EFI_USBFN_IO_PROTOCOL *This, IN UINT8 EndpointIndex, IN EFI_USBFN_ENDPOINT_DIRECTION Direction, IN OUT UINTN *BufferSize, IN OUT VOID *Buffer)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_GET_VENDOR_ID_PRODUCT_ID)(IN EFI_USBFN_IO_PROTOCOL *This, OUT UINT16 *Vid, OUT UINT16 *Pid)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_FREE_TRANSFER_BUFFER)(IN EFI_USBFN_IO_PROTOCOL *This, IN VOID *Buffer)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_GET_MAXTRANSFER_SIZE)(IN EFI_USBFN_IO_PROTOCOL *This, OUT UINTN *MaxTransferSize)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_EVENTHANDLER)(IN EFI_USBFN_IO_PROTOCOL *This, OUT EFI_USBFN_MESSAGE *Message, IN OUT UINTN *PayloadSize, OUT EFI_USBFN_MESSAGE_PAYLOAD *Payload)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_START_CONTROLLER)(IN EFI_USBFN_IO_PROTOCOL *This)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_SET_ENDPOINT_POLICY)(IN EFI_USBFN_IO_PROTOCOL *This, IN UINT8 EndpointIndex, IN EFI_USBFN_ENDPOINT_DIRECTION Direction, IN EFI_USBFN_POLICY_TYPE PolicyType, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_GET_ENDPOINT_MAXPACKET_SIZE)(IN EFI_USBFN_IO_PROTOCOL *This, IN EFI_USB_ENDPOINT_TYPE EndpointType, IN EFI_USB_BUS_SPEED BusSpeed, OUT UINT16 *MaxPacketSize)
EFI_STATUS(EFIAPI * EFI_USBFN_IO_GET_DEVICE_INFO)(IN EFI_USBFN_IO_PROTOCOL *This, IN EFI_USBFN_DEVICE_INFO_ID Id, IN OUT UINTN *BufferSize, OUT VOID *Buffer OPTIONAL)
Definition: Base.h:213