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