summaryrefslogtreecommitdiff
path: root/tinyusb/class
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-07-01 18:53:25 +0700
committerhathach <[email protected]>2013-07-01 18:53:25 +0700
commit3f9f3f08d2429ee51e1545464686f671253ac98f (patch)
tree5805ea841c0eb2f108d87ad4a9f3518d75dd547c /tinyusb/class
parentd8bd749c75fe0a65507b624eba0b5a472225e0c7 (diff)
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
Diffstat (limited to 'tinyusb/class')
-rw-r--r--tinyusb/class/cdc_host.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tinyusb/class/cdc_host.c b/tinyusb/class/cdc_host.c
index 81d992c21..9a3cb6ef8 100644
--- a/tinyusb/class/cdc_host.c
+++ b/tinyusb/class/cdc_host.c
@@ -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