Information Technology Reference
In-Depth Information
For devices with removable media, some hosts issue periodic TEST UNIT
READY commands to find out if the media is still present. A successful
TEST UNIT READY response doesn't guarantee that the next READ or
WRITE command will succeed, however. Instead of periodic TEST UNIT
READY commands, a host can just attempt to read or write to the media as
needed. If the media has been removed, the READ or WRITE command
fails, and a REQUEST SENSE command can obtain the reason.
The MSDTestUnitReadyHandler function resets the sense data in the
gblSenseData structure and calls the DetectSDCard function from Chapter
5 to determine if a MultiMediaCard or SD Card is present. If a card isn't
detected, the function sets data in the appropriate fields in the Request-
SenseResponse structure. The function also sets the CSWStatus and CSW-
DataResidue fields in the CSW.
void MSDTestUnitReadyHandler()
{
msd_csw.bCSWStatus=0x0;
ResetSenseData();
if (!DetectSDCard()) {
gblSenseData.SenseKey = S_UNIT_ATTENTION;
gblSenseData.ASC = ASC_MEDIUM_NOT_PRESENT;
gblSenseData.ASCQ = ASCQ_MEDIUM_NOT_PRESENT;
msd_csw.bCSWStatus = 0x01;
}
msd_csw.dCSWDataResidue = 0x00;
return;
}
Block Commands
Each of the commands below is documented in the SCSI Block Commands
(SBC) specification.
FORMAT UNIT
The FORMAT UNIT command requests a device to divide its storage
media into logical blocks that applications can access. If the host previously
sent a MODE SELECT command, the device should use the number of
Search WWH ::




Custom Search