added support for

- sense data scsi_sense_fixed_data_t
- read format capacity scsi_read_format_capacity_data_t

change msc device callback to support actual response
fix dcd_pipe_clear_stall also reset toggle
This commit is contained in:
hathach
2013-11-01 22:00:39 +07:00
parent f2ae5b541f
commit d02ef07337
6 changed files with 114 additions and 19 deletions

View File

@@ -141,13 +141,15 @@ void mscd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_b
p_msc->cbw.signature == MSC_CBW_SIGNATURE, VOID_RETURN );
void *p_buffer = NULL;
uint16_t actual_length = p_msc->cbw.xfer_bytes;
p_msc->csw.signature = MSC_CSW_SIGNATURE;
p_msc->csw.tag = p_msc->cbw.tag;
p_msc->csw.status = tusbd_msc_scsi_received_isr(edpt_hdl.coreid, p_msc->cbw.lun, p_msc->cbw.command, &p_buffer, p_msc->cbw.xfer_bytes);
p_msc->csw.signature = MSC_CSW_SIGNATURE;
p_msc->csw.tag = p_msc->cbw.tag;
p_msc->csw.status = tusbd_msc_scsi_received_isr(edpt_hdl.coreid, p_msc->cbw.lun, p_msc->cbw.command, &p_buffer, &actual_length);
p_msc->csw.data_residue = 0; // TODO expected length, response length
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
@@ -156,7 +158,7 @@ void mscd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_b
}else
{
ASSERT( dcd_pipe_queue_xfer( BIT_TEST_(p_msc->cbw.dir, 7) ? p_msc->edpt_in : p_msc->edpt_out,
p_buffer, p_msc->cbw.xfer_bytes) == TUSB_ERROR_NONE, VOID_RETURN);
p_buffer, actual_length) == TUSB_ERROR_NONE, VOID_RETURN);
}
//------------- Status Phase -------------//