TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbMassBot.h File Reference

Go to the source code of this file.

Data Structures

struct  USB_BOT_CBW
 
struct  USB_BOT_CSW
 
struct  USB_BOT_PROTOCOL
 

Macros

#define USB_BOT_RESET_REQUEST   0xFF
 Bulk-Only Mass Storage Reset.
 
#define USB_BOT_GETLUN_REQUEST   0xFE
 Get Max Lun.
 
#define USB_BOT_CBW_SIGNATURE   0x43425355
 dCBWSignature, tag the packet as CBW
 
#define USB_BOT_CSW_SIGNATURE   0x53425355
 dCSWSignature, tag the packet as CSW
 
#define USB_BOT_MAX_LUN   0x0F
 Lun number is from 0 to 15.
 
#define USB_BOT_MAX_CMDLEN   16
 Maximum number of command from command set.
 
#define USB_BOT_COMMAND_OK   0x00
 Command passed, good status.
 
#define USB_BOT_COMMAND_FAILED   0x01
 Command failed.
 
#define USB_BOT_COMMAND_ERROR   0x02
 Phase error, need to reset the device.
 
#define USB_BOT_RECV_CSW_RETRY   3
 
#define USB_BOT_RESET_DEVICE_STALL   (100 * USB_MASS_1_MILLISECOND)
 
#define USB_BOT_SEND_CBW_TIMEOUT   (3 * USB_MASS_1_SECOND)
 
#define USB_BOT_RECV_CSW_TIMEOUT   (3 * USB_MASS_1_SECOND)
 
#define USB_BOT_RESET_DEVICE_TIMEOUT   (3 * USB_MASS_1_SECOND)
 

Functions

EFI_STATUS UsbBotInit (IN EFI_USB_IO_PROTOCOL *UsbIo, OUT VOID **Context OPTIONAL)
 
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)
 
EFI_STATUS UsbBotResetDevice (IN VOID *Context, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS UsbBotGetMaxLun (IN VOID *Context, OUT UINT8 *MaxLun)
 
EFI_STATUS UsbBotCleanUp (IN VOID *Context)
 

Variables

USB_MASS_TRANSPORT mUsbBotTransport
 

Detailed Description

Definition for the USB mass storage Bulk-Only Transport protocol, based on the "Universal Serial Bus Mass Storage Class Bulk-Only Transport" Revision 1.0, September 31, 1999.

Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UsbMassBot.h.

Macro Definition Documentation

◆ USB_BOT_CBW_SIGNATURE

#define USB_BOT_CBW_SIGNATURE   0x43425355

dCBWSignature, tag the packet as CBW

Definition at line 21 of file UsbMassBot.h.

◆ USB_BOT_COMMAND_ERROR

#define USB_BOT_COMMAND_ERROR   0x02

Phase error, need to reset the device.

Definition at line 31 of file UsbMassBot.h.

◆ USB_BOT_COMMAND_FAILED

#define USB_BOT_COMMAND_FAILED   0x01

Command failed.

Definition at line 30 of file UsbMassBot.h.

◆ USB_BOT_COMMAND_OK

#define USB_BOT_COMMAND_OK   0x00

Command passed, good status.

Definition at line 29 of file UsbMassBot.h.

◆ USB_BOT_CSW_SIGNATURE

#define USB_BOT_CSW_SIGNATURE   0x53425355

dCSWSignature, tag the packet as CSW

Definition at line 22 of file UsbMassBot.h.

◆ USB_BOT_GETLUN_REQUEST

#define USB_BOT_GETLUN_REQUEST   0xFE

Get Max Lun.

Definition at line 20 of file UsbMassBot.h.

◆ USB_BOT_MAX_CMDLEN

#define USB_BOT_MAX_CMDLEN   16

Maximum number of command from command set.

Definition at line 24 of file UsbMassBot.h.

◆ USB_BOT_MAX_LUN

#define USB_BOT_MAX_LUN   0x0F

Lun number is from 0 to 15.

Definition at line 23 of file UsbMassBot.h.

◆ USB_BOT_RECV_CSW_RETRY

#define USB_BOT_RECV_CSW_RETRY   3

Definition at line 36 of file UsbMassBot.h.

◆ USB_BOT_RECV_CSW_TIMEOUT

#define USB_BOT_RECV_CSW_TIMEOUT   (3 * USB_MASS_1_SECOND)

Definition at line 47 of file UsbMassBot.h.

◆ USB_BOT_RESET_DEVICE_STALL

#define USB_BOT_RESET_DEVICE_STALL   (100 * USB_MASS_1_MILLISECOND)

Definition at line 41 of file UsbMassBot.h.

◆ USB_BOT_RESET_DEVICE_TIMEOUT

#define USB_BOT_RESET_DEVICE_TIMEOUT   (3 * USB_MASS_1_SECOND)

Definition at line 48 of file UsbMassBot.h.

◆ USB_BOT_RESET_REQUEST

#define USB_BOT_RESET_REQUEST   0xFF

Bulk-Only Mass Storage Reset.

Definition at line 19 of file UsbMassBot.h.

◆ USB_BOT_SEND_CBW_TIMEOUT

#define USB_BOT_SEND_CBW_TIMEOUT   (3 * USB_MASS_1_SECOND)

Definition at line 46 of file UsbMassBot.h.

Function Documentation

◆ UsbBotCleanUp()

EFI_STATUS UsbBotCleanUp ( IN VOID *  Context)

Clean up the resource used by this BOT protocol.

Parameters
ContextThe context of the BOT protocol, that is, USB_BOT_PROTOCOL.
Return values
EFI_SUCCESSThe resource is cleaned up.

Definition at line 598 of file UsbMassBot.c.

◆ UsbBotExecCommand()

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 
)

