USB_SetDeviceDataPtr(Dev, info);
info->BlockCount = MSC_SCSI_GetSize(Dev, &info->BlockSize);
USB_SetDeviceDataPtr(Dev, info);
info->BlockCount = MSC_SCSI_GetSize(Dev, &info->BlockSize);
LVM_AddVolume(&gMSC_SCSI_VolType, "0", Dev, info->BlockSize, info->BlockCount);
}
LVM_AddVolume(&gMSC_SCSI_VolType, "0", Dev, info->BlockSize, info->BlockCount);
}
Cbw->bCBWLength = CmdLen;
memcpy(Cbw->CBWCB, CmdData, CmdLen);
Cbw->bCBWLength = CmdLen;
memcpy(Cbw->CBWCB, CmdData, CmdLen);
const int endpoint_out = 2;
const int endpoint_in = 1;
const int max_packet_size = 64;
const int endpoint_out = 2;
const int endpoint_in = 1;
const int max_packet_size = 64;
if( MSC_int_CreateCBW(&cbw, 1, CmdLen, CmdData, DataLen) )
return ;
// Send CBW
if( MSC_int_CreateCBW(&cbw, 1, CmdLen, CmdData, DataLen) )
return ;
// Send CBW
USB_SendData(Dev, endpoint_out, sizeof(cbw), &cbw);
// Read Data
for( size_t ofs = 0; ofs < DataLen; ofs += max_packet_size )
{
USB_SendData(Dev, endpoint_out, sizeof(cbw), &cbw);
// Read Data
for( size_t ofs = 0; ofs < DataLen; ofs += max_packet_size )
{
// TODO: use async version and wait for the transaction to complete
USB_RecvData(Dev, endpoint_in, MIN(max_packet_size, DataLen - ofs), Data + ofs);
}
// Read CSW
// TODO: use async version and wait for the transaction to complete
USB_RecvData(Dev, endpoint_in, MIN(max_packet_size, DataLen - ofs), Data + ofs);
}
// Read CSW
USB_RecvData(Dev, endpoint_in, sizeof(csw), &csw);
// TODO: Validate CSW
}
USB_RecvData(Dev, endpoint_in, sizeof(csw), &csw);
// TODO: Validate CSW
}