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