From 3b0b48e01ae9ee11aed4e1ade1e413bea3608bd5 Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 10 Mar 2013 19:28:38 +0700 Subject: [PATCH] - add test code for bulk xfer isr - fix mismatch type func return --- .../test/host/ehci/test_ehci_pipe_bulk_xfer.c | 34 ++++++++++++++++--- tests/test/test_osal_none.c | 6 ++-- 2 files changed, 32 insertions(+), 8 deletions(-) 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 568cf1c4..97c9e88f 100644 --- a/tests/test/host/ehci/test_ehci_pipe_bulk_xfer.c +++ b/tests/test/host/ehci/test_ehci_pipe_bulk_xfer.c @@ -46,6 +46,7 @@ #include "mock_usbh_hcd.h" #include "ehci.h" #include "test_ehci.h" +#include "ehci_controller.h" extern ehci_data_t ehci_data; usbh_device_info_t usbh_device_info_pool[TUSB_CFG_HOST_DEVICE_MAX+1]; @@ -166,7 +167,7 @@ void test_bulk_xfer_double(void) hcd_pipe_xfer(pipe_hdl_bulk, data2, sizeof(data2), true); ehci_qtd_t* p_head = p_qhd_bulk->p_qtd_list_head; - ehci_qtd_t* p_tail = p_qhd_bulk->p_qtd_list_head; + ehci_qtd_t* p_tail = p_qhd_bulk->p_qtd_list_tail; //------------- list head -------------// TEST_ASSERT_NOT_NULL(p_head); @@ -177,9 +178,32 @@ void test_bulk_xfer_double(void) TEST_ASSERT_FALSE(p_head->int_on_complete); //------------- list tail -------------// + TEST_ASSERT_NOT_NULL(p_tail); + verify_qtd(p_tail, data2, sizeof(data2)); + TEST_ASSERT_EQUAL_HEX( align32(p_head->next.address), p_tail); + TEST_ASSERT_EQUAL(EHCI_PID_IN, p_tail->pid); + TEST_ASSERT_TRUE(p_tail->next.terminate); + TEST_ASSERT_TRUE(p_tail->int_on_complete); } -//void test_bulk_xfer_isr(void) -//{ -// -//} +void test_bulk_xfer_isr(void) +{ + hcd_pipe_xfer(pipe_hdl_bulk, xfer_data, sizeof(xfer_data), false); + hcd_pipe_xfer(pipe_hdl_bulk, data2, sizeof(data2), true); + + ehci_qtd_t* p_head = p_qhd_bulk->p_qtd_list_head; + ehci_qtd_t* p_tail = p_qhd_bulk->p_qtd_list_tail; + + ehci_controller_run(hostid); + + usbh_isr_Expect(pipe_hdl_bulk, TUSB_CLASS_MSC); + + //------------- Code Under Test -------------// + hcd_isr(hostid); + + TEST_ASSERT_TRUE(p_qhd_bulk->qtd_overlay.next.terminate); + TEST_ASSERT_FALSE(p_head->used); + TEST_ASSERT_FALSE(p_tail->used); + TEST_ASSERT_NULL(p_qhd_bulk->p_qtd_list_head); + TEST_ASSERT_NULL(p_qhd_bulk->p_qtd_list_tail); +} diff --git a/tests/test/test_osal_none.c b/tests/test/test_osal_none.c index 683e6d4c..fc89184b 100644 --- a/tests/test/test_osal_none.c +++ b/tests/test/test_osal_none.c @@ -106,7 +106,7 @@ void test_queue_send(void) //--------------------------------------------------------------------+ // TASK SEMAPHORE //--------------------------------------------------------------------+ -void sample_task_semaphore(void) +tusb_error_t sample_task_semaphore(void) { tusb_error_t error = TUSB_ERROR_NONE; @@ -165,7 +165,7 @@ void test_task_with_semaphore(void) //--------------------------------------------------------------------+ // TASK SEMAPHORE //--------------------------------------------------------------------+ -void sample_task_with_queue(void) +tusb_error_t sample_task_with_queue(void) { uint32_t data; tusb_error_t error; @@ -237,7 +237,7 @@ void flow_control_error_handler(void) statements[5]++; } -void sample_task_flow_control(void) +tusb_error_t sample_task_flow_control(void) { tusb_error_t error;