Driver StructureUSB2.0 to ATA/ATAPI Bridge Designer Reference Manual, Rev. 0Freescale Semiconductor 257.2.4 Example of Command Block WrapperTable 7-8 shows a USB CBW issued to the device number 0 (byte 12 of the CBW) with effective SCSIcommand length of 10 (byte 14). The expected transfer length is 0x1000, i.e. Byte 11 (MSB) to Byte 8(LSB).The “2A” in byte 15 of the CBW means it is a SCSI Write_10 command. The command requests thedevice to write 8 blocks of data to the LBA 0x9C4637. In this example one block of data equals 512 bytes.Therefore, 8 blocks of data equal 4K bytes which matches the expected transfer length of 0x1000 bytesof data length requested in the CBW.7.3 Driver StructureThe driver handles and responds to the commands included in the USB Command Block Wrapper andthe Class Specific Requests.7.3.1 Handling of USB Command Block WrapperFigure 7-2 shows the handling of the USB Command Block Wrapper, which is a detail implementationincluding errors handling. There are only three kinds of commands to handles:• Commands without data transfer• Host sends out data to storage device• Host receives data from storage deviceAfter decoding the SCSI command from the CBW, the driver will either:• handle the command without interfering with the individual storage device driver, or• translate the command and call individual routines of the storage device driver.After receiving a 31 byte CBW and all data has been transferred, the UF32 will return a 13 byte CSW tothe host with either a result of pass or fail which depends on the global variable gUSBMSResult. Passresult only happens if the command is supported and the storage device has successfully executed thecommand.Table 7-8. Example of a CBW containing SCSI Write_10 CommandUSB CBW SCSI CommandBytes Data (HEX) Bytes Data (HEX) Meaning0–3 55 53 42 43 (Signature) 0 2A Write_104–7 A8 1A A4 FF (Tag) 1 00 Not used8–11 00 10 00 00 (Length) 2–5 00 9C 46 37 Logical BlockAddress12 00 (Device Number)13 00 (Reserved) 6–9 00 00 00 08 Number ofblocks to transfer14 0A (Command Length)15–30 2A 00 00 9C 46 37 00 0000 08 00 00 00 00 00 00 10–15 00 00 0000 00 00 Not used