complete the support for correct polling of 1ms 2ms 4ms 8ms

This commit is contained in:
hathach 2013-04-21 16:24:42 +07:00
parent a493fab753
commit ee9d53477a
2 changed files with 12 additions and 7 deletions

View File

@ -269,9 +269,9 @@ void test_open_interrupt_hs_interval_8(void)
pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
TEST_ASSERT_EQUAL(16, p_int_qhd->interval_ms);
TEST_ASSERT_EQUAL(255, p_int_qhd->interval_ms);
TEST_ASSERT_EQUAL(1, count_set_bits(p_int_qhd->interrupt_smask) );
check_int_endpoint_link( get_period_head(hostid, 16), p_int_qhd);
check_int_endpoint_link( get_period_head(hostid, 255), p_int_qhd);
check_int_endpoint_link( get_period_head(hostid, 8) , p_int_qhd);
}

View File

@ -524,13 +524,15 @@ void async_list_process_isr(ehci_qhd_t * const async_head)
// TODO abstract max loop guard for async
}
void period_list_process_isr(ehci_qhd_t const * const period_head)
void period_list_process_isr(uint8_t hostid, uint8_t interval_ms)
{
uint8_t max_loop = 0;
ehci_link_t next_item = period_head->next;
ehci_link_t next_item = * get_period_head(hostid, interval_ms);
// TODO abstract max loop guard for period
while( !next_item.terminate && max_loop < (EHCI_MAX_QHD + EHCI_MAX_ITD + EHCI_MAX_SITD))
while( !next_item.terminate &&
!(interval_ms > 1 && align32(next_item.address) == get_period_head(hostid, 1)) &&
max_loop < (EHCI_MAX_QHD + EHCI_MAX_ITD + EHCI_MAX_SITD))
{
switch ( next_item.type )
{
@ -641,12 +643,15 @@ void hcd_isr(uint8_t hostid)
//------------- some QTD/SITD/ITD with IOC set is completed -------------//
if (int_status & EHCI_INT_MASK_NXP_ASYNC)
{
async_list_process_isr(get_async_head(hostid));
async_list_process_isr( get_async_head(hostid) );
}
if (int_status & EHCI_INT_MASK_NXP_PERIODIC)
{
period_list_process_isr( get_period_head(hostid, 1) );
for (uint8_t i=1; i <= EHCI_FRAMELIST_SIZE; i *= 2)
{
period_list_process_isr( hostid, i );
}
}
//------------- There is some removed async previously -------------//