tailieunhanh - USB Complete fourth- P22

USB Complete fourth- P22:This book focuses on Windows programming for PCs, but other computers and operating systems also have USB support, including Linux and Apple Computer’s Macintosh. Some real-time kernels also support USB. | Chapter 7 Table 7-6 The CBW contains a command block and other information about the command. Name Bits Description dCBWSignature 32 The value 43425355h which identifies the structure as a CBW dCBWTag 32 A tag that associates this CBW with the CSW the device will send in response. dCBWDataTransferLength 32 The number of bytes the host expects to transfer in the data-transport stage. bmCBWFlags 8 Specifies the direction of the data-transport stage. Bit 7 0 for an OUT host-to-device transfer. Bit 7 1 for an IN device-to-host transfer. All other bits are zero. If there is no data-transport stage bit 7 is ignored. Reserved 4 Zero bCBWLUN 4 For devices with multiple LUNs specifies the LUN the command block is directed to. Otherwise the value is zero. Reserved 3 Zero bCBWCBLength 5 The length 1-16 of the command block in bytes CBWCB 128 The command block for the device to execute. status information in a structure called a Command Status Wrapper CSW . Some commands have no data-transport stage. Table 7-6 shows the fields in the CBW. The meaning of the command-block value in the CBWCB field varies with the command set specified by the interface descriptor s blnterfaceSubClass field. On receiving a CBW a device must check that the structure is valid and has meaningful content. A CBW is valid if it is received after a CSW or reset is 31 bytes and has the correct value in dCBWSignature. The contents are considered meaningful if no reserved bits are set bCBWLUN contains a supported LUN value and bCBWCBLength and CBWCB are valid for the interface s subclass. Table 7-7 shows the fields in the CSW. On receiving a CSW the host must check that the structure is valid and has meaningful content. A CSW is valid if it has 13 bytes has the correct value in dCSWSignature and has a dCSWTag value that matches dCBWTag of a corresponding CBW. The contents are considered meaningful if bCSWStatus equals 02h or if bCSWStatus equals either 186 Device Classes Table 7-7 The CSW contains status .