27 #define CBW_SCSI_READ10_INIT_DEFAULT \
46 #define CBW_SCSI_WRITE10_INIT_DEFAULT \
66 static const
char cbwInquiry[ CBW_LEN ] __attribute__ ((aligned(4))) =
69 0x12, 0x34, 0x56, 0x78,
75 0x00, 0x00, 0x00, 0x00,
76 0x00, 0x00, 0x00, 0x00,
85 static const
char cbwReadCap[ CBW_LEN ] __attribute__ ((aligned(4))) =
88 0x12, 0x34, 0x56, 0x78,
93 0x00, 0x00, 0x00, 0x00,
94 0x00, 0x00, 0x00, 0x00,
95 0x00, 0x00, 0x00, 0x00,
104 static const
char cbwRs[ CBW_LEN ] __attribute__ ((aligned(4))) =
107 0x12, 0x34, 0x56, 0x78,
114 0x00, 0x00, 0x00, 0x00,
115 0x00, 0x00, 0x00, 0x00,
124 static const
char cbwTur[ CBW_LEN ] __attribute__ ((aligned(4))) =
127 0x12, 0x34, 0x56, 0x78,
128 0x00, 0x00, 0x00, 0x00,
131 0x00, 0x00, 0x00, 0x00,
132 0x00, 0x00, 0x00, 0x00,
133 0x00, 0x00, 0x00, 0x00,
139 static uint32_t lbaCount = 0;
140 static uint32_t lbaSize = 0;
167 DEBUG_USB_API_PUTS(
"\nMSDSCSI_Init(), typedef size error");
220 cbw.dCBWDataTransferLength = sectors * lbaSize;
221 cb->
Lba = __REV(lba);
224 if ((uint32_t)
MSDBOT_Xfer(&cbw, data) == cbw.dCBWDataTransferLength)
314 cbw.dCBWDataTransferLength = sectors * lbaSize;
315 cb->
Lba = __REV(lba);
318 if ((uint32_t)
MSDBOT_Xfer(&cbw, (
void*) data) == cbw.dCBWDataTransferLength)
bool MSDSCSI_TestUnitReady(void)
Issue a SCSI Test Unit Ready command.
#define SCSI_TESTUNIT_READY
SCSI Inquiry response data typedef.
#define SCSI_REQUESTSENSEDATA_LEN
SCSI Request Sense response data typedef.
SCSI Read Capacity response data typedef.
bool MSDSCSI_Write10(uint32_t lba, uint16_t sectors, const void *data)
Perform a SCSI Write(10) command.
SCSI interface for Mass Storage Devices (MSD).
uint32_t LogicalBlockAddress
#define SCSI_READCAPACITY
uint32_t LogicalBlockLength
int MSDBOT_Xfer(void *cbw, void *data)
Perform an MSD Bulk Only Transfer (BOT).
int MSDBOT_Init(USBH_Ep_TypeDef *out, USBH_Ep_TypeDef *in)
MSDBOT module initialization.
Definitions for the Bulk Only Transport protocol of USB Mass Storage devices.
SCSI Read 10 Command Descriptor Block (CDB) typedef.
bool MSDSCSI_RequestSense(MSDSCSI_RequestSenseData_TypeDef *data)
Issue a SCSI Request Sense command.
#define SCSI_READCAPACITYDATA_LEN
Bulk Only Transport (BOT) Command Block Wrapper (CBW) typedef.
#define SCSI_INQUIRYDATA_LEN
SCSI Write 10 Command Descriptor Block (CDB) typedef.
bool MSDSCSI_Init(USBH_Ep_TypeDef *out, USBH_Ep_TypeDef *in)
MSDSCSI module initialization.
#define SCSI_REQUESTSENSE
bool MSDSCSI_Read10(uint32_t lba, uint16_t sectors, void *data)
Issue a SCSI Read(10) command.
bool MSDSCSI_ReadCapacity(MSDSCSI_ReadCapacityData_TypeDef *data)
Issue a SCSI Read Capacity command.
bool MSDSCSI_Inquiry(MSDSCSI_InquiryData_TypeDef *data)
Issue a SCSI Inquiry command.