3 Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __USB_DEVICE_PROTOCOL_H__
16 #define __USB_DEVICE_PROTOCOL_H__
18 #include <IndustryStandard/Usb.h>
20 extern EFI_GUID gUsbDeviceProtocolGuid
;
23 * Note: This Protocol is just the bare minimum for Android Fastboot. It
24 * only makes sense for devices that only do Bulk Transfers and only have one
29 Callback to be called when data is received.
30 Buffer is callee-allocated and it's the caller's responsibility to free it with
33 @param[in] Size Size in bytes of data.
34 @param[in] Buffer Pointer to data.
38 (*USB_DEVICE_RX_CALLBACK
) (
44 Callback to be called when the host asks for data by sending an IN token
45 (excluding during the data stage of a control transfer).
46 When this function is called, data previously buffered by calling Send() has
49 @param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of
50 the endpoint the IN token was sent to.
54 (*USB_DEVICE_TX_CALLBACK
) (
55 IN UINT8 EndpointIndex
59 Put data in the Tx buffer to be sent on the next IN token.
60 Don't call this function again until the TxCallback has been called.
62 @param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of
63 the endpoint to send the data from.
64 @param[in]Size Size in bytes of data.
65 @param[in]Buffer Pointer to data.
67 @retval EFI_SUCCESS The data was queued successfully.
68 @retval EFI_INVALID_PARAMETER There was an error sending the data.
73 IN UINT8 EndpointIndex
,
79 Restart the USB peripheral controller and respond to enumeration.
81 @param[in] DeviceDescriptor pointer to device descriptor
82 @param[in] Descriptors Array of pointers to buffers, where
83 Descriptors[n] contains the response to a
84 GET_DESCRIPTOR request for configuration n. From
85 USB Spec section 9.4.3:
86 "The first interface descriptor follows the
87 configuration descriptor. The endpoint
88 descriptors for the first interface follow the
89 first interface descriptor. If there are
90 additional interfaces, their interface
91 descriptor and endpoint descriptors follow the
92 first interface’s endpoint descriptors".
94 The size of each buffer is the TotalLength
95 member of the Configuration Descriptor.
97 The size of the array is
98 DeviceDescriptor->NumConfigurations.
99 @param[in]RxCallback See USB_DEVICE_RX_CALLBACK
100 @param[in]TxCallback See USB_DEVICE_TX_CALLBACK
104 (*USB_DEVICE_START
) (
105 IN USB_DEVICE_DESCRIPTOR
*DeviceDescriptor
,
106 IN VOID
**Descriptors
,
107 IN USB_DEVICE_RX_CALLBACK RxCallback
,
108 IN USB_DEVICE_TX_CALLBACK TxCallback
111 struct _USB_DEVICE_PROTOCOL
{
112 USB_DEVICE_START Start
;
113 USB_DEVICE_SEND Send
;
116 typedef struct _USB_DEVICE_PROTOCOL USB_DEVICE_PROTOCOL
;
118 #endif //ifndef __USB_DEVICE_PROTOCOL_H__