USB Function Mass Storage Client Driver SCSI-2 Direct-Access Device Emulator (Windows Embedded CE 6.0)
1/6/2010
The SCSI-2 direct-access device emulator abstracts a SCSI-2 direct-access device to the host and the transport. To execute a SCSI-2 command, the SCSI-2 direct-access device emulator provides the STORE_ExecuteCommand function, which the BOT_ExecuteCB and CBIT_ExecuteADSC functions wrap.
The following list shows what ptdData contains depending on whether ptcCommand represents a DATA_OUT or a DATA_IN transfer:
- If the ptcCommand member represents a DATA_OUT transfer, then ptdData contains the data associated with the command.
- If ptcCommand represents a DATA_IN transfer, then the ptdData member contains the data associated with the result of the command.
The following list shows the return values of STORE_ExecuteCommand depending on whether STORE_ExecuteCommand supports the command:
- If the mass storage device supports and processes the command, then STORE_ExecuteCommand returns TRUE.
- If the mass storage device does not support and process the command, the STORE_ExecuteCommand returns FALSE.
The result of STORE_ExecuteCommand determines whether the command executed, and provides the transport with the ability to fail the command on the bus.
The USB mass storage class driver implements STORE_ExecuteCommand with a switch statement that includes a case statement for each supported SCSI-2 command. Not every SCSI-2 command corresponds to a block driver IOCTL. The emulator does not strictly translate commands; it also emulates commands. If there is not a corresponding block driver IOCTL for a particular SCSI-2 command, the SCSI-2 direct-access device emulator emulates the command.
The following table shows how the SCSI-2 direct-access device emulator handles two separate commands.
SCSI-2 command | Result |
---|---|
TEST UNIT READY |
To determine whether a block device can accept a medium-access command, the SCSI-2 direct-access device emulator determines whether the associated block driver is open. |
READ(10) |
To read data from the associated block device, the SCSI-2 direct-access device emulator builds a corresponding SG_REQ structure to apply to an IOCTL_DISK_READ invocation of DeviceIoControl. |
To determine whether the mass storage device supports a particular SCSI-2 command, the SCSI-2 direct-access device emulator provides STORE_IsCommandSupported, which the BOT_HandleCBW and CBIT_HandleADSC functions wrap. STORE_IsCommandSupported accepts a SCSI-2 operation code and determines whether the SCSI-2 direct-access device emulator can support the command.
See Also
Concepts
USB Function Mass Storage Client Driver Development Concepts
USB Function Mass Storage Client Driver