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

Go to the source code of this file.

Data Structures

struct  _USB_MASS_TRANSPORT
 
struct  _USB_MASS_DEVICE
 

Macros

#define USB_IS_IN_ENDPOINT(EndPointAddr)   (((EndPointAddr) & BIT7) == BIT7)
 
#define USB_IS_OUT_ENDPOINT(EndPointAddr)   (((EndPointAddr) & BIT7) == 0)
 
#define USB_IS_BULK_ENDPOINT(Attribute)   (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_BULK)
 
#define USB_IS_INTERRUPT_ENDPOINT(Attribute)   (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT)
 
#define USB_IS_ERROR(Result, Error)   (((Result) & (Error)) != 0)
 
#define USB_MASS_1_MILLISECOND   1000
 
#define USB_MASS_1_SECOND   (1000 * USB_MASS_1_MILLISECOND)
 
#define USB_MASS_CMD_SUCCESS   0
 
#define USB_MASS_CMD_FAIL   1
 
#define USB_MASS_CMD_PERSISTENT   2
 

Typedefs

typedef struct _USB_MASS_TRANSPORT USB_MASS_TRANSPORT
 
typedef struct _USB_MASS_DEVICE USB_MASS_DEVICE
 
typedef EFI_STATUS(* USB_MASS_INIT_TRANSPORT) (IN EFI_USB_IO_PROTOCOL *Usb, OUT VOID **Context OPTIONAL)
 
typedef EFI_STATUS(* USB_MASS_EXEC_COMMAND) (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)
 
typedef EFI_STATUS(* USB_MASS_RESET) (IN VOID *Context, IN BOOLEAN ExtendedVerification)
 
typedef EFI_STATUS(* USB_MASS_GET_MAX_LUN) (IN VOID *Context, IN UINT8 *MaxLun)
 
typedef EFI_STATUS(* USB_MASS_CLEAN_UP) (IN VOID *Context)
 

Detailed Description

Definition of USB Mass Storage Class and its value, USB Mass Transport Protocol, and other common definitions.

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

Definition in file UsbMass.h.

Macro Definition Documentation

◆ USB_IS_BULK_ENDPOINT

#define USB_IS_BULK_ENDPOINT (   Attribute)    (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_BULK)

Definition at line 39 of file UsbMass.h.

◆ USB_IS_ERROR

#define USB_IS_ERROR (   Result,
  Error 
)    (((Result) & (Error)) != 0)

Definition at line 41 of file UsbMass.h.

◆ USB_IS_IN_ENDPOINT

#define USB_IS_IN_ENDPOINT (   EndPointAddr)    (((EndPointAddr) & BIT7) == BIT7)

Definition at line 37 of file UsbMass.h.

◆ USB_IS_INTERRUPT_ENDPOINT

#define USB_IS_INTERRUPT_ENDPOINT (   Attribute)    (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT)

Definition at line 40 of file UsbMass.h.

◆ USB_IS_OUT_ENDPOINT

#define USB_IS_OUT_ENDPOINT (   EndPointAddr)    (((EndPointAddr) & BIT7) == 0)

Definition at line 38 of file UsbMass.h.

◆ USB_MASS_1_MILLISECOND

#define USB_MASS_1_MILLISECOND   1000

Definition at line 43 of file UsbMass.h.

◆ USB_MASS_1_SECOND

#define USB_MASS_1_SECOND   (1000 * USB_MASS_1_MILLISECOND)

Definition at line 44 of file UsbMass.h.

◆ USB_MASS_CMD_FAIL

#define USB_MASS_CMD_FAIL   1

Definition at line 47 of file UsbMass.h.

◆ USB_MASS_CMD_PERSISTENT

#define USB_MASS_CMD_PERSISTENT   2

Definition at line 48 of file UsbMass.h.

◆ USB_MASS_CMD_SUCCESS

#define USB_MASS_CMD_SUCCESS   0

Definition at line 46 of file UsbMass.h.

Typedef Documentation

◆ USB_MASS_CLEAN_UP

typedef EFI_STATUS(* USB_MASS_CLEAN_UP) (IN VOID *Context)

Clean up the transport protocol's resource.

Parameters
ContextThe instance of transport protocol.
Return values
EFI_SUCCESSThe resource is cleaned up.

Definition at line 147 of file UsbMass.h.

◆ USB_MASS_DEVICE

Definition at line 29 of file UsbMass.h.

◆ USB_MASS_EXEC_COMMAND

typedef EFI_STATUS(* USB_MASS_EXEC_COMMAND) (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)

Execute USB mass storage command through the transport protocol.

Parameters
ContextThe USB Transport Protocol.
CmdThe command to transfer to device
CmdLenThe length of the command
DataDirThe direction of data transfer
DataThe buffer to hold the data
DataLenThe length of the buffer
LunShould be 0, this field for bot only
TimeoutThe time to wait
CmdStatusThe result of the command execution
Return values
EFI_SUCCESSThe command is executed successfully.
OtherFailed to execute the command

Definition at line 89 of file UsbMass.h.

◆ USB_MASS_GET_MAX_LUN

typedef EFI_STATUS(* USB_MASS_GET_MAX_LUN) (IN VOID *Context, IN UINT8 *MaxLun)

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

Parameters
ContextThe context of the transport 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 132 of file UsbMass.h.

◆ USB_MASS_INIT_TRANSPORT

typedef EFI_STATUS(* USB_MASS_INIT_TRANSPORT) (IN EFI_USB_IO_PROTOCOL *Usb, OUT VOID **Context OPTIONAL)

Initializes USB transport protocol.

This function initializes the USB mass storage class transport protocol. It will save its context 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 transport initialization fails.

Definition at line 65 of file UsbMass.h.

◆ USB_MASS_RESET

typedef EFI_STATUS(* USB_MASS_RESET) (IN VOID *Context, IN BOOLEAN ExtendedVerification)

Reset the USB mass storage device by Transport protocol.

Parameters
ContextThe USB Transport Protocol
ExtendedVerificationThe flag controlling the rule of reset. Not used here.
Return values
EFI_SUCCESSThe device is reset.
OthersFailed to reset the device.

Definition at line 114 of file UsbMass.h.

◆ USB_MASS_TRANSPORT

Definition at line 28 of file UsbMass.h.