usbh rename vars

This commit is contained in:
hathach
2018-12-07 00:47:16 +07:00
parent 2fe9abe71f
commit c93fb23693
17 changed files with 171 additions and 159 deletions
@@ -51,7 +51,7 @@
#include "mock_osal.h"
#include "mock_usbh_hcd.h"
usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t hostid;
@@ -50,7 +50,7 @@
#include "mock_osal.h"
#include "mock_usbh_hcd.h"
usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t hostid;
static ehci_registers_t * regs;
@@ -51,7 +51,7 @@
#include "mock_osal.h"
#include "mock_usbh_hcd.h"
usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
//--------------------------------------------------------------------+
// Setup/Teardown + helper declare
@@ -51,7 +51,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const hub_addr = 2;
static uint8_t const hub_port = 2;
@@ -70,7 +70,7 @@ void setUp(void)
dev_addr = 1;
hostid = RANDOM(CONTROLLER_HOST_NUMBER) + TEST_CONTROLLER_HOST_START_INDEX;
tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
helper_usbh_device_emulate(dev_addr, hub_addr, hub_port, hostid, TUSB_SPEED_HIGH);
async_head = get_async_head( hostid );
@@ -85,7 +85,7 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack
TEST_ASSERT_EQUAL(dev_addr, p_qhd->device_address);
TEST_ASSERT_FALSE(p_qhd->non_hs_period_inactive_next_xact);
TEST_ASSERT_EQUAL(endpoint_addr & 0x0F, p_qhd->endpoint_number);
TEST_ASSERT_EQUAL(usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
TEST_ASSERT_EQUAL(_usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
TEST_ASSERT_EQUAL(max_packet_size, p_qhd->max_package_size);
TEST_ASSERT_EQUAL(0, p_qhd->nak_count_reload); // TDD NAK Reload disable
@@ -51,7 +51,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t hub_addr = 2;
static uint8_t hub_port = 2;
@@ -91,7 +91,7 @@ void setUp(void)
{
ehci_controller_init();
tu_memclr(xfer_data, sizeof(xfer_data));
tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
TEST_ASSERT_STATUS( hcd_init() );
@@ -146,7 +146,7 @@ void verify_qtd(ehci_qtd_t *p_qtd, uint8_t p_data[], uint16_t length)
void test_bulk_xfer_hs_ping_out(void)
{
usbh_devices[dev_addr].speed = TUSB_SPEED_HIGH;
_usbh_devices[dev_addr].speed = TUSB_SPEED_HIGH;
pipe_handle_t pipe_hdl = hcd_pipe_open(dev_addr, &desc_ept_bulk_out, TUSB_CLASS_MSC);
ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle(pipe_hdl);
@@ -51,7 +51,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const control_max_packet_size = 64;
static uint8_t const hub_addr = 2;
@@ -67,7 +67,7 @@ static ehci_qhd_t *p_control_qhd;
//--------------------------------------------------------------------+
void setUp(void)
{
tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
TEST_ASSERT_STATUS( hcd_init() );
@@ -90,7 +90,7 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack
TEST_ASSERT_EQUAL(dev_addr, p_qhd->device_address);
TEST_ASSERT_FALSE(p_qhd->non_hs_period_inactive_next_xact);
TEST_ASSERT_EQUAL(endpoint_addr & 0x0F, p_qhd->endpoint_number);
TEST_ASSERT_EQUAL(usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
TEST_ASSERT_EQUAL(_usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
TEST_ASSERT_EQUAL(max_packet_size, p_qhd->max_package_size);
TEST_ASSERT_EQUAL(0, p_qhd->nak_count_reload); // TDD NAK Reload disable
@@ -149,7 +149,7 @@ void test_control_open_qhd_data(void)
void test_control_open_highspeed(void)
{
usbh_devices[dev_addr].speed = TUSB_SPEED_HIGH;
_usbh_devices[dev_addr].speed = TUSB_SPEED_HIGH;
//------------- Code Under TEST -------------//
TEST_ASSERT_STATUS( hcd_pipe_control_open(dev_addr, control_max_packet_size) );
@@ -158,7 +158,7 @@ void test_control_open_highspeed(void)
void test_control_open_non_highspeed(void)
{
usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
_usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
//------------- Code Under TEST -------------//
TEST_ASSERT_STATUS( hcd_pipe_control_open(dev_addr, control_max_packet_size) );
@@ -51,7 +51,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const control_max_packet_size = 64;
static uint8_t const hub_addr = 2;
@@ -74,7 +74,7 @@ void setUp(void)
{
ehci_controller_init();
tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(xfer_data, sizeof(xfer_data));
TEST_ASSERT_STATUS( hcd_init() );
@@ -50,7 +50,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const hub_addr = 2;
static uint8_t const hub_port = 2;
@@ -67,7 +67,7 @@ static pipe_handle_t pipe_hdl;
//--------------------------------------------------------------------+
void setUp(void)
{
tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
hcd_init();
@@ -90,7 +90,7 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack
TEST_ASSERT_EQUAL(dev_addr, p_qhd->device_address);
TEST_ASSERT_FALSE(p_qhd->non_hs_period_inactive_next_xact);
TEST_ASSERT_EQUAL(endpoint_addr & 0x0F, p_qhd->endpoint_number);
TEST_ASSERT_EQUAL(usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
TEST_ASSERT_EQUAL(_usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
TEST_ASSERT_EQUAL(max_packet_size, p_qhd->max_package_size);
TEST_ASSERT_EQUAL(0, p_qhd->nak_count_reload); // TDD NAK Reload disable
@@ -272,7 +272,7 @@ void test_open_interrupt_hs_interval_8(void)
void test_open_interrupt_qhd_non_hs(void)
{
usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
_usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
//------------- Code Under TEST -------------//
pipe_hdl = hcd_pipe_open(dev_addr, &desc_ept_interrupt_out, TUSB_CLASS_HID);
@@ -294,7 +294,7 @@ void test_open_interrupt_qhd_non_hs_9(void)
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 32;
usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
_usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
//------------- Code Under TEST -------------//
pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
@@ -51,7 +51,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const hub_addr = 2;
static uint8_t const hub_port = 2;
@@ -91,7 +91,7 @@ void setUp(void)
{
ehci_controller_init();
tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(xfer_data, sizeof(xfer_data));
TEST_ASSERT_STATUS( hcd_init() );
@@ -50,7 +50,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const hub_addr = 2;
static uint8_t const hub_port = 2;
@@ -63,7 +63,7 @@ static ehci_qhd_t *period_head_arr;
//--------------------------------------------------------------------+
void setUp(void)
{
tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
hcd_init();