]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmbeddedPkg/UsbDevice.h: Introduced USB Device Protocol
authorOlivier Martin <olivier.martin@arm.com>
Wed, 5 Mar 2014 04:31:04 +0000 (04:31 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 5 Mar 2014 04:31:04 +0000 (04:31 +0000)
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

EmbeddedPkg/EmbeddedPkg.dec
EmbeddedPkg/Include/Protocol/UsbDevice.h [new file with mode: 0644]

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