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
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.
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.
27 #ifndef _EFI_USBMASS_BOT_H_
28 #define _EFI_USBMASS_BOT_H_
32 // Usb Bulk-Only class specfic request
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
42 // Usb BOT command block status values
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
49 // Usb Bot retry times
51 USB_BOT_GET_STATUS_RETRY
= 3,
56 USB_BOT_RESET_STALL
= 100 * USB_MASS_STALL_1_MS
,
59 // Usb Bot transfer timeout
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
,
67 // The CBW (Command Block Wrapper) and CSW (Command Status Wrapper)
68 // structures used by the Usb BOT protocol.
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
];
90 // Put Interface at the first field is to make it easy to get by Context, which
91 // could be BOT/CBI Protocol instance
94 EFI_USB_INTERFACE_DESCRIPTOR Interface
;
95 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkInEndpoint
;
96 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkOutEndpoint
;
98 EFI_USB_IO_PROTOCOL
*UsbIo
;
101 extern USB_MASS_TRANSPORT mUsbBotTransport
;