]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassCbi.h
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMassStorageDxe / UsbMassCbi.h
CommitLineData
e237e7ae 1/** @file\r
d80ed2a7 2 Defination for the USB mass storage Control/Bulk/Interrupt (CBI) transport,\r
3 according to USB Mass Storage Class Control/Bulk/Interrupt (CBI) Transport, Revision 1.1.\r
cc5166ff 4\r
1ccdbf2a 5Copyright (c) 2007 - 2010, Intel Corporation\r
e237e7ae 6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
e237e7ae 14**/\r
15\r
16#ifndef _EFI_USBMASS_CBI_H_\r
17#define _EFI_USBMASS_CBI_H_\r
18\r
3e03cb4d 19#include "UsbMass.h"\r
20\r
d80ed2a7 21extern USB_MASS_TRANSPORT mUsbCbi0Transport;\r
22extern USB_MASS_TRANSPORT mUsbCbi1Transport;\r
23\r
1ccdbf2a 24#define USB_CBI_MAX_PACKET_NUM 16\r
25#define USB_CBI_RESET_CMD_LEN 12\r
26//\r
27// USB CBI retry C/B/I transport times, set by experience\r
28//\r
29#define USB_CBI_MAX_RETRY 3\r
30//\r
31// Time to wait for USB CBI reset to complete, set by experience\r
32// \r
33#define USB_CBI_RESET_DEVICE_STALL (50 * USB_MASS_1_MILLISECOND)\r
34//\r
35// USB CBI transport timeout, set by experience\r
36//\r
37#define USB_CBI_RESET_DEVICE_TIMEOUT (1 * USB_MASS_1_SECOND)\r
e237e7ae 38\r
e237e7ae 39typedef struct {\r
d80ed2a7 40 //\r
41 // Put Interface at the first field to make it easy to distinguish BOT/CBI Protocol instance\r
42 //\r
e237e7ae 43 EFI_USB_INTERFACE_DESCRIPTOR Interface;\r
44 EFI_USB_ENDPOINT_DESCRIPTOR *BulkInEndpoint;\r
45 EFI_USB_ENDPOINT_DESCRIPTOR *BulkOutEndpoint;\r
46 EFI_USB_ENDPOINT_DESCRIPTOR *InterruptEndpoint;\r
47 EFI_USB_IO_PROTOCOL *UsbIo;\r
48} USB_CBI_PROTOCOL;\r
49\r
50#pragma pack(1)\r
51typedef struct {\r
52 UINT8 Type;\r
53 UINT8 Value;\r
54} USB_CBI_STATUS;\r
55#pragma pack()\r
56\r
d80ed2a7 57/**\r
58 Initializes USB CBI protocol.\r
59\r
60 This function initializes the USB mass storage class CBI protocol.\r
61 It will save its context which is a USB_CBI_PROTOCOL structure\r
62 in the Context if Context isn't NULL.\r
63\r
64 @param UsbIo The USB I/O Protocol instance\r
65 @param Context The buffer to save the context to\r
66\r
67 @retval EFI_SUCCESS The device is successfully initialized.\r
68 @retval EFI_UNSUPPORTED The transport protocol doesn't support the device.\r
69 @retval Other The USB CBI initialization fails.\r
70\r
71**/\r
72EFI_STATUS\r
73UsbCbiInit (\r
74 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
75 OUT VOID **Context OPTIONAL\r
76 );\r
77\r
78/**\r
79 Execute USB mass storage command through the CBI0/CBI1 transport protocol.\r
80\r
81 @param Context The USB CBI Protocol.\r
82 @param Cmd The command to transfer to device\r
83 @param CmdLen The length of the command\r
84 @param DataDir The direction of data transfer\r
85 @param Data The buffer to hold the data\r
86 @param DataLen The length of the buffer\r
87 @param Lun Should be 0, this field for bot only\r
88 @param Timeout The time to wait\r
89 @param CmdStatus The result of the command execution\r
90\r
91 @retval EFI_SUCCESS The command is executed successfully.\r
92 @retval Other Failed to execute the command\r
93\r
94**/\r
95EFI_STATUS\r
96UsbCbiExecCommand (\r
97 IN VOID *Context,\r
98 IN VOID *Cmd,\r
99 IN UINT8 CmdLen,\r
100 IN EFI_USB_DATA_DIRECTION DataDir,\r
101 IN VOID *Data,\r
102 IN UINT32 DataLen,\r
103 IN UINT8 Lun,\r
104 IN UINT32 Timeout,\r
105 OUT UINT32 *CmdStatus\r
106 );\r
107\r
108/**\r
109 Reset the USB mass storage device by CBI protocol.\r
110\r
111 This function resets the USB mass storage device by CBI protocol.\r
112 The reset is defined as a non-data command. Don't use UsbCbiExecCommand\r
113 to send the command to device because that may introduce recursive loop.\r
114\r
115 @param Context The USB CBI protocol\r
116 @param ExtendedVerification The flag controlling the rule of reset.\r
117 Not used here.\r
118\r
119 @retval EFI_SUCCESS The device is reset.\r
120 @retval Others Failed to reset the device.\r
121\r
122**/\r
123EFI_STATUS\r
124UsbCbiResetDevice (\r
125 IN VOID *Context,\r
126 IN BOOLEAN ExtendedVerification\r
127 );\r
128\r
129/**\r
130 Clean up the CBI protocol's resource.\r
131\r
132 @param Context The instance of CBI protocol.\r
133\r
134 @retval EFI_SUCCESS The resource is cleaned up.\r
135\r
136**/\r
137EFI_STATUS\r
138UsbCbiCleanUp (\r
139 IN VOID *Context\r
140 );\r
141\r
e237e7ae 142#endif\r