summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
authorhathach <[email protected]>2014-04-29 01:54:28 +0700
committerhathach <[email protected]>2014-04-29 01:54:28 +0700
commit5aacc633b43ed7f0caed87bcd559ce4cea3b2b13 (patch)
tree0850994393b3942e98f34bf1fd6adc89ae3c7742 /tinyusb
parentb7b1d530f4a7182d87f2438637c9fcd21a0cb51f (diff)
fix/correct the max_loop (upper bound for EHCI & OHCI) endpoint list. This causes multiple devices hub mounting problems previously
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/host/ehci/ehci.c12
-rw-r--r--tinyusb/host/ohci/ohci.c2
2 files changed, 7 insertions, 7 deletions
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c
index 2e2ce1001..b3069388a 100644
--- a/tinyusb/host/ehci/ehci.c
+++ b/tinyusb/host/ehci/ehci.c
@@ -592,7 +592,7 @@ static void async_list_xfer_complete_isr(ehci_qhd_t * const async_head)
}
p_qhd = qhd_next(p_qhd);
max_loop++;
- }while(p_qhd != async_head && max_loop < HCD_MAX_ENDPOINT); // async list traversal, stop if loop around
+ }while(p_qhd != async_head && max_loop < HCD_MAX_ENDPOINT*TUSB_CFG_HOST_DEVICE_MAX); // async list traversal, stop if loop around
// TODO abstract max loop guard for async
}
@@ -606,7 +606,7 @@ static void period_list_xfer_complete_isr(uint8_t hostid, uint8_t interval_ms)
// TODO abstract max loop guard for period
while( !next_item.terminate &&
!(interval_ms > 1 && period_1ms_addr == align32(next_item.address)) &&
- max_loop < (HCD_MAX_ENDPOINT + EHCI_MAX_ITD + EHCI_MAX_SITD))
+ max_loop < (HCD_MAX_ENDPOINT + EHCI_MAX_ITD + EHCI_MAX_SITD)*TUSB_CFG_HOST_DEVICE_MAX)
{
switch ( next_item.type )
{
@@ -646,8 +646,8 @@ static void qhd_xfer_error_isr(ehci_qhd_t * p_qhd)
p_qhd->total_xferred_bytes += p_qhd->p_qtd_list_head->expected_bytes - p_qhd->p_qtd_list_head->total_bytes;
- // TODO skip unplugged device
- if ( TUSB_EVENT_XFER_ERROR == error_event ) hal_debugger_breakpoint();
+
+// if ( TUSB_EVENT_XFER_ERROR == error_event ) hal_debugger_breakpoint(); // TODO skip unplugged device
p_qhd->p_qtd_list_head->used = 0; // free QTD
qtd_remove_1st_from_qhd(p_qhd);
@@ -691,7 +691,7 @@ static void xfer_error_isr(uint8_t hostid)
qhd_xfer_error_isr( p_qhd );
p_qhd = qhd_next(p_qhd);
max_loop++;
- }while(p_qhd != async_head && max_loop < HCD_MAX_ENDPOINT); // async list traversal, stop if loop around
+ }while(p_qhd != async_head && max_loop < HCD_MAX_ENDPOINT*TUSB_CFG_HOST_DEVICE_MAX); // async list traversal, stop if loop around
#if EHCI_PERIODIC_LIST
//------------- TODO refractor period list -------------//
@@ -704,7 +704,7 @@ static void xfer_error_isr(uint8_t hostid)
// TODO abstract max loop guard for period
while( !next_item.terminate &&
!(interval_ms > 1 && period_1ms_addr == align32(next_item.address)) &&
- period_max_loop < (HCD_MAX_ENDPOINT + EHCI_MAX_ITD + EHCI_MAX_SITD))
+ period_max_loop < (HCD_MAX_ENDPOINT + EHCI_MAX_ITD + EHCI_MAX_SITD)*TUSB_CFG_HOST_DEVICE_MAX)
{
switch ( next_item.type )
{
diff --git a/tinyusb/host/ohci/ohci.c b/tinyusb/host/ohci/ohci.c
index 128760779..ef6da66d5 100644
--- a/tinyusb/host/ohci/ohci.c
+++ b/tinyusb/host/ohci/ohci.c
@@ -384,7 +384,7 @@ static inline ohci_ed_t * ed_find_free(uint8_t dev_addr)
static ohci_ed_t * ed_list_find_previous(ohci_ed_t const * p_head, ohci_ed_t const * p_ed)
{
- uint32_t max_loop = HCD_MAX_ENDPOINT;
+ uint32_t max_loop = HCD_MAX_ENDPOINT*TUSB_CFG_HOST_DEVICE_MAX;
ohci_ed_t const * p_prev = p_head;