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