Information Technology Reference
In-Depth Information
After receiving a CBW, depending on the command, the device must pre-
pare to receive data from the host on the bulk OUT endpoint or prepare to
send data or a CSW to the host on the bulk IN endpoint.
The Command Status Wrapper
Table 3-7 shows the fields in the CSW, which is 13 bytes. The
_USB_MSD_CSW structure can contain a CSW:
#define MSD_CSW_SIZE 0x0d
typedef struct _USB_MSD_CSW
{
dword dCSWSignature;
dword dCSWTag;
dword dCSWDataResidue;
byte bCSWStatus;
} USB_MSD_CSW;
On receiving a CSW, a host should check that the structure is valid and has
meaningful content. A CSW is valid if all of the following are true:
• The CSW is 13 bytes.
• The dCSWSignature field has the correct value.
• The value of dCSWTag equals the value in the dCBWTag field of a pre-
viously sent CBW.
The contents are considered meaningful if either of the following is true:
• The bCSWStatus field equals 02h.
• The bCSWStatus field equals 00h or 01h and dCSWDataResidue is less
than or equal to dCBWDataTransferLength.
In the dCSWDataResidue field in the CSW, a device indicates whether it
has received and processed all of the data the host promised to send in the
CBW or whether the device has sent all of the data requested by the CBW.
In a command where the host sends data in the data-transport phase,
dCSWDataResidue contains the difference between dCBWDataTransfer-
Length in the command's CBW and the amount of data the device has pro-
cessed. If the device processes dCBWDataTransferLength bytes,
dCSWDataResidue is zero.
Search WWH ::




Custom Search