mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-20 18:40:57 +00:00
fix msc device driver logic
This commit is contained in:
parent
14471f3154
commit
f25cf35634
@ -211,7 +211,7 @@ tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, u
|
||||
}
|
||||
else
|
||||
{
|
||||
p_msc->data_len = tud_msc_scsi_cb(rhport, p_cbw->lun, p_cbw->command, _mscd_buf, &p_msc->data_len);
|
||||
p_msc->data_len = tud_msc_scsi_cb(rhport, p_cbw->lun, p_cbw->command, _mscd_buf, p_msc->data_len);
|
||||
p_csw->status = (p_msc->data_len >= 0) ? MSC_CSW_STATUS_PASSED : MSC_CSW_STATUS_FAILED;
|
||||
|
||||
TU_ASSERT( p_cbw->xfer_bytes >= p_msc->data_len, TUSB_ERROR_INVALID_PARA ); // cannot return more than host expect
|
||||
@ -329,7 +329,7 @@ static void proc_read10_write10(uint8_t rhport, mscd_interface_t* p_msc)
|
||||
// Write10 callback will be called later when usb transfer complete
|
||||
if (SCSI_CMD_READ_10 == p_cbw->command[0])
|
||||
{
|
||||
int32_t rd_cnt = tud_msc_read10_cb (rhport, p_cbw->lun, lba, p_msc->xferred_len, _mscd_buf, (uint32_t) xfer_bytes);
|
||||
xfer_bytes = tud_msc_read10_cb (rhport, p_cbw->lun, lba, p_msc->xferred_len, _mscd_buf, (uint32_t) xfer_bytes);
|
||||
}
|
||||
|
||||
if ( xfer_bytes < 0 )
|
||||
|
@ -127,12 +127,12 @@ int32_t tud_msc_write10_cb (uint8_t rhport, uint8_t lun, uint32_t lba, uint32_t
|
||||
* endpoint and return failed status in command status wrapper phase.
|
||||
* \retval otherwise Actual bytes processed, must not be more than \a \b bufsize. Can be zero for no-data command.
|
||||
*/
|
||||
int32_t tud_msc_scsi_cb (uint8_t rhport, uint8_t lun, uint8_t scsi_cmd[16], void* buffer, uint16_t bufsize);
|
||||
int32_t tud_msc_scsi_cb (uint8_t rhport, uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize);
|
||||
|
||||
/*------------- Optional callbacks : Could be used by application to free up resources -------------*/
|
||||
ATTR_WEAK void tud_msc_read10_complete_cb(uint8_t rhport, uint8_t lun);
|
||||
ATTR_WEAK void tud_msc_write10_complete_cb(uint8_t rhport, uint8_t lun);
|
||||
ATTR_WEAK void tud_msc_scsi_complete_cb(uint8_t rhport, uint8_t lun, uint8_t scsi_cmd[16]);
|
||||
ATTR_WEAK void tud_msc_scsi_complete_cb(uint8_t rhport, uint8_t lun, uint8_t const scsi_cmd[16]);
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
Loading…
x
Reference in New Issue
Block a user