]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.h
Support ICC build .
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMassStorageDxe / UsbMassBot.h
CommitLineData
e237e7ae 1/** @file\r
2\r
3Copyright (c) 2007, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 UsbMassBot.h\r
15\r
16Abstract:\r
17\r
18 Defination for the USB mass storage Bulk-Only Transport protocol.\r
19 This implementation is based on the "Universal Serial Bus Mass\r
20 Storage Class Bulk-Only Transport" Revision 1.0, September 31, 1999.\r
21\r
22Revision History\r
23\r
24\r
25**/\r
26\r
27#ifndef _EFI_USBMASS_BOT_H_\r
28#define _EFI_USBMASS_BOT_H_\r
29\r
30enum {\r
31 //\r
32 // Usb Bulk-Only class specfic request\r
33 //\r
34 USB_BOT_RESET_REQUEST = 0xFF, // Bulk-Only Mass Storage Reset\r
35 USB_BOT_GETLUN_REQUEST = 0xFE, // Get Max Lun\r
36 USB_BOT_CBW_SIGNATURE = 0x43425355, // dCBWSignature, tag the packet as CBW\r
37 USB_BOT_CSW_SIGNATURE = 0x53425355, // dCSWSignature, tag the packet as CSW\r
38 USB_BOT_MAX_LUN = 0x0F, // Lun number is from 0 to 15\r
39 USB_BOT_MAX_CMDLEN = 16, // Maxium number of command from command set\r
40\r
41 //\r
42 // Usb BOT command block status values\r
43 //\r
44 USB_BOT_COMMAND_OK = 0x00, // Command passed, good status\r
45 USB_BOT_COMMAND_FAILED = 0x01, // Command failed\r
46 USB_BOT_COMMAND_ERROR = 0x02, // Phase error, need to reset the device\r
47\r
48 //\r
41e8ff27 49 // Usb Bot retry to get CSW, refers to specification[BOT10-5.3, it says 2 times]\r
e237e7ae 50 //\r
41e8ff27 51 USB_BOT_RECV_CSW_RETRY = 3,\r
e237e7ae 52\r
53 //\r
41e8ff27 54 // Usb Bot wait device reset complete, set by experience\r
55 // \r
56 USB_BOT_RESET_DEVICE_STALL = 100 * USB_MASS_1_MILLISECOND,\r
57 \r
e237e7ae 58 //\r
41e8ff27 59 // Usb Bot transport timeout, set by experience\r
e237e7ae 60 //\r
41e8ff27 61 USB_BOT_SEND_CBW_TIMEOUT = 3 * USB_MASS_1_SECOND,\r
62 USB_BOT_RECV_CSW_TIMEOUT = 3 * USB_MASS_1_SECOND,\r
23c326c2 63 USB_BOT_RESET_DEVICE_TIMEOUT = 3 * USB_MASS_1_SECOND\r
e237e7ae 64};\r
65\r
66//\r
67// The CBW (Command Block Wrapper) and CSW (Command Status Wrapper)\r
68// structures used by the Usb BOT protocol.\r
69//\r
70#pragma pack(1)\r
71typedef struct {\r
72 UINT32 Signature;\r
73 UINT32 Tag;\r
74 UINT32 DataLen; // Length of data between CBW and CSW\r
75 UINT8 Flag; // Bit 7, 0 ~ Data-Out, 1 ~ Data-In\r
76 UINT8 Lun; // Lun number. Bits 0~3 are used\r
77 UINT8 CmdLen; // Length of the command. Bits 0~4 are used\r
78 UINT8 CmdBlock[USB_BOT_MAX_CMDLEN];\r
79} USB_BOT_CBW;\r
80\r
81typedef struct {\r
82 UINT32 Signature;\r
83 UINT32 Tag;\r
84 UINT32 DataResidue;\r
85 UINT8 CmdStatus;\r
86} USB_BOT_CSW;\r
87#pragma pack()\r
88\r
89//\r
90// Put Interface at the first field is to make it easy to get by Context, which\r
91// could be BOT/CBI Protocol instance\r
92//\r
93typedef struct {\r
94 EFI_USB_INTERFACE_DESCRIPTOR Interface;\r
95 EFI_USB_ENDPOINT_DESCRIPTOR *BulkInEndpoint;\r
96 EFI_USB_ENDPOINT_DESCRIPTOR *BulkOutEndpoint;\r
97 UINT32 CbwTag;\r
98 EFI_USB_IO_PROTOCOL *UsbIo;\r
99} USB_BOT_PROTOCOL;\r
100\r
101extern USB_MASS_TRANSPORT mUsbBotTransport;\r
102#endif\r