TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbMassBot.h
Go to the documentation of this file.
1
11#ifndef _EFI_USBMASS_BOT_H_
12#define _EFI_USBMASS_BOT_H_
13
14extern USB_MASS_TRANSPORT mUsbBotTransport;
15
16//
17// Usb Bulk-Only class specific request
18//
19#define USB_BOT_RESET_REQUEST 0xFF
20#define USB_BOT_GETLUN_REQUEST 0xFE
21#define USB_BOT_CBW_SIGNATURE 0x43425355
22#define USB_BOT_CSW_SIGNATURE 0x53425355
23#define USB_BOT_MAX_LUN 0x0F
24#define USB_BOT_MAX_CMDLEN 16
25
26//
27// Usb BOT command block status values
28//
29#define USB_BOT_COMMAND_OK 0x00
30#define USB_BOT_COMMAND_FAILED 0x01
31#define USB_BOT_COMMAND_ERROR 0x02
32
33//
34// Usb Bot retry to get CSW, refers to specification[BOT10-5.3, it says 2 times]
35//
36#define USB_BOT_RECV_CSW_RETRY 3
37
38//
39// Usb Bot wait device reset complete, set by experience
40//
41#define USB_BOT_RESET_DEVICE_STALL (100 * USB_MASS_1_MILLISECOND)
42
43//
44// Usb Bot transport timeout, set by experience
45//
46#define USB_BOT_SEND_CBW_TIMEOUT (3 * USB_MASS_1_SECOND)
47#define USB_BOT_RECV_CSW_TIMEOUT (3 * USB_MASS_1_SECOND)
48#define USB_BOT_RESET_DEVICE_TIMEOUT (3 * USB_MASS_1_SECOND)
49
50#pragma pack(1)
54typedef struct {
55 UINT32 Signature;
56 UINT32 Tag;
57 UINT32 DataLen;
58 UINT8 Flag;
59 UINT8 Lun;
60 UINT8 CmdLen;
61 UINT8 CmdBlock[USB_BOT_MAX_CMDLEN];
63
67typedef struct {
68 UINT32 Signature;
69 UINT32 Tag;
70 UINT32 DataResidue;
71 UINT8 CmdStatus;
73#pragma pack()
74
75typedef struct {
76 //
77 // Put Interface at the first field to make it easy to distinguish BOT/CBI Protocol instance
78 //
80 EFI_USB_ENDPOINT_DESCRIPTOR *BulkInEndpoint;
81 EFI_USB_ENDPOINT_DESCRIPTOR *BulkOutEndpoint;
82 UINT32 CbwTag;
85
103 IN EFI_USB_IO_PROTOCOL *UsbIo,
104 OUT VOID **Context OPTIONAL
105 );
106
128 IN VOID *Context,
129 IN VOID *Cmd,
130 IN UINT8 CmdLen,
132 IN VOID *Data,
133 IN UINT32 DataLen,
134 IN UINT8 Lun,
135 IN UINT32 Timeout,
136 OUT UINT32 *CmdStatus
137 );
138
153 IN VOID *Context,
154 IN BOOLEAN ExtendedVerification
155 );
156
170 IN VOID *Context,
171 OUT UINT8 *MaxLun
172 );
173
184 IN VOID *Context
185 );
186
187#endif
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_USB_DATA_DIRECTION
Definition: UsbIo.h:44
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
EFI_STATUS UsbBotExecCommand(IN VOID *Context, IN VOID *Cmd, IN UINT8 CmdLen, IN EFI_USB_DATA_DIRECTION DataDir, IN VOID *Data, IN UINT32 DataLen, IN UINT8 Lun, IN UINT32 Timeout, OUT UINT32 *CmdStatus)
Definition: UsbMassBot.c:393
#define USB_BOT_MAX_CMDLEN
Maximum number of command from command set.
Definition: UsbMassBot.h:24
EFI_STATUS UsbBotInit(IN EFI_USB_IO_PROTOCOL *UsbIo, OUT VOID **Context OPTIONAL)
Definition: UsbMassBot.c:40
EFI_STATUS UsbBotCleanUp(IN VOID *Context)
Definition: UsbMassBot.c:598
EFI_STATUS UsbBotResetDevice(IN VOID *Context, IN BOOLEAN ExtendedVerification)
Definition: UsbMassBot.c:460
EFI_STATUS UsbBotGetMaxLun(IN VOID *Context, OUT UINT8 *MaxLun)
Definition: UsbMassBot.c:536
UINT8 CmdLen
Length of the command. Bits 0~4 are used.
Definition: UsbMassBot.h:60
UINT8 Flag
Bit 7, 0 ~ Data-Out, 1 ~ Data-In.
Definition: UsbMassBot.h:58
UINT32 DataLen
Length of data between CBW and CSW.
Definition: UsbMassBot.h:57
UINT8 Lun
Lun number. Bits 0~3 are used.
Definition: UsbMassBot.h:59