diff options
| author | hathach <[email protected]> | 2013-11-01 14:44:14 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-11-01 14:44:14 +0700 |
| commit | f2ae5b541faba4b0ea28b010cbf9eda53ff59d70 (patch) | |
| tree | 6063126507c43a7b8e5bc7deaffbe2408c1a36a1 /tinyusb/class | |
| parent | f797c4e02a1a2451e6ba9beca5a1be74fd0bf1ab (diff) | |
add dcd pipe clear stall
- tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr) but does not take endpoint_handle_t as input
complete msc device driver
add usbd clear stall endpoint
Diffstat (limited to 'tinyusb/class')
| -rw-r--r-- | tinyusb/class/msc_device.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tinyusb/class/msc_device.c b/tinyusb/class/msc_device.c index 7b2011ccf..f02a1584c 100644 --- a/tinyusb/class/msc_device.c +++ b/tinyusb/class/msc_device.c @@ -149,24 +149,21 @@ void mscd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_b p_msc->csw.data_residue = 0; // TODO expected length, response length
//------------- Data Phase -------------//
- if ( (p_msc->cbw.dir & BIT_(7)) && p_buffer == NULL )
+ 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 );
- }
-
- if ( p_msc->cbw.dir & BIT_(7) )
- {
- ASSERT( dcd_pipe_queue_xfer(p_msc->edpt_in, p_buffer, p_msc->cbw.xfer_bytes) == TUSB_ERROR_NONE, VOID_RETURN);
- } else
+ p_msc->csw.status = MSC_CSW_STATUS_FAILED;
+ }else
{
- ASSERT( dcd_pipe_queue_xfer(p_msc->edpt_out, p_buffer, p_msc->cbw.xfer_bytes) == TUSB_ERROR_NONE, VOID_RETURN);
+ 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);
}
//------------- Status Phase -------------//
ASSERT( dcd_pipe_xfer( p_msc->edpt_in , &p_msc->csw, sizeof(msc_cmd_status_wrapper_t), true) == TUSB_ERROR_NONE, VOID_RETURN );
//------------- Queue the next CBW -------------//
-// ASSERT( dcd_pipe_xfer( p_msc->edpt_out, &p_msc->cbw, sizeof(msc_cmd_block_wrapper_t), true) == TUSB_ERROR_NONE, VOID_RETURN );
+ ASSERT( dcd_pipe_xfer( p_msc->edpt_out, &p_msc->cbw, sizeof(msc_cmd_block_wrapper_t), true) == TUSB_ERROR_NONE, VOID_RETURN );
}
|
