mirror of https://github.com/acidanthera/audk.git
EmbeddedPkg/UsbDevice.h: Introduced USB Device Protocol
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15313 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
f6755908de
commit
d972f80b08
|
@ -60,6 +60,7 @@
|
||||||
gEfiMmcHostProtocolGuid = { 0x3e591c00, 0x9e4a, 0x11df, {0x92, 0x44, 0x00, 0x02, 0xA5, 0xD5, 0xC5, 0x1B }}
|
gEfiMmcHostProtocolGuid = { 0x3e591c00, 0x9e4a, 0x11df, {0x92, 0x44, 0x00, 0x02, 0xA5, 0xD5, 0xC5, 0x1B }}
|
||||||
gAndroidFastbootTransportProtocolGuid = { 0x74bd9fe0, 0x8902, 0x11e3, {0xb9, 0xd3, 0xf7, 0x22, 0x38, 0xfc, 0x9a, 0x31}}
|
gAndroidFastbootTransportProtocolGuid = { 0x74bd9fe0, 0x8902, 0x11e3, {0xb9, 0xd3, 0xf7, 0x22, 0x38, 0xfc, 0x9a, 0x31}}
|
||||||
gAndroidFastbootPlatformProtocolGuid = { 0x524685a0, 0x89a0, 0x11e3, {0x9d, 0x4d, 0xbf, 0xa9, 0xf6, 0xa4, 0x03, 0x08}}
|
gAndroidFastbootPlatformProtocolGuid = { 0x524685a0, 0x89a0, 0x11e3, {0x9d, 0x4d, 0xbf, 0xa9, 0xf6, 0xa4, 0x03, 0x08}}
|
||||||
|
gUsbDeviceProtocolGuid = { 0x021bd2ca, 0x51d2, 0x11e3, {0x8e, 0x56, 0xb7, 0x54, 0x17, 0xc7, 0x0b, 0x44 }}
|
||||||
|
|
||||||
[PcdsFeatureFlag.common]
|
[PcdsFeatureFlag.common]
|
||||||
gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|FALSE|BOOLEAN|0x00000001
|
gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|FALSE|BOOLEAN|0x00000001
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
/** @file
|
||||||
|
|
||||||
|
Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
|
||||||
|
|
||||||
|
This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef __USB_DEVICE_PROTOCOL_H__
|
||||||
|
#define __USB_DEVICE_PROTOCOL_H__
|
||||||
|
|
||||||
|
#include <IndustryStandard/Usb.h>
|
||||||
|
|
||||||
|
extern EFI_GUID gUsbDeviceProtocolGuid;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: This Protocol is just the bare minimum for Android Fastboot. It
|
||||||
|
* only makes sense for devices that only do Bulk Transfers and only have one
|
||||||
|
* endpoint.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Callback to be called when data is received.
|
||||||
|
Buffer is callee-allocated and it's the caller's responsibility to free it with
|
||||||
|
FreePool.
|
||||||
|
|
||||||
|
@param[in] Size Size in bytes of data.
|
||||||
|
@param[in] Buffer Pointer to data.
|
||||||
|
*/
|
||||||
|
typedef
|
||||||
|
VOID
|
||||||
|
(*USB_DEVICE_RX_CALLBACK) (
|
||||||
|
IN UINTN Size,
|
||||||
|
IN VOID *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Callback to be called when the host asks for data by sending an IN token
|
||||||
|
(excluding during the data stage of a control transfer).
|
||||||
|
When this function is called, data previously buffered by calling Send() has
|
||||||
|
been sent.
|
||||||
|
|
||||||
|
@param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of
|
||||||
|
the endpoint the IN token was sent to.
|
||||||
|
*/
|
||||||
|
typedef
|
||||||
|
VOID
|
||||||
|
(*USB_DEVICE_TX_CALLBACK) (
|
||||||
|
IN UINT8 EndpointIndex
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Put data in the Tx buffer to be sent on the next IN token.
|
||||||
|
Don't call this function again until the TxCallback has been called.
|
||||||
|
|
||||||
|
@param[in]Endpoint Endpoint index, as specified in endpoint descriptors, of
|
||||||
|
the endpoint to send the data from.
|
||||||
|
@param[in]Size Size in bytes of data.
|
||||||
|
@param[in]Buffer Pointer to data.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The data was queued successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER There was an error sending the data.
|
||||||
|
*/
|
||||||
|
typedef
|
||||||
|
EFI_STATUS
|
||||||
|
(*USB_DEVICE_SEND) (
|
||||||
|
IN UINT8 EndpointIndex,
|
||||||
|
IN UINTN Size,
|
||||||
|
IN CONST VOID *Buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Restart the USB peripheral controller and respond to enumeration.
|
||||||
|
|
||||||
|
@param[in] DeviceDescriptor pointer to device descriptor
|
||||||
|
@param[in] Descriptors Array of pointers to buffers, where
|
||||||
|
Descriptors[n] contains the response to a
|
||||||
|
GET_DESCRIPTOR request for configuration n. From
|
||||||
|
USB Spec section 9.4.3:
|
||||||
|
"The first interface descriptor follows the
|
||||||
|
configuration descriptor. The endpoint
|
||||||
|
descriptors for the first interface follow the
|
||||||
|
first interface descriptor. If there are
|
||||||
|
additional interfaces, their interface
|
||||||
|
descriptor and endpoint descriptors follow the
|
||||||
|
first interface’s endpoint descriptors".
|
||||||
|
|
||||||
|
The size of each buffer is the TotalLength
|
||||||
|
member of the Configuration Descriptor.
|
||||||
|
|
||||||
|
The size of the array is
|
||||||
|
DeviceDescriptor->NumConfigurations.
|
||||||
|
@param[in]RxCallback See USB_DEVICE_RX_CALLBACK
|
||||||
|
@param[in]TxCallback See USB_DEVICE_TX_CALLBACK
|
||||||
|
*/
|
||||||
|
typedef
|
||||||
|
EFI_STATUS
|
||||||
|
(*USB_DEVICE_START) (
|
||||||
|
IN USB_DEVICE_DESCRIPTOR *DeviceDescriptor,
|
||||||
|
IN VOID **Descriptors,
|
||||||
|
IN USB_DEVICE_RX_CALLBACK RxCallback,
|
||||||
|
IN USB_DEVICE_TX_CALLBACK TxCallback
|
||||||
|
);
|
||||||
|
|
||||||
|
struct _USB_DEVICE_PROTOCOL {
|
||||||
|
USB_DEVICE_START Start;
|
||||||
|
USB_DEVICE_SEND Send;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _USB_DEVICE_PROTOCOL USB_DEVICE_PROTOCOL;
|
||||||
|
|
||||||
|
#endif //ifndef __USB_DEVICE_PROTOCOL_H__
|
Loading…
Reference in New Issue