add cdc host driver close cdch_close

refractor
- add helper function in ehci qhd_next & qtd_next
- extract function qhd_create_pipe_handle
rename tusb_transfer_type_t to tusb_xfer_type_t
add some handling for stall
This commit is contained in:
hathach
2013-07-01 18:53:25 +07:00
parent d8bd749c75
commit 3f9f3f08d2
4 changed files with 88 additions and 25 deletions

View File

@@ -142,7 +142,30 @@ void cdch_isr(pipe_handle_t pipe_hdl, tusb_event_t event)
void cdch_close(uint8_t dev_addr)
{
tusb_error_t err1, err2, err3;
cdch_data_t * p_cdc = &cdch_data[dev_addr-1];
if ( pipehandle_is_valid(p_cdc->pipe_notification) )
{
err1 = hcd_pipe_close(p_cdc->pipe_notification);
}
if ( pipehandle_is_valid(p_cdc->pipe_in) )
{
err2 = hcd_pipe_close(p_cdc->pipe_in);
}
if ( pipehandle_is_valid(p_cdc->pipe_out) )
{
err3 = hcd_pipe_close(p_cdc->pipe_out);
}
memclr_(p_cdc, sizeof(cdch_data_t));
ASSERT(err1 == TUSB_ERROR_NONE &&
err2 == TUSB_ERROR_NONE &&
err3 == TUSB_ERROR_NONE, (void) 0 );
}
#endif