3 Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __USB_DEVICE_PROTOCOL_H__
10 #define __USB_DEVICE_PROTOCOL_H__
12 #include <IndustryStandard/Usb.h>
14 extern EFI_GUID gUsbDeviceProtocolGuid
;
17 * Note: This Protocol is just the bare minimum for Android Fastboot. It
18 * only makes sense for devices that only do Bulk Transfers and only have one
23 Callback to be called when data is received.
24 Buffer is callee-allocated and it's the caller's responsibility to free it with
27 @param[in] Size Size in bytes of data.
28 @param[in] Buffer Pointer to data.
32 (*USB_DEVICE_RX_CALLBACK
) (
38 Callback to be called when the host asks for data by sending an IN token
39 (excluding during the data stage of a control transfer).
40 When this function is called, data previously buffered by calling Send() has
43 @param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of
44 the endpoint the IN token was sent to.
48 (*USB_DEVICE_TX_CALLBACK
) (
49 IN UINT8 EndpointIndex
53 Put data in the Tx buffer to be sent on the next IN token.
54 Don't call this function again until the TxCallback has been called.
56 @param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of
57 the endpoint to send the data from.
58 @param[in]Size Size in bytes of data.
59 @param[in]Buffer Pointer to data.
61 @retval EFI_SUCCESS The data was queued successfully.
62 @retval EFI_INVALID_PARAMETER There was an error sending the data.
67 IN UINT8 EndpointIndex
,
73 Restart the USB peripheral controller and respond to enumeration.
75 @param[in] DeviceDescriptor pointer to device descriptor
76 @param[in] Descriptors Array of pointers to buffers, where
77 Descriptors[n] contains the response to a
78 GET_DESCRIPTOR request for configuration n. From
79 USB Spec section 9.4.3:
80 "The first interface descriptor follows the
81 configuration descriptor. The endpoint
82 descriptors for the first interface follow the
83 first interface descriptor. If there are
84 additional interfaces, their interface
85 descriptor and endpoint descriptors follow the
86 first interface’s endpoint descriptors".
88 The size of each buffer is the TotalLength
89 member of the Configuration Descriptor.
91 The size of the array is
92 DeviceDescriptor->NumConfigurations.
93 @param[in]RxCallback See USB_DEVICE_RX_CALLBACK
94 @param[in]TxCallback See USB_DEVICE_TX_CALLBACK
99 IN USB_DEVICE_DESCRIPTOR
*DeviceDescriptor
,
100 IN VOID
**Descriptors
,
101 IN USB_DEVICE_RX_CALLBACK RxCallback
,
102 IN USB_DEVICE_TX_CALLBACK TxCallback
105 struct _USB_DEVICE_PROTOCOL
{
106 USB_DEVICE_START Start
;
107 USB_DEVICE_SEND Send
;
110 typedef struct _USB_DEVICE_PROTOCOL USB_DEVICE_PROTOCOL
;
112 #endif //ifndef __USB_DEVICE_PROTOCOL_H__