Information Technology Reference
In-Depth Information
Handling Commands and Events
On receiving a command, firmware must decode the command and prepare
an appropriate response.
Decoding Commands
The SCSI command codes can have assigned friendly names:
#define INQUIRY 0x12
#define READ_FORMAT_CAPACITY 0x23
#define READ_CAPACITY 0x25
#define READ_10 0x28
#define WRITE_10 0x2a
#define REQUEST_SENSE 0x03
#define MODE_SENSE 0x1a
#define TEST_UNIT_READY 0x00
#define VERIFY 0x2f
#define STOP_START 0x1b
The MSDCommandHandler function decodes a received command code
and branches to one of the functions in this chapter to respond to the com-
mand. If the command isn't supported, the code sets the sense data and
fields in bCSWStatus.
byte *ptrNextData;
void MSDCommandHandler(void)
{
switch(gblCBW.CBWCB[0]) {
case INQUIRY:
MSDInquiryHandler();
break;
case READ_CAPACITY:
MSDReadCapacityHandler();
break;
case READ_10:
MSDReadHandler();
break;
case WRITE_10:
MSDWriteHandler();
break;
Search WWH ::




Custom Search