From b15694bc5fe9ddf076156cb03eb5a25cb7f80f5b Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 24 Mar 2013 22:24:27 +0700 Subject: [PATCH] fix potential bug when insert new queue head to list --- tests/test/host/ehci/test_pipe_interrupt_open.c | 4 ++-- tinyusb/host/ehci/ehci.c | 3 +-- tinyusb/host/ehci/ehci.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test/host/ehci/test_pipe_interrupt_open.c b/tests/test/host/ehci/test_pipe_interrupt_open.c index f9bffd90..8cf656c2 100644 --- a/tests/test/host/ehci/test_pipe_interrupt_open.c +++ b/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) diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index 558b6a5b..cd638c7b 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/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) diff --git a/tinyusb/host/ehci/ehci.h b/tinyusb/host/ehci/ehci.h index 673276ec..fdd991c0 100644 --- a/tinyusb/host/ehci/ehci.h +++ b/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