diff options
| author | hathach <[email protected]> | 2013-11-05 13:02:15 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-11-05 13:02:15 +0700 |
| commit | 83d9ececfb1445c46b0a85da073d10ad932e6d4d (patch) | |
| tree | 7fd02869e69944251cd2be9660864cbed1d6d66a /tinyusb/class/msc_device.c | |
| parent | d02ef073376d3f57cbaf9e494ffd27ee113f1cf6 (diff) | |
msc add support
- SCSI_CMD_MODE_SELECT_6
- SCSI_CMD_MODE_SENSE_6
- SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL
fix msc device bug with no data unsupported command
complete msc device demo with ram disk of 8KB
Diffstat (limited to 'tinyusb/class/msc_device.c')
| -rw-r--r-- | tinyusb/class/msc_device.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tinyusb/class/msc_device.c b/tinyusb/class/msc_device.c index d1c225242..6e537810e 100644 --- a/tinyusb/class/msc_device.c +++ b/tinyusb/class/msc_device.c @@ -151,14 +151,17 @@ void mscd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_b ASSERT( p_msc->cbw.xfer_bytes >= actual_length, VOID_RETURN );
//------------- Data Phase -------------//
- if ( BIT_TEST_(p_msc->cbw.dir, 7) && p_buffer == NULL )
- { // application does not provide data to response --> possibly unsupported SCSI command
- ASSERT( TUSB_ERROR_NONE == dcd_pipe_stall(p_msc->edpt_in), VOID_RETURN );
- p_msc->csw.status = MSC_CSW_STATUS_FAILED;
- }else
+ if ( p_msc->cbw.xfer_bytes )
{
- ASSERT( dcd_pipe_queue_xfer( BIT_TEST_(p_msc->cbw.dir, 7) ? p_msc->edpt_in : p_msc->edpt_out,
- p_buffer, actual_length) == TUSB_ERROR_NONE, VOID_RETURN);
+ if ( p_buffer == NULL || actual_length == 0 )
+ { // application does not provide data to response --> possibly unsupported SCSI command
+ ASSERT( TUSB_ERROR_NONE == dcd_pipe_stall(p_msc->edpt_in), VOID_RETURN );
+ p_msc->csw.status = MSC_CSW_STATUS_FAILED;
+ }else
+ {
+ ASSERT( dcd_pipe_queue_xfer( BIT_TEST_(p_msc->cbw.dir, 7) ? p_msc->edpt_in : p_msc->edpt_out,
+ p_buffer, actual_length) == TUSB_ERROR_NONE, VOID_RETURN);
+ }
}
//------------- Status Phase -------------//
|
