Information Technology Reference
In-Depth Information
the MSDDataOut function from Chapter 3 to write the received data to the
storage media.
void MSDWriteHandler()
{
byte * adr;
byte Flags;
word i;
DWORD LBA;
dword sectorNumber;
SDC_Error status = sdcValid;
WORD
TransferLength;
// The command block stores MSB first. Device firmware stores LSB first.
// The starting LBA to write to is in bytes 2-5 in the command block.
LBA.v[3] = gblCBW.CBWCB[2];
LBA.v[2] = gblCBW.CBWCB[3];
LBA.v[1] = gblCBW.CBWCB[4];
LBA.v[0] = gblCBW.CBWCB[5];
// The number of blocks being written is in bytes 7-8 of the CBW.
TransferLength.v[1] = gblCBW.CBWCB[7];
TransferLength.v[0] = gblCBW.CBWCB[8];
// Set bCSWStatus to a default value.
msd_csw.bCSWStatus = 0x0; // Success.
Search WWH ::




Custom Search