Information Technology Reference
In-Depth Information
The InquiryResponse data normally doesn't change, so a device can store the
data in ROM:
const rom InquiryResponse inq_resp = {
0x00,
// direct access block device, connected
0x80,
// device is removable
0x04,
// SPC-2 compliance
0x02,
// response data format
0x20,
// response has 20h + 4 bytes
0x00,
// additional fields, none set
0x00,
// additional fields, none set
0x00,
// additional fields, none set
"Microchp",
// 8 -byte T10-assigned Vendor ID
"Mass Storage ",
// 16-byte product identification
"0001"
// 4-byte product revision level
};
Sending the Response
The MSDInquiryHandler function copies an InquiryResponse structure to
msd_buffer (defined in Chapter 3) for sending to the host and sets the
CSWDDataResidue and CSWStatus fields of the command's CSW.
The function calls the memcopypgm2ram function provided with the
Microchip C18 compiler. The function copies the response data from pro-
gram memory into RAM.
void MSDInquiryHandler(void)
{
byte
i;
byte
*buffer;
// Copy sizeof(InquiryResponse) bytes from program memory beginning at
// &inq_resp to RAM beginning at &med_buffer[0].
memcpypgm2ram
((byte *)&msd_buffer[0],
(byte *)&inq_resp,
sizeof(InquiryResponse));
msd_csw.dCSWDataResidue = sizeof(InquiryResponse);
msd_csw.bCSWStatus = 0x00;
return;
}
Search WWH ::




Custom Search