-
-
Save voidlizard/f4691b584575c41e26fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int8_t SCSI_Read10(uint8_t lun , uint8_t *params) | |
{ | |
if(MSC_BOT_State == BOT_IDLE) /* Idle */ | |
{ | |
/* case 10 : Ho <> Di */ | |
if ((MSC_BOT_cbw.bmFlags & 0x80) != 0x80) | |
{ | |
SCSI_SenseCode(MSC_BOT_cbw.bLUN, | |
ILLEGAL_REQUEST, | |
INVALID_CDB); | |
return -1; | |
} | |
if(USBD_STORAGE_fops->IsReady(lun) !=0 ) | |
{ | |
SCSI_SenseCode(lun, | |
NOT_READY, | |
MEDIUM_NOT_PRESENT); | |
return -1; | |
} | |
SCSI_blk_addr = (params[2] << 24) | \ | |
(params[3] << 16) | \ | |
(params[4] << 8) | \ | |
params[5]; | |
SCSI_blk_len = (params[7] << 8) | \ | |
params[8]; | |
if( SCSI_CheckAddressRange(lun, SCSI_blk_addr, SCSI_blk_len) < 0) | |
{ | |
return -1; /* error */ | |
} | |
MSC_BOT_State = BOT_DATA_IN; // SCSI_blk_addr :: uint32_t, SCSI_blk_size :: uint32_t === 512 , 8 400 000 * 512 = 4300900000 | |
SCSI_blk_addr *= SCSI_blk_size; // FUCKUP | |
SCSI_blk_len *= SCSI_blk_size; | |
/* cases 4,5 : Hi <> Dn */ | |
if (MSC_BOT_cbw.dDataLength != SCSI_blk_len) | |
{ | |
SCSI_SenseCode(MSC_BOT_cbw.bLUN, | |
ILLEGAL_REQUEST, | |
INVALID_CDB); | |
return -1; | |
} | |
} | |
MSC_BOT_DataLen = MSC_MEDIA_PACKET; | |
return SCSI_ProcessRead(lun); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment