summaryrefslogtreecommitdiff
path: root/tinyusb/host
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-07-01 15:30:29 +0700
committerhathach <[email protected]>2013-07-01 15:30:29 +0700
commit3f0d740776ec94ef49da69c94b70eeb1bd81af76 (patch)
treedf4cf4c2aa8043d4da51d96bb2f8ac6aeb7477be /tinyusb/host
parent35adca5ba3517462417a439b8ee82bf43a4b6b67 (diff)
rename usbh_isr to usbh_xfer_isr
Diffstat (limited to 'tinyusb/host')
-rw-r--r--tinyusb/host/ehci/ehci.c21
-rw-r--r--tinyusb/host/ehci/ehci.h2
-rw-r--r--tinyusb/host/usbh.c2
-rw-r--r--tinyusb/host/usbh_hcd.h2
4 files changed, 19 insertions, 8 deletions
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c
index 0a15f9355..cbac11c99 100644
--- a/tinyusb/host/ehci/ehci.c
+++ b/tinyusb/host/ehci/ehci.c
@@ -519,19 +519,24 @@ void async_list_process_isr(ehci_qhd_t * const async_head)
{
// TD need to be freed and removed from qhd, before invoking callback
bool is_ioc = (p_qhd->p_qtd_list_head->int_on_complete != 0);
+ uint16_t actual_bytes_xferred = p_qhd->p_qtd_list_head->expected_bytes - p_qhd->p_qtd_list_head->total_bytes;
p_qhd->p_qtd_list_head->used = 0; // free QTD
qtd_remove_1st_from_qhd(p_qhd);
if (is_ioc) // end of request
{
- pipe_handle_t pipe_hdl = { .dev_addr = p_qhd->device_address };
+ pipe_handle_t pipe_hdl = {
+ .dev_addr = p_qhd->device_address,
+ .xfer_type = 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_isr( pipe_hdl, p_qhd->class_code, TUSB_EVENT_XFER_COMPLETE); // call USBH callback
+ usbh_xfer_isr( pipe_hdl, p_qhd->class_code, TUSB_EVENT_XFER_COMPLETE); // call USBH callback
}
}
@@ -572,7 +577,7 @@ void period_list_process_isr(uint8_t hostid, uint8_t interval_ms)
if (is_ioc) // end of request
{
- usbh_isr( (pipe_handle_t)
+ usbh_xfer_isr( (pipe_handle_t)
{
.dev_addr = p_qhd_int->device_address,
.xfer_type = TUSB_XFER_INTERRUPT,
@@ -617,13 +622,17 @@ 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 };
+ pipe_handle_t pipe_hdl = {
+ .dev_addr = p_qhd->device_address,
+ .xfer_type = 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);
+ pipe_hdl.index = qhd_get_index(p_qhd);
}
- usbh_isr( pipe_hdl, p_qhd->class_code, TUSB_EVENT_XFER_ERROR); // call USBH callback
+ usbh_xfer_isr( pipe_hdl, p_qhd->class_code, TUSB_EVENT_XFER_ERROR); // call USBH callback
}
p_qhd = (ehci_qhd_t*) align32(p_qhd->next.address);
diff --git a/tinyusb/host/ehci/ehci.h b/tinyusb/host/ehci/ehci.h
index 79526079f..ab2571df9 100644
--- a/tinyusb/host/ehci/ehci.h
+++ b/tinyusb/host/ehci/ehci.h
@@ -128,6 +128,8 @@ typedef struct {
struct {
uint32_t : 5;
uint32_t used : 1;
+ uint32_t : 10;
+ uint32_t expected_bytes : 16;
};
};
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 628cf637a..e4c20883b 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -236,7 +236,7 @@ tusb_interface_status_t usbh_pipe_status_get(pipe_handle_t pipe_hdl)
// USBH-HCD ISR/Callback API
//--------------------------------------------------------------------+
// interrupt caused by a TD (with IOC=1) in pipe of class class_code
-void usbh_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t event)
+void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t event)
{
uint8_t class_index = std_class_code_to_index(class_code);
if (class_index == 0) // Control transfer
diff --git a/tinyusb/host/usbh_hcd.h b/tinyusb/host/usbh_hcd.h
index fbb7379a7..c8b0a9f4a 100644
--- a/tinyusb/host/usbh_hcd.h
+++ b/tinyusb/host/usbh_hcd.h
@@ -113,7 +113,7 @@ extern usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1]; // including
//--------------------------------------------------------------------+
// callback from HCD ISR
//--------------------------------------------------------------------+
-void usbh_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t event);
+void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t event);
void usbh_device_plugged_isr(uint8_t hostid);
void usbh_device_unplugged_isr(uint8_t hostid);