Call the USB Mass Storage Class BOT protocol to issue the command/data/status circle to execute the commands.

Parameters
ContextThe context of the BOT protocol, that is, USB_BOT_PROTOCOL
CmdThe high level command
CmdLenThe command length
DataDirThe direction of the data transfer
DataThe buffer to hold data
DataLenThe length of the data
LunThe number of logic unit
TimeoutThe time to wait command
CmdStatusThe result of high level command execution
Return values
EFI_SUCCESSThe command is executed successfully.
OtherFailed to execute command

Definition at line 393 of file UsbMassBot.c.

◆ UsbBotGetMaxLun()

EFI_STATUS UsbBotGetMaxLun ( IN VOID *  Context,
OUT UINT8 *  MaxLun 
)

Get the max LUN (Logical Unit Number) of USB mass storage device.

Parameters
ContextThe context of the BOT protocol, that is, USB_BOT_PROTOCOL
MaxLunReturn pointer to the max number of LUN. (e.g. MaxLun=1 means LUN0 and LUN1 in all.)
Return values
EFI_SUCCESSMax LUN is got successfully.
OthersFail to execute this request.

Definition at line 536 of file UsbMassBot.c.

◆ UsbBotInit()

EFI_STATUS UsbBotInit ( IN EFI_USB_IO_PROTOCOL UsbIo,
OUT VOID **Context  OPTIONAL 
)

Initializes USB BOT protocol.

This function initializes the USB mass storage class BOT protocol. It will save its context which is a USB_BOT_PROTOCOL structure in the Context if Context isn't NULL.

Parameters
UsbIoThe USB I/O Protocol instance
ContextThe buffer to save the context to
Return values
EFI_SUCCESSThe device is successfully initialized.
EFI_UNSUPPORTEDThe transport protocol doesn't support the device.
OtherThe USB BOT initialization fails.

Definition at line 40 of file UsbMassBot.c.

◆ UsbBotResetDevice()

EFI_STATUS UsbBotResetDevice ( IN VOID *  Context,
IN BOOLEAN  ExtendedVerification 
)

Reset the USB mass storage device by BOT protocol.

Parameters
ContextThe context of the BOT protocol, that is, USB_BOT_PROTOCOL.
ExtendedVerificationIf FALSE, just issue Bulk-Only Mass Storage Reset request. If TRUE, additionally reset parent hub port.
Return values
EFI_SUCCESSThe device is reset.
OthersFailed to reset the device..

Definition at line 460 of file UsbMassBot.c.

Variable Documentation

◆ mUsbBotTransport

USB_MASS_TRANSPORT mUsbBotTransport
extern

Definition at line 15 of file UsbMassBot.c.