diff options
| author | hathach <[email protected]> | 2013-02-28 17:00:51 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-02-28 17:00:51 +0700 |
| commit | 795fe7468d35b62987cee07d35c7cf452447ea70 (patch) | |
| tree | 8be32c99910341d1b9671b8d047c26da04e1c697 /tests | |
| parent | 82bd4719ce1ab3d67c6d5f32973312250b8a443c (diff) | |
start to add code for hcd_init test
change hcd_init signature (omit hostid)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test/host/ehci/test_ehci.c | 19 | ||||
| -rw-r--r-- | tests/test/host/test_usbh.c | 12 |
2 files changed, 21 insertions, 10 deletions
diff --git a/tests/test/host/ehci/test_ehci.c b/tests/test/host/ehci/test_ehci.c index ec7f821a5..2c6797109 100644 --- a/tests/test/host/ehci/test_ehci.c +++ b/tests/test/host/ehci/test_ehci.c @@ -42,6 +42,9 @@ #include "mock_osal.h" #include "ehci.h" +extern ehci_data_t ehci_data; +extern ehci_link_t period_frame_list0[EHCI_FRAMELIST_SIZE]; +extern ehci_link_t period_frame_list1[EHCI_FRAMELIST_SIZE]; //--------------------------------------------------------------------+ // Setup/Teardown + helper declare @@ -281,9 +284,23 @@ void test_register_portsc(void) //--------------------------------------------------------------------+ // EHCI Data Organization //--------------------------------------------------------------------+ -void test_(void) +void test_ehci_data(void) { + // period fram list alignment + TEST_ASSERT_BITS_LOW(4096-1, (uint32_t)period_frame_list0 ); + TEST_ASSERT_BITS_LOW(4096-1, (uint32_t)period_frame_list1 ); + // +} + +void test_hcd_init(void) +{ + hcd_init(0); + + //------------- check memory data -------------// + ehci_data_t zeroes; + memclr_(&zeroes, sizeof(ehci_data_t)); + TEST_ASSERT_EQUAL_MEMORY(&zeroes, &ehci_data, sizeof(ehci_data_t)); } //--------------------------------------------------------------------+ diff --git a/tests/test/host/test_usbh.c b/tests/test/host/test_usbh.c index 3ca029219..e8b38eda6 100644 --- a/tests/test/host/test_usbh.c +++ b/tests/test/host/test_usbh.c @@ -78,12 +78,6 @@ void test_usbh_status_get_succeed(void) //--------------------------------------------------------------------+ // Init //--------------------------------------------------------------------+ -void hcd_init_expect(void) -{ - for(uint32_t i=0; i<TUSB_CFG_HOST_CONTROLLER_NUM; i++) - hcd_init_ExpectAndReturn(TUSB_CFG_HOST_CONTROLLER_START_INDEX+i, TUSB_ERROR_NONE); -} - void test_usbh_init_hcd_failed(void) { hcd_init_IgnoreAndReturn(TUSB_ERROR_HCD_FAILED); @@ -92,14 +86,14 @@ void test_usbh_init_hcd_failed(void) void test_usbh_init_enum_task_create_failed(void) { - hcd_init_expect(); + hcd_init_ExpectAndReturn(TUSB_ERROR_NONE); osal_task_create_IgnoreAndReturn(TUSB_ERROR_OSAL_TASK_FAILED); TEST_ASSERT_EQUAL(TUSB_ERROR_OSAL_TASK_FAILED, usbh_init()); } void test_usbh_init_enum_queue_create_failed(void) { - hcd_init_expect(); + hcd_init_ExpectAndReturn(TUSB_ERROR_NONE); osal_task_create_IgnoreAndReturn(TUSB_ERROR_NONE); osal_queue_create_IgnoreAndReturn(NULL); TEST_ASSERT_EQUAL(TUSB_ERROR_OSAL_QUEUE_FAILED, usbh_init()); @@ -129,7 +123,7 @@ void test_usbh_init_ok(void) usbh_device_info_t device_info_zero[TUSB_CFG_HOST_DEVICE_MAX+1]; memclr_(device_info_zero, sizeof(usbh_device_info_t)*(TUSB_CFG_HOST_DEVICE_MAX+1)); - hcd_init_expect(); + hcd_init_ExpectAndReturn(TUSB_ERROR_NONE); osal_task_create_IgnoreAndReturn(TUSB_ERROR_NONE); osal_queue_create_IgnoreAndReturn(dummy); |
