Information Technology Reference
In-Depth Information
The _USB_MSD_CBW structure can hold a CBW:
#define MSD_CBW_SIZE 0x1F
typedef struct _USB_MSD_CBW
{
dword dCBWSignature;
dword dCBWTag;
dword dCBWDataTransferLength;
byte bCBWFlags;
byte bCBWLUN;
byte bCBWCBLength;
byte CBWCB[16];
} USB_MSD_CBW;
The CBWCB field of a CBW contains a command descriptor block (CDB),
or command block for short. The CDB is a structure that contains a com-
mand and supplementary information that varies with the command. The
CBWCB field is always 16 bytes, but many CDBs are shorter than 16 bytes.
Any remaining bytes in the CDB are pad bytes of zero.
In most cases, the bCBWCBLength field indicates the length of the CDB
within the CBWCB field excluding pad bytes. For devices with bInterface-
SubClass = 04h (UFI), the host must pad CDBs shorter than 12 bytes with
zeroes and set bCBWCBLength to 12. For CBWs carrying the 6-byte SCSI
REQUEST SENSE command block, the Windows mass-storage driver
incorrectly sets bCBWCBLength = 12 even for non-UFI devices.
The bmCBWFlags field indicates the direction of the data-transport phase.
The dCBWDataTransferLength field indicates how many bytes the host will
send or how many bytes the host expects to receive.
On receiving a CBW, a device should check that the structure is valid and
has meaningful content. A CBW is valid if all of the following are true:
• The CBW is received after a CSW or reset.
• The CBW is 31 bytes.
• The dCBWSignature field has the correct value.
The contents are considered meaningful if all of the following are true:
All of the reserved bits are zero.
The bCBWLUN field contains a supported LUN value.
Search WWH ::




Custom Search