33 #define INCLUDE_FROM_SCSI_C
49 .PeripheralQualifier = 0,
55 .ResponseDataFormat = 2,
60 .AdditionalLength = 0x1F,
66 .WideBus16Bit =
false,
67 .WideBus32Bit =
false,
71 .ProductID =
"Dataflash Disk",
72 .RevisionID = {
'0',
'.',
'0',
'0'},
80 .AdditionalLength = 0x0A,
85 uint8_t *disk_cache = (uint8_t *) 0x20000000;
86 static uint32_t MSC_Get_Block_Count(
void)
107 bool CommandSuccess =
false;
143 CommandSuccess =
true;
156 if (CommandSuccess) {
173 uint16_t BytesTransferred =
MIN(AllocationLength,
sizeof(
InquiryData));
176 if ((MSInterfaceInfo->
State.
CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||
205 uint8_t AllocationLength = MSInterfaceInfo->
State.
CommandBlock.SCSICommandData[4];
206 uint8_t BytesTransferred =
MIN(AllocationLength,
sizeof(
SenseData));
225 uint32_t LastBlockAddressInLUN = MSC_Get_Block_Count() - 1;
232 &LastBlockAddressInLUN,
233 sizeof(LastBlockAddressInLUN),
270 const bool IsDataRead)
301 if (BlockAddress >= MSC_Get_Block_Count())
326 (uint8_t *) disk_cache,
333 (uint8_t *) disk_cache,
342 uint16_t blocks, dummyblocks;
348 else if (blocks < TotalBlocks) {
349 dummyblocks = TotalBlocks - blocks;
351 else {dummyblocks = 0; }
353 (uint8_t *) startaddr,