From 958d390a852160f040508775202e827766fc0498 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 1 Jul 2013 20:28:16 +0700 Subject: [PATCH] refractor code --- tinyusb/host/ehci/ehci.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index f30c9844f..5ef8d0250 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -614,17 +614,10 @@ void xfer_error_isr(uint8_t hostid) p_qhd->p_qtd_list_head->used = 0; // free QTD qtd_remove_1st_from_qhd(p_qhd); - pipe_handle_t pipe_hdl = { - .dev_addr = p_qhd->device_address, - .xfer_type = TUSB_XFER_CONTROL - }; + tusb_xfer_type_t xfer_type = p_qhd->endpoint_number != 0 ? TUSB_XFER_BULK : TUSB_XFER_CONTROL; - if (p_qhd->endpoint_number) // if not Control, can only be Bulk - { - pipe_hdl.xfer_type = TUSB_XFER_BULK; - pipe_hdl.index = qhd_get_index(p_qhd); - } - usbh_xfer_isr( pipe_hdl, p_qhd->class_code, TUSB_EVENT_XFER_ERROR); // call USBH callback + usbh_xfer_isr( qhd_create_pipe_handle(p_qhd, xfer_type), + p_qhd->class_code, TUSB_EVENT_XFER_ERROR); // call USBH callback } p_qhd = qhd_next(p_qhd);