refractor hub api

fix all test build errors
This commit is contained in:
hathach
2013-10-16 11:05:33 +07:00
parent 3d13516106
commit de7e21dc66
21 changed files with 124 additions and 32 deletions
@@ -54,7 +54,7 @@
#endif
void tusbh_cdc_mounted_cb(uint8_t dev_addr);
void tusbh_cdc_unmounted_isr(uint8_t dev_addr);
void tusbh_cdc_unmounted_cb(uint8_t dev_addr);
void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes);
void tusbh_cdc_rndis_mounted_cb(uint8_t dev_addr);
@@ -195,7 +195,7 @@ void test_cdch_close_device(void)
hcd_pipe_close_ExpectAndReturn(pipe_int , TUSB_ERROR_NONE);
hcd_pipe_close_ExpectAndReturn(pipe_out , TUSB_ERROR_NONE);
tusbh_cdc_unmounted_isr_Expect(dev_addr);
tusbh_cdc_unmounted_cb_Expect(dev_addr);
//------------- CUT -------------//
cdch_close(dev_addr);
@@ -70,7 +70,7 @@ void tearDown(void)
void test_isr_device_connect_highspeed(void)
{
usbh_device_plugged_isr_Expect(hostid);
usbh_hcd_rhport_plugged_isr_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_plug(hostid, TUSB_SPEED_HIGH);
@@ -78,7 +78,7 @@ void test_isr_device_connect_highspeed(void)
void test_isr_device_connect_fullspeed(void)
{
usbh_device_plugged_isr_Expect(hostid);
usbh_hcd_rhport_plugged_isr_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_plug(hostid, TUSB_SPEED_FULL);
@@ -86,7 +86,7 @@ void test_isr_device_connect_fullspeed(void)
void test_isr_device_connect_slowspeed(void)
{
usbh_device_plugged_isr_Expect(hostid);
usbh_hcd_rhport_plugged_isr_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_plug(hostid, TUSB_SPEED_LOW);
@@ -94,7 +94,7 @@ void test_isr_device_connect_slowspeed(void)
void test_isr_device_disconnect(void)
{
usbh_device_unplugged_isr_Expect(hostid);
usbh_hcd_rhport_unplugged_isr_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_unplug(hostid);
@@ -51,6 +51,7 @@
#include "hcd.h"
#include "usbh_hcd.h"
#include "hub.h"
#include "usbh.h"
#include "ehci.h"
#include "ehci_controller_fake.h"
@@ -61,11 +61,11 @@
//------------- hidh -------------//
void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event);
void tusbh_hid_keyboard_mounted_cb(uint8_t dev_addr);
void tusbh_hid_keyboard_unmounted_isr(uint8_t dev_addr);
void tusbh_hid_keyboard_unmounted_cb(uint8_t dev_addr);
void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event);
void tusbh_hid_mouse_mounted_cb(uint8_t dev_addr);
void tusbh_hid_mouse_unmounted_isr(uint8_t dev_addr);
void tusbh_hid_mouse_unmounted_cb(uint8_t dev_addr);
#ifdef __cplusplus
}
@@ -90,7 +90,7 @@ void test_hidh_close(void)
keyboardh_data[dev_addr-1].report_size = 8;
hcd_pipe_close_ExpectAndReturn(pipe_hdl, TUSB_ERROR_NONE);
tusbh_hid_keyboard_unmounted_isr_Expect(dev_addr);
tusbh_hid_keyboard_unmounted_cb_Expect(dev_addr);
//------------- Code Under TEST -------------//
hidh_close(dev_addr);
@@ -45,6 +45,7 @@
#include "mock_osal.h"
#include "mock_cdc_host.h"
#include "mock_msc_host.h"
#include "mock_hub.h"
#include "mock_hcd.h"
#include "usbh.h"
@@ -160,7 +160,7 @@ void test_keyboard_open_ok(void)
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
TEST_ASSERT_TRUE( tusbh_hid_keyboard_is_mounted(dev_addr) );
TEST_ASSERT_EQUAL(TUSB_INTERFACE_STATUS_READY, p_hidh_kbd->status);
TEST_ASSERT_FALSE( tusbh_hid_keyboard_is_busy(dev_addr) );
}
//--------------------------------------------------------------------+
@@ -196,7 +196,8 @@ void test_keyboard_get_report_xfer_failed()
void test_keyboard_get_report_xfer_failed_busy()
{
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
p_hidh_kbd->status = TUSB_INTERFACE_STATUS_BUSY;
hcd_pipe_is_busy_ExpectAndReturn(p_hidh_kbd->pipe_hdl, true);
TEST_ASSERT_EQUAL(TUSB_ERROR_INTERFACE_IS_BUSY, tusbh_hid_keyboard_get_report(dev_addr, &report));
}
@@ -131,7 +131,7 @@ void test_mouse_open_ok(void)
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
TEST_ASSERT_TRUE( tusbh_hid_mouse_is_mounted(dev_addr) );
TEST_ASSERT_EQUAL(TUSB_INTERFACE_STATUS_READY, p_hidh_mouse->status);
TEST_ASSERT_FALSE( tusbh_hid_mouse_is_busy(dev_addr) );
}
@@ -168,7 +168,8 @@ void test_mouse_get_report_xfer_failed()
void test_mouse_get_report_xfer_failed_busy()
{
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
p_hidh_mouse->status = TUSB_INTERFACE_STATUS_BUSY;
hcd_pipe_is_busy_ExpectAndReturn(p_hidh_mouse->pipe_hdl, true);
TEST_ASSERT_EQUAL(TUSB_ERROR_INTERFACE_IS_BUSY, tusbh_hid_mouse_get_report(dev_addr, &report));
}
@@ -53,7 +53,7 @@
#include "common/common.h"
void tusbh_msc_mounted_cb(uint8_t dev_addr);
void tusbh_msc_unmounted_isr(uint8_t dev_addr);
void tusbh_msc_unmounted_cb(uint8_t dev_addr);
void tusbh_msc_isr(uint8_t dev_addr, tusb_event_t event, uint32_t xferred_bytes);
@@ -43,6 +43,7 @@
#include "mock_osal.h"
#include "usbh.h"
#include "mock_hcd.h"
#include "mock_hub.h"
#include "usbh_hcd.h"
#include "mock_tusb_callback.h"
@@ -43,6 +43,7 @@
#include "mock_osal.h"
#include "usbh.h"
#include "mock_hub.h"
#include "usbh_hcd.h"
#include "mock_hcd.h"
@@ -140,7 +141,7 @@ void test_usbh_init_ok(void)
}
// device is not mounted before, even the control pipe is not open, do nothing
void test_usbh_device_unplugged_isr_device_not_previously_mounted(void)
void test_usbh_hcd_rhport_unplugged_isr_device_not_previously_mounted(void)
{
uint8_t dev_addr = 1;
@@ -152,7 +153,7 @@ void test_usbh_device_unplugged_isr_device_not_previously_mounted(void)
usbh_hcd_rhport_unplugged_isr(0);
}
void test_usbh_device_unplugged_isr(void)
void test_usbh_hcd_rhport_unplugged_isr(void)
{
uint8_t dev_addr = 1;
+2
View File
@@ -45,6 +45,8 @@
#include "usbh_hcd.h"
#include "ehci.h"
#include "ehci_controller_fake.h"
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
+2 -1
View File
@@ -67,11 +67,12 @@
//--------------------------------------------------------------------+
//------------- CORE -------------//
#define TUSB_CFG_HOST_DEVICE_MAX 2
#define TUSB_CFG_CONFIGURATION_MAX 2
#define TUSB_CFG_CONFIGURATION_MAX 1
#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 255
//------------- CLASS -------------//
#define TUSB_CFG_HOST_HUB 1
#define TUSB_CFG_HOST_HID_KEYBOARD 1
#define TUSB_CFG_HOST_HID_MOUSE 1
#define TUSB_CFG_HOST_MSC 1