Information Technology Reference
In-Depth Information
blocks and block length specified in that command. Otherwise the device
should use its current number of blocks and block length.
A device that uses MultiMediaCards or other formatted, removable media
might have no need to format its media, but the SBC specification lists the
command as mandatory. A host can use the command as a fast and reliable
method to erase the media.
READ
The READ and WRITE commands are where a host accesses a device's stor-
age media. The host issues a READ command to request to read a block of
data from the device's storage media. In the command block, the LOGICAL
BLOCK ADDRESS field specifies the LBA of the first requested block, and
the TRANSFER LENGTH field contains the number of requested blocks.
There are five READ commands: READ(6), READ(10), READ(12),
READ(16), and READ(32). The commands vary in the sizes of the logi-
cal-block-address and transfer-length fields and in the quantity and type of
status and control information included in the command block. READ(6)
and READ(10) are mandatory for SBC devices. The specification recom-
mends migrating all code from READ(6) to READ(10), but a host might
still attempt to use READ(6). The Windows USB mass-storage driver uses
READ(10).
On receiving a READ(10) command, a device should send the contents of
the requested blocks to the host in the data-transport phase. The device
doesn't have to know or care what is in the requested blocks. All the device
needs is a block number and the number of blocks to return.
The MSDReadHandler function reads the block address and the number of
bytes to transfer specified in the CBW, handles any detected errors, sets
fields on the CSW, and calls the MSDDataIn function from Chapter 3 to
send the requested data.
The MSDReadHandler function uses the variable gblNumBLKS, which
contains the number of blocks in the volume. The section describing the
READ CAPACITY command later in this chapter shows how to obtain the
value.
Search WWH ::




Custom Search