ArmPkg: only attempt buildin MmCommunicationDxe for AArch64
[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
878b807a 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
d972f80b
OM
6\r
7**/\r
8\r
9#ifndef __USB_DEVICE_PROTOCOL_H__\r
10#define __USB_DEVICE_PROTOCOL_H__\r
11\r
12#include <IndustryStandard/Usb.h>\r
13\r
14extern EFI_GUID gUsbDeviceProtocolGuid;\r
15\r
16/*\r
17 * Note: This Protocol is just the bare minimum for Android Fastboot. It\r
18 * only makes sense for devices that only do Bulk Transfers and only have one\r
19 * endpoint.\r
20 */\r
21\r
22/*\r
23 Callback to be called when data is received.\r
24 Buffer is callee-allocated and it's the caller's responsibility to free it with\r
25 FreePool.\r
26\r
27 @param[in] Size Size in bytes of data.\r
28 @param[in] Buffer Pointer to data.\r
29*/\r
30typedef\r
31VOID\r
32(*USB_DEVICE_RX_CALLBACK) (\r
33 IN UINTN Size,\r
34 IN VOID *Buffer\r
35 );\r
36\r
37/*\r
38 Callback to be called when the host asks for data by sending an IN token\r
39 (excluding during the data stage of a control transfer).\r
40 When this function is called, data previously buffered by calling Send() has\r
41 been sent.\r
42\r
43 @param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of\r
44 the endpoint the IN token was sent to.\r
45*/\r
46typedef\r
47VOID\r
48(*USB_DEVICE_TX_CALLBACK) (\r
49 IN UINT8 EndpointIndex\r
50 );\r
51\r
52/*\r
53 Put data in the Tx buffer to be sent on the next IN token.\r
54 Don't call this function again until the TxCallback has been called.\r
55\r
56 @param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of\r
57 the endpoint to send the data from.\r
58 @param[in]Size Size in bytes of data.\r
59 @param[in]Buffer Pointer to data.\r
60\r
61 @retval EFI_SUCCESS The data was queued successfully.\r
62 @retval EFI_INVALID_PARAMETER There was an error sending the data.\r
63*/\r
64typedef\r
65EFI_STATUS\r
66(*USB_DEVICE_SEND) (\r
67 IN UINT8 EndpointIndex,\r
68 IN UINTN Size,\r
69 IN CONST VOID *Buffer\r
70 );\r
71\r
72/*\r
73 Restart the USB peripheral controller and respond to enumeration.\r
74\r
75 @param[in] DeviceDescriptor pointer to device descriptor\r
76 @param[in] Descriptors Array of pointers to buffers, where\r
77 Descriptors[n] contains the response to a\r
78 GET_DESCRIPTOR request for configuration n. From\r
79 USB Spec section 9.4.3:\r
80 "The first interface descriptor follows the\r
81 configuration descriptor. The endpoint\r
82 descriptors for the first interface follow the\r
83 first interface descriptor. If there are\r
84 additional interfaces, their interface\r
85 descriptor and endpoint descriptors follow the\r
86 first interface’s endpoint descriptors".\r
87\r
88 The size of each buffer is the TotalLength\r
89 member of the Configuration Descriptor.\r
90\r
91 The size of the array is\r
92 DeviceDescriptor->NumConfigurations.\r
93 @param[in]RxCallback See USB_DEVICE_RX_CALLBACK\r
94 @param[in]TxCallback See USB_DEVICE_TX_CALLBACK\r
95*/\r
96typedef\r
97EFI_STATUS\r
98(*USB_DEVICE_START) (\r
99 IN USB_DEVICE_DESCRIPTOR *DeviceDescriptor,\r
100 IN VOID **Descriptors,\r
101 IN USB_DEVICE_RX_CALLBACK RxCallback,\r
102 IN USB_DEVICE_TX_CALLBACK TxCallback\r
103 );\r
104\r
105struct _USB_DEVICE_PROTOCOL {\r
106 USB_DEVICE_START Start;\r
107 USB_DEVICE_SEND Send;\r
108};\r
109\r
110typedef struct _USB_DEVICE_PROTOCOL USB_DEVICE_PROTOCOL;\r
111\r
112#endif //ifndef __USB_DEVICE_PROTOCOL_H__\r