]>
Commit | Line | Data |
---|---|---|
e237e7ae | 1 | /** @file\r |
2 | \r | |
3 | Copyright (c) 2007, Intel Corporation\r | |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | UsbMassBot.h\r | |
15 | \r | |
16 | Abstract:\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 | |
22 | Revision 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 | |
30 | enum {\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 | |
49 | // Usb Bot retry times\r | |
50 | //\r | |
51 | USB_BOT_GET_STATUS_RETRY = 3,\r | |
52 | \r | |
53 | //\r | |
54 | // Usb Bot stall time\r | |
55 | //\r | |
56 | USB_BOT_RESET_STALL = 100 * USB_MASS_STALL_1_MS,\r | |
57 | \r | |
58 | //\r | |
59 | // Usb Bot transfer timeout\r | |
60 | //\r | |
61 | USB_BOT_CBW_TIMEOUT = 1 * USB_MASS_STALL_1_S,\r | |
62 | USB_BOT_CSW_TIMEOUT = 1 * USB_MASS_STALL_1_S,\r | |
c52fa98c | 63 | USB_BOT_RESET_TIMEOUT = 3 * USB_MASS_STALL_1_S\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 | |
71 | typedef 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 | |
81 | typedef 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 | |
93 | typedef 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 | |
101 | extern USB_MASS_TRANSPORT mUsbBotTransport;\r | |
102 | #endif\r |