Information Technology Reference
In-Depth Information
} else {
// The command failed.
// Store sense data to describe the error.
msd_csw.bCSWStatus = 0x01;
gblSenseData.SenseKey = S_MEDIUM_ERROR;
gblSenseData.ASC = ASC_UNRECOVERED_READ_ERROR;
gblSenseData.ASCQ = ASCQ_UNRECOEVERED_READ_ERROR;
// Don't send any more data.
msd_csw.dCSWDataResidue = 0x0;
break;
}
} // End transfer length > 0
} // End transfer length OK
}
READ CAPACITY
The host uses a READ CAPACITY command to learn how many bytes a
device can store. In the data-transport phase, the device returns a structure
that contains the LBA of the last block in the media and the number of
bytes per block. Note that the command requests the LBA of the last block,
not the number of blocks in the media. The first LBA is zero, so the LBA of
the last block equals the number of blocks - 1.
There are two READ CAPACITY commands: READ CAPACITY(10) and
READ CAPACITY(16). The commands differ in the length of the fields in
the command block and response structure. SBC devices must support
READ CAPACITY(10).
A MultiMediaCard host uses information in the card's CSD register to cal-
culate the LBA of the final block. The MultiMediaCard specification shows
how to do the calculations. The fields in the CSD register aren't all
byte-aligned, so obtaining a value sometimes requires reading multiple bytes
and selecting bits from each to obtain the value of interest.
DWORD gblNumBLKS=0x00;
DWORD gblBLKLen=0x00;
Search WWH ::




Custom Search