Description
Source
Call Graph
Start Line: 888
unsigned char SBC_GetCommandInformation(void *command, unsigned int *length, unsigned char *type, MSDLun *lun)
{
//---------------
case SBC_INQUIRY:
//---------------
(*type) = MSDD_DEVICE_TO_HOST;
// Allocation length is stored in big-endian format
(*length) = WORDB(sbcCommand->inquiry.pAllocationLength);
break;
//--------------------
case SBC_MODE_SENSE_6:
//--------------------
(*type) = MSDD_DEVICE_TO_HOST;
if (sbcCommand->modeSense6.bAllocationLength >
sizeof(SBCModeParameterHeader6)) {
*length = sizeof(SBCModeParameterHeader6);
}
else {
*length = sbcCommand->modeSense6.bAllocationLength;
}
// Only "return all pages" command is supported
if (sbcCommand->modeSense6.bPageCode != SBC_PAGE_RETURN_ALL) {
// Unsupported page
TRACE_WARNING(
"SBC_GetCommandInformation: Page code not supported(0x%02X)\n\r",
sbcCommand->modeSense6.bPageCode);
isCommandSupported = 0;
(*length) = 0;
}
break;
//------------------------------------
case SBC_PREVENT_ALLOW_MEDIUM_REMOVAL:
//------------------------------------
(*type) = MSDD_NO_TRANSFER;
break;
//---------------------
case SBC_REQUEST_SENSE:
//---------------------
(*type) = MSDD_DEVICE_TO_HOST;
(*length) = sbcCommand->requestSense.bAllocationLength;
break;
//-----------------------
case SBC_TEST_UNIT_READY:
//-----------------------
(*type) = MSDD_NO_TRANSFER;
break;
//---------------------
case SBC_READ_CAPACITY_10:
//---------------------
(*type) = MSDD_DEVICE_TO_HOST;
(*length) = sizeof(SBCReadCapacity10Data);
break;
//---------------
case SBC_READ_10:
//---------------
(*type) = MSDD_DEVICE_TO_HOST;
(*length) = WORDB(sbcCommand->read10.pTransferLength)
* lun->blockSize;
break;
//----------------
case SBC_WRITE_10:
//----------------
(*type) = MSDD_HOST_TO_DEVICE;
(*length) = WORDB(sbcCommand->write10.pTransferLength)
* lun->blockSize;
break;
//-----------------
case SBC_VERIFY_10:
//-----------------
(*type) = MSDD_NO_TRANSFER;
break;
//------
default:
//------
isCommandSupported = 0;
}
// If length is 0, no transfer is expected
if ((*length) == 0) {
(*type) = MSDD_NO_TRANSFER;
}
return isCommandSupported;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------