diff options
| author | hathach <[email protected]> | 2013-03-04 00:46:40 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-03-04 00:46:40 +0700 |
| commit | d644eaeb5c32af3704cd7494981881c28a2064c1 (patch) | |
| tree | b2a921d24fdd5ca06d17d313118feb28ca3be606 /tests | |
| parent | 74e6b545e1f188ba9639e6208f2c252f93554306 (diff) | |
add test for hcd/host init
- TT control
- usb cmd
complete hcd/host initialization code
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test/host/ehci/test_ehci.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/tests/test/host/ehci/test_ehci.c b/tests/test/host/ehci/test_ehci.c index 81d2e2268..2594874e3 100644 --- a/tests/test/host/ehci/test_ehci.c +++ b/tests/test/host/ehci/test_ehci.c @@ -315,7 +315,7 @@ void test_ehci_data(void) } //--------------------------------------------------------------------+ -// Initalization +// Initialization //--------------------------------------------------------------------+ void test_hcd_init_data(void) { @@ -375,7 +375,6 @@ void test_hcd_init_async_list(void) TEST_ASSERT(async_head->qtd_overlay.alternate.terminate); TEST_ASSERT(async_head->qtd_overlay.halted); } - } void test_hcd_init_period_list(void) @@ -406,6 +405,43 @@ void test_hcd_init_period_list(void) } #endif } + +void test_hcd_init_tt_control(void) +{ + hcd_init(); + + for(uint32_t i=0; i<TUSB_CFG_HOST_CONTROLLER_NUM; i++) + { + uint8_t const hostid = i+TUSB_CFG_HOST_CONTROLLER_START_INDEX; + ehci_registers_t* const regs = get_operational_register(hostid); + + TEST_ASSERT_EQUAL(0, regs->tt_control); + } +} + +void test_hcd_init_usbcmd(void) +{ + hcd_init(); + + for(uint32_t i=0; i<TUSB_CFG_HOST_CONTROLLER_NUM; i++) + { + uint8_t const hostid = i+TUSB_CFG_HOST_CONTROLLER_START_INDEX; + ehci_registers_t* const regs = get_operational_register(hostid); + + TEST_ASSERT(regs->usb_cmd_bit.async_enable); + +#if EHCI_PERIODIC_LIST + TEST_ASSERT(regs->usb_cmd_bit.periodic_enable); +#else + TEST_ASSERT_FALSE(regs->usb_cmd_bit.periodic_enable); +#endif + + //------------- Framelist size (NXP specific) -------------// + TEST_ASSERT_BITS(BIN8(11), EHCI_CFG_FRAMELIST_SIZE_BITS, regs->usb_cmd_bit.framelist_size); + TEST_ASSERT_EQUAL(EHCI_CFG_FRAMELIST_SIZE_BITS >> 2, regs->usb_cmd_bit.nxp_framelist_size_msb); + } + +} //--------------------------------------------------------------------+ // Helper //--------------------------------------------------------------------+ |
