diff options
| author | hathach <[email protected]> | 2013-03-09 13:11:02 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-03-09 13:11:02 +0700 |
| commit | b1db85dedf5546bee594a40ba41cf644bf7b3ae0 (patch) | |
| tree | 186060e03f943865bcdbea2e77efce19396279af /tests | |
| parent | b146730306ff9f5e3d8dea520a62a5a25d33f92b (diff) | |
- addd p_qtd_list_tail to qhd structure for easy queue TD
- move control_request from ehci_data to usbh_device_info_pool
- add test for bulk transfer double (2 consecutive xfers)
- use table (array) structure for class driver, currently included
- refractor extract to function insert_qtd_to_qhd
+ init function
+ install_subtask
--> all class driver function must be declared with WEAK
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test/host/ehci/test_ehci_pipe.c | 1 | ||||
| -rw-r--r-- | tests/test/host/ehci/test_ehci_pipe_bulk_xfer.c | 20 | ||||
| -rw-r--r-- | tests/test/host/ehci/test_ehci_pipe_xfer.c | 4 |
3 files changed, 17 insertions, 8 deletions
diff --git a/tests/test/host/ehci/test_ehci_pipe.c b/tests/test/host/ehci/test_ehci_pipe.c index a6ce8cb08..0d59bbd8d 100644 --- a/tests/test/host/ehci/test_ehci_pipe.c +++ b/tests/test/host/ehci/test_ehci_pipe.c @@ -114,6 +114,7 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack //------------- HCD -------------// TEST_ASSERT(p_qhd->used); TEST_ASSERT_NULL(p_qhd->p_qtd_list_head); + TEST_ASSERT_NULL(p_qhd->p_qtd_list_tail); } //--------------------------------------------------------------------+ diff --git a/tests/test/host/ehci/test_ehci_pipe_bulk_xfer.c b/tests/test/host/ehci/test_ehci_pipe_bulk_xfer.c index 6a7bdf509..5ee4a04e1 100644 --- a/tests/test/host/ehci/test_ehci_pipe_bulk_xfer.c +++ b/tests/test/host/ehci/test_ehci_pipe_bulk_xfer.c @@ -59,6 +59,7 @@ uint8_t const hub_port = 2; uint8_t dev_addr; uint8_t hostid; uint8_t xfer_data [18000]; // 18K to test buffer pointer list +uint8_t data2[100]; ehci_qhd_t *async_head; ehci_qhd_t *p_qhd_bulk; @@ -128,9 +129,11 @@ void verify_qtd(ehci_qtd_t *p_qtd, uint8_t p_data[], uint16_t length) TEST_ASSERT_FALSE(p_qtd->halted); TEST_ASSERT_TRUE(p_qtd->active); + TEST_ASSERT_FALSE(p_qtd->data_toggle); TEST_ASSERT_EQUAL(3, p_qtd->cerr); TEST_ASSERT_EQUAL(0, p_qtd->current_page); TEST_ASSERT_EQUAL(length, p_qtd->total_bytes); + TEST_ASSERT_TRUE(p_qtd->used); TEST_ASSERT_EQUAL_HEX( p_data, p_qtd->buffer[0] ); for(uint8_t i=1; i<5; i++) @@ -149,24 +152,29 @@ void test_bulk_xfer(void) TEST_ASSERT_NOT_NULL(p_qtd); verify_qtd( p_qtd, xfer_data, sizeof(xfer_data)); - TEST_ASSERT_TRUE(p_qtd->used); + TEST_ASSERT_EQUAL_HEX(p_qhd_bulk->qtd_overlay.next.address, p_qtd); TEST_ASSERT_TRUE(p_qtd->next.terminate); TEST_ASSERT_EQUAL(EHCI_PID_IN, p_qtd->pid); TEST_ASSERT_TRUE(p_qtd->int_on_complete); - TEST_ASSERT_FALSE(p_qtd->data_toggle); } void test_bulk_xfer_double(void) { - uint8_t data2[100]; //------------- Code Under Test -------------// hcd_pipe_xfer(pipe_hdl_bulk, xfer_data, sizeof(xfer_data)); hcd_pipe_xfer(pipe_hdl_bulk, data2, sizeof(data2)); - ehci_qtd_t* p_qtd = p_qhd_bulk->p_qtd_list_head; - TEST_ASSERT_NOT_NULL(p_qtd); + ehci_qtd_t* p_head = p_qhd_bulk->p_qtd_list_head; + ehci_qtd_t* p_tail = p_qhd_bulk->p_qtd_list_head; - TEST_ASSERT_FALSE(p_qtd->next.terminate); + //------------- list head -------------// + TEST_ASSERT_NOT_NULL(p_head); + verify_qtd(p_head, xfer_data, sizeof(xfer_data)); + TEST_ASSERT_EQUAL_HEX(p_qhd_bulk->qtd_overlay.next.address, p_head); + TEST_ASSERT_EQUAL(EHCI_PID_IN, p_head->pid); + TEST_ASSERT_FALSE(p_head->next.terminate); + TEST_ASSERT_FALSE(p_head->int_on_complete); + //------------- list tail -------------// } diff --git a/tests/test/host/ehci/test_ehci_pipe_xfer.c b/tests/test/host/ehci/test_ehci_pipe_xfer.c index 586b8a1d2..08d1d15ad 100644 --- a/tests/test/host/ehci/test_ehci_pipe_xfer.c +++ b/tests/test/host/ehci/test_ehci_pipe_xfer.c @@ -162,7 +162,7 @@ void test_control_addr0_xfer_get_check_qhd_qtd_mapping(void) TEST_ASSERT_EQUAL_HEX( p_status , p_data->next.address ); TEST_ASSERT_TRUE( p_status->next.terminate ); - verify_qtd(p_setup, &ehci_data.control_request[0], 8); + verify_qtd(p_setup, &usbh_device_info_pool[0].control_request, 8); } @@ -181,7 +181,7 @@ void test_control_xfer_get(void) TEST_ASSERT_TRUE( p_status->next.terminate ); //------------- SETUP -------------// - uint8_t* p_request = (uint8_t *) &ehci_data.control_request[dev_addr]; + uint8_t* p_request = (uint8_t *) &usbh_device_info_pool[dev_addr].control_request; verify_qtd(p_setup, p_request, 8); TEST_ASSERT_EQUAL_MEMORY(&request_get_dev_desc, p_request, sizeof(tusb_std_request_t)); |
