mirror of
https://github.com/hathach/tinyusb.git
synced 2025-05-09 23:31:09 +08:00
refractor
- remove unnecessary assign next pointer of asyn/period head in hcd_controller_init
This commit is contained in:
parent
c2b9e1ef83
commit
97a4a41b82
@ -122,8 +122,6 @@ void test_hcd_init_async_list(void)
|
|||||||
TEST_ASSERT_FALSE(async_head->next.terminate);
|
TEST_ASSERT_FALSE(async_head->next.terminate);
|
||||||
|
|
||||||
TEST_ASSERT(async_head->head_list_flag);
|
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);
|
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(period_head->smask)
|
||||||
TEST_ASSERT_TRUE(period_head->next.terminate);
|
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);
|
TEST_ASSERT(period_head->qtd_overlay.halted);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -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_addr, p_qhd->hub_address);
|
||||||
TEST_ASSERT_EQUAL(hub_port, p_qhd->hub_port);
|
TEST_ASSERT_EQUAL(hub_port, p_qhd->hub_port);
|
||||||
TEST_ASSERT_EQUAL(1, p_qhd->mult);
|
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.next.terminate);
|
||||||
TEST_ASSERT(p_qhd->qtd_overlay.alternate.terminate);
|
TEST_ASSERT(p_qhd->qtd_overlay.alternate.terminate);
|
||||||
|
|
||||||
|
@ -158,13 +158,10 @@ tusb_error_t hcd_controller_init(uint8_t hostid)
|
|||||||
ehci_qhd_t * const async_head = get_async_head(hostid);
|
ehci_qhd_t * const async_head = get_async_head(hostid);
|
||||||
memclr_(async_head, sizeof(ehci_qhd_t));
|
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->next.type = EHCI_QUEUE_ELEMENT_QHD;
|
||||||
async_head->head_list_flag = 1;
|
async_head->head_list_flag = 1;
|
||||||
|
async_head->qtd_overlay.halted = 1; // inactive most of time
|
||||||
async_head->qtd_overlay.next.terminate = 1;
|
|
||||||
async_head->qtd_overlay.alternate.terminate = 1;
|
|
||||||
async_head->qtd_overlay.halted = 1;
|
|
||||||
|
|
||||||
regs->async_list_base = (uint32_t) async_head;
|
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->smask = 1; // queue head in period list must have smask non-zero
|
||||||
period_head->next.terminate = 1;
|
period_head->next.terminate = 1;
|
||||||
period_head->qtd_overlay.next.terminate = 1;
|
period_head->qtd_overlay.halted = 1; // dummy node, always inactive
|
||||||
period_head->qtd_overlay.alternate.terminate = 1;
|
|
||||||
period_head->qtd_overlay.halted = 1;
|
|
||||||
|
|
||||||
regs->periodic_list_base = (uint32_t) framelist;
|
regs->periodic_list_base = (uint32_t) framelist;
|
||||||
#else
|
#else
|
||||||
@ -349,23 +344,24 @@ static inline ehci_qtd_t* get_control_qtds(uint8_t dev_addr)
|
|||||||
|
|
||||||
static void queue_head_init(ehci_qhd_t *p_qhd, uint8_t dev_addr, uint16_t max_packet_size, uint8_t endpoint_addr, uint8_t xfer_type)
|
static void queue_head_init(ehci_qhd_t *p_qhd, uint8_t dev_addr, uint16_t max_packet_size, uint8_t endpoint_addr, uint8_t xfer_type)
|
||||||
{
|
{
|
||||||
p_qhd->device_address = dev_addr;
|
p_qhd->device_address = dev_addr;
|
||||||
p_qhd->inactive_next_xact = 0;
|
p_qhd->inactive_next_xact = 0;
|
||||||
p_qhd->endpoint_number = endpoint_addr & 0x0F;
|
p_qhd->endpoint_number = endpoint_addr & 0x0F;
|
||||||
p_qhd->endpoint_speed = usbh_device_info_pool[dev_addr].speed;
|
p_qhd->endpoint_speed = usbh_device_info_pool[dev_addr].speed;
|
||||||
p_qhd->data_toggle_control = (xfer_type == TUSB_XFER_CONTROL) ? 1 : 0;
|
p_qhd->data_toggle_control = (xfer_type == TUSB_XFER_CONTROL) ? 1 : 0;
|
||||||
p_qhd->head_list_flag = (dev_addr == 0) ? 1 : 0; // addr0's endpoint is the static asyn list head
|
p_qhd->head_list_flag = (dev_addr == 0) ? 1 : 0; // addr0's endpoint is the static asyn list head
|
||||||
p_qhd->max_package_size = max_packet_size;
|
p_qhd->max_package_size = max_packet_size;
|
||||||
p_qhd->non_hs_control_endpoint = ((TUSB_XFER_CONTROL == xfer_type) && (usbh_device_info_pool[dev_addr].speed != TUSB_SPEED_HIGH) ) ? 1 : 0;
|
p_qhd->non_hs_control_endpoint = ((TUSB_XFER_CONTROL == xfer_type) && (usbh_device_info_pool[dev_addr].speed != TUSB_SPEED_HIGH) ) ? 1 : 0;
|
||||||
p_qhd->nak_count_reload = 0;
|
p_qhd->nak_count_reload = 0;
|
||||||
|
|
||||||
p_qhd->smask = 0;
|
p_qhd->smask = 0;
|
||||||
p_qhd->cmask = 0;
|
p_qhd->cmask = 0;
|
||||||
p_qhd->hub_address = usbh_device_info_pool[dev_addr].hub_addr;
|
p_qhd->hub_address = usbh_device_info_pool[dev_addr].hub_addr;
|
||||||
p_qhd->hub_port = usbh_device_info_pool[dev_addr].hub_port;
|
p_qhd->hub_port = usbh_device_info_pool[dev_addr].hub_port;
|
||||||
p_qhd->mult = 1; // TODO not use high bandwidth/park mode yet
|
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.next.terminate = 1;
|
||||||
p_qhd->qtd_overlay.alternate.terminate = 1;
|
p_qhd->qtd_overlay.alternate.terminate = 1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user