]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Include/Protocol/UsbDevice.h
BaseTools/Capsule: Do not support -o with --dump-info
[mirror_edk2.git] / EmbeddedPkg / Include / Protocol / UsbDevice.h
CommitLineData
d972f80b
OM
1/** @file\r
2\r
3 Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>\r
4\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __USB_DEVICE_PROTOCOL_H__\r
16#define __USB_DEVICE_PROTOCOL_H__\r
17\r
18#include <IndustryStandard/Usb.h>\r
19\r
20extern EFI_GUID gUsbDeviceProtocolGuid;\r
21\r
22/*\r
23 * Note: This Protocol is just the bare minimum for Android Fastboot. It\r
24 * only makes sense for devices that only do Bulk Transfers and only have one\r
25 * endpoint.\r
26 */\r
27\r
28/*\r
29 Callback to be called when data is received.\r
30 Buffer is callee-allocated and it's the caller's responsibility to free it with\r
31 FreePool.\r
32\r
33 @param[in] Size Size in bytes of data.\r
34 @param[in] Buffer Pointer to data.\r
35*/\r
36typedef\r
37VOID\r
38(*USB_DEVICE_RX_CALLBACK) (\r
39 IN UINTN Size,\r
40 IN VOID *Buffer\r
41 );\r
42\r
43/*\r
44 Callback to be called when the host asks for data by sending an IN token\r
45 (excluding during the data stage of a control transfer).\r
46 When this function is called, data previously buffered by calling Send() has\r
47 been sent.\r
48\r
49 @param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of\r
50 the endpoint the IN token was sent to.\r
51*/\r
52typedef\r
53VOID\r
54(*USB_DEVICE_TX_CALLBACK) (\r
55 IN UINT8 EndpointIndex\r
56 );\r
57\r
58/*\r
59 Put data in the Tx buffer to be sent on the next IN token.\r
60 Don't call this function again until the TxCallback has been called.\r
61\r
62 @param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of\r
63 the endpoint to send the data from.\r
64 @param[in]Size Size in bytes of data.\r
65 @param[in]Buffer Pointer to data.\r
66\r
67 @retval EFI_SUCCESS The data was queued successfully.\r
68 @retval EFI_INVALID_PARAMETER There was an error sending the data.\r
69*/\r
70typedef\r
71EFI_STATUS\r
72(*USB_DEVICE_SEND) (\r
73 IN UINT8 EndpointIndex,\r
74 IN UINTN Size,\r
75 IN CONST VOID *Buffer\r
76 );\r
77\r
78/*\r
79 Restart the USB peripheral controller and respond to enumeration.\r
80\r
81 @param[in] DeviceDescriptor pointer to device descriptor\r
82 @param[in] Descriptors Array of pointers to buffers, where\r
83 Descriptors[n] contains the response to a\r
84 GET_DESCRIPTOR request for configuration n. From\r
85 USB Spec section 9.4.3:\r
86 "The first interface descriptor follows the\r
87 configuration descriptor. The endpoint\r
88 descriptors for the first interface follow the\r
89 first interface descriptor. If there are\r
90 additional interfaces, their interface\r
91 descriptor and endpoint descriptors follow the\r
92 first interface’s endpoint descriptors".\r
93\r
94 The size of each buffer is the TotalLength\r
95 member of the Configuration Descriptor.\r
96\r
97 The size of the array is\r
98 DeviceDescriptor->NumConfigurations.\r
99 @param[in]RxCallback See USB_DEVICE_RX_CALLBACK\r
100 @param[in]TxCallback See USB_DEVICE_TX_CALLBACK\r
101*/\r
102typedef\r
103EFI_STATUS\r
104(*USB_DEVICE_START) (\r
105 IN USB_DEVICE_DESCRIPTOR *DeviceDescriptor,\r
106 IN VOID **Descriptors,\r
107 IN USB_DEVICE_RX_CALLBACK RxCallback,\r
108 IN USB_DEVICE_TX_CALLBACK TxCallback\r
109 );\r
110\r
111struct _USB_DEVICE_PROTOCOL {\r
112 USB_DEVICE_START Start;\r
113 USB_DEVICE_SEND Send;\r
114};\r
115\r
116typedef struct _USB_DEVICE_PROTOCOL USB_DEVICE_PROTOCOL;\r
117\r
118#endif //ifndef __USB_DEVICE_PROTOCOL_H__\r