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

Go to the source code of this file.

Data Structures

struct  USB_CBI_PROTOCOL
 
struct  USB_CBI_STATUS
 

Macros

#define USB_CBI_MAX_PACKET_NUM   16
 
#define USB_CBI_RESET_CMD_LEN   12
 
#define USB_CBI_MAX_RETRY   3
 
#define USB_CBI_RESET_DEVICE_STALL   (50 * USB_MASS_1_MILLISECOND)
 
#define USB_CBI_RESET_DEVICE_TIMEOUT   (1 * USB_MASS_1_SECOND)
 

Functions

EFI_STATUS UsbCbiInit (IN EFI_USB_IO_PROTOCOL *UsbIo, OUT VOID **Context OPTIONAL)
 
EFI_STATUS UsbCbiExecCommand (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 UsbCbiResetDevice (IN VOID *Context, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS UsbCbiCleanUp (IN VOID *Context)
 

Variables

USB_MASS_TRANSPORT mUsbCbi0Transport
 
USB_MASS_TRANSPORT mUsbCbi1Transport
 

Detailed Description

Definition for the USB mass storage Control/Bulk/Interrupt (CBI) transport, according to USB Mass Storage Class Control/Bulk/Interrupt (CBI) Transport, Revision 1.1.

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

Definition in file UsbMassCbi.h.

Macro Definition Documentation

◆ USB_CBI_MAX_PACKET_NUM

#define USB_CBI_MAX_PACKET_NUM   16

Definition at line 16 of file UsbMassCbi.h.

◆ USB_CBI_MAX_RETRY

#define USB_CBI_MAX_RETRY   3

Definition at line 21 of file UsbMassCbi.h.

◆ USB_CBI_RESET_CMD_LEN

#define USB_CBI_RESET_CMD_LEN   12

Definition at line 17 of file UsbMassCbi.h.

◆ USB_CBI_RESET_DEVICE_STALL

#define USB_CBI_RESET_DEVICE_STALL   (50 * USB_MASS_1_MILLISECOND)

Definition at line 25 of file UsbMassCbi.h.

◆ USB_CBI_RESET_DEVICE_TIMEOUT

#define USB_CBI_RESET_DEVICE_TIMEOUT   (1 * USB_MASS_1_SECOND)

Definition at line 29 of file UsbMassCbi.h.

Function Documentation

◆ UsbCbiCleanUp()

EFI_STATUS UsbCbiCleanUp ( IN VOID *  Context)

Clean up the CBI protocol's resource.

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

Definition at line 597 of file UsbMassCbi.c.

◆ UsbCbiExecCommand()

EFI_STATUS UsbCbiExecCommand ( 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 CBI0/CBI1 transport protocol.

Parameters
ContextThe USB CBI 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 426 of file UsbMassCbi.c.

◆ UsbCbiInit()

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

Initializes USB CBI protocol.

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

Definition at line 54 of file UsbMassCbi.c.

◆ UsbCbiResetDevice()

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

Reset the USB mass storage device by CBI protocol.

This function resets the USB mass storage device by CBI protocol. The reset is defined as a non-data command. Don't use UsbCbiExecCommand to send the command to device because that may introduce recursive loop.

Parameters
ContextThe USB CBI 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 542 of file UsbMassCbi.c.

Variable Documentation

◆ mUsbCbi0Transport

USB_MASS_TRANSPORT mUsbCbi0Transport
extern

Definition at line 17 of file UsbMassCbi.c.

◆ mUsbCbi1Transport

USB_MASS_TRANSPORT mUsbCbi1Transport
extern

Definition at line 29 of file UsbMassCbi.c.