Browse Source

fix potential bug when insert new queue head to list

hathach 13 years ago
parent
commit
b15694bc5f

+ 2 - 2
tests/test/host/ehci/test_pipe_interrupt_open.c

@@ -124,7 +124,7 @@ void verify_int_qhd(ehci_qhd_t *p_qhd, tusb_descriptor_endpoint_t const * desc_e
   verify_open_qhd(p_qhd, desc_endpoint->bEndpointAddress, desc_endpoint->wMaxPacketSize);
 
   TEST_ASSERT_FALSE(p_qhd->head_list_flag);
-  TEST_ASSERT_EQUAL(0, p_qhd->data_toggle_control);
+  TEST_ASSERT_FALSE(p_qhd->data_toggle_control);
   TEST_ASSERT_FALSE(p_qhd->non_hs_control_endpoint);
 
   //  TEST_ASSERT_EQUAL(desc_endpoint->bInterval); TDD highspeed bulk/control OUT
@@ -153,7 +153,7 @@ void test_open_interrupt_qhd_hs(void)
   verify_int_qhd(p_qhd, &desc_ept_interrupt_out, TUSB_CLASS_HID);
 
   TEST_ASSERT_EQUAL(0xFF, p_qhd->interrupt_smask);
-  //TEST_ASSERT_EQUAL(0, p_qhd->non_hs_interrupt_cmask); cmask in high speed is ignored
+//  TEST_ASSERT_EQUAL(0, p_qhd->non_hs_interrupt_cmask);
 }
 
 void test_open_interrupt_qhd_non_hs(void)

+ 1 - 2
tinyusb/host/ehci/ehci.c

@@ -755,8 +755,7 @@ static void qtd_init(ehci_qtd_t* p_qtd, uint32_t data_ptr, uint16_t total_bytes)
 static inline void list_insert(ehci_link_t *current, ehci_link_t *new, uint8_t new_type)
 {
   new->address = current->address;
-  current->address = (uint32_t) new;
-  current->type = new_type;
+  current->address = ((uint32_t) new) | (new_type << 1);
 }
 
 static ehci_qhd_t* list_find_previous_qhd(ehci_qhd_t* p_head, ehci_qhd_t* p_qhd)

+ 1 - 1
tinyusb/host/ehci/ehci.h

@@ -252,7 +252,7 @@ typedef struct {
 	// End of Word 1
 
 	/// Word 2: Micro-frame Schedule Control
-	uint8_t interrupt_smask     ; ///< This field (along with the Activeand SplitX-statefields in the Statusbyte) are used to determine during which micro-frames the host controller should execute complete-split transactions
+	uint8_t interrupt_smask            ; ///< This field (along with the Activeand SplitX-statefields in the Statusbyte) are used to determine during which micro-frames the host controller should execute complete-split transactions
 	uint8_t non_hs_interrupt_cmask     ; ///< This field (along with the Activeand SplitX-statefields in the Statusbyte) are used to determine during which micro-frames the host controller should execute start-split transactions.
 	uint16_t reserved ; ///< reserved
 	// End of Word 2