refractor

- remove unnecessary assign next pointer of asyn/period head in hcd_controller_init
This commit is contained in:
hathach 2013-03-06 11:24:20 +07:00
parent c2b9e1ef83
commit 97a4a41b82
3 changed files with 20 additions and 26 deletions

View File

@ -122,8 +122,6 @@ void test_hcd_init_async_list(void)
TEST_ASSERT_FALSE(async_head->next.terminate);
TEST_ASSERT(async_head->head_list_flag);
TEST_ASSERT(async_head->qtd_overlay.next.terminate);
TEST_ASSERT(async_head->qtd_overlay.alternate.terminate);
TEST_ASSERT(async_head->qtd_overlay.halted);
}
}
@ -150,8 +148,6 @@ void test_hcd_init_period_list(void)
TEST_ASSERT(period_head->smask)
TEST_ASSERT_TRUE(period_head->next.terminate);
TEST_ASSERT(period_head->qtd_overlay.next.terminate);
TEST_ASSERT(period_head->qtd_overlay.alternate.terminate);
TEST_ASSERT(period_head->qtd_overlay.halted);
}
#endif

View File

@ -114,6 +114,8 @@ void verify_open_qhd(ehci_qhd_t *p_qhd)
TEST_ASSERT_EQUAL(hub_addr, p_qhd->hub_address);
TEST_ASSERT_EQUAL(hub_port, p_qhd->hub_port);
TEST_ASSERT_EQUAL(1, p_qhd->mult);
TEST_ASSERT_FALSE(p_qhd->qtd_overlay.halted);
TEST_ASSERT(p_qhd->qtd_overlay.next.terminate);
TEST_ASSERT(p_qhd->qtd_overlay.alternate.terminate);

View File

@ -158,13 +158,10 @@ tusb_error_t hcd_controller_init(uint8_t hostid)
ehci_qhd_t * const async_head = get_async_head(hostid);
memclr_(async_head, sizeof(ehci_qhd_t));
async_head->next.address = align32( (uint32_t) async_head); // circular list, next is itself
async_head->next.address = (uint32_t) async_head; // circular list, next is itself
async_head->next.type = EHCI_QUEUE_ELEMENT_QHD;
async_head->head_list_flag = 1;
async_head->qtd_overlay.next.terminate = 1;
async_head->qtd_overlay.alternate.terminate = 1;
async_head->qtd_overlay.halted = 1;
async_head->qtd_overlay.halted = 1; // inactive most of time
regs->async_list_base = (uint32_t) async_head;
@ -182,9 +179,7 @@ tusb_error_t hcd_controller_init(uint8_t hostid)
period_head->smask = 1; // queue head in period list must have smask non-zero
period_head->next.terminate = 1;
period_head->qtd_overlay.next.terminate = 1;
period_head->qtd_overlay.alternate.terminate = 1;
period_head->qtd_overlay.halted = 1;
period_head->qtd_overlay.halted = 1; // dummy node, always inactive
regs->periodic_list_base = (uint32_t) framelist;
#else
@ -365,7 +360,8 @@ static void queue_head_init(ehci_qhd_t *p_qhd, uint8_t dev_addr, uint16_t max_pa
p_qhd->hub_port = usbh_device_info_pool[dev_addr].hub_port;
p_qhd->mult = 1; // TODO not use high bandwidth/park mode yet
//------------- inactive when just opened -------------//
//------------- active, but no TD list -------------//
p_qhd->qtd_overlay.halted = 0;
p_qhd->qtd_overlay.next.terminate = 1;
p_qhd->qtd_overlay.alternate.terminate = 1;