mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
refactor(usb): Rename mock class files
- Rename "test_usb_mock_..." class files to "mock_..." - Fixed some codespell issues - Fixed comment spacing
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
idf_component_register(SRCS "test_usb_common.c" "test_usb_mock_msc.c" "test_usb_mock_hid.c"
|
idf_component_register(SRCS "mock_hid.c"
|
||||||
|
"mock_msc.c"
|
||||||
|
"test_usb_common.c"
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
REQUIRES usb unity)
|
REQUIRES usb unity)
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "usb/usb_types_ch9.h"
|
#include "usb/usb_types_ch9.h"
|
||||||
#include "test_usb_mock_hid.h"
|
#include "mock_hid.h"
|
||||||
|
|
||||||
// ---------------------------------------------------- HID Mouse ------------------------------------------------------
|
// ---------------------------------------------------- HID Mouse ------------------------------------------------------
|
||||||
|
|
@@ -22,7 +22,6 @@ extern "C" {
|
|||||||
|
|
||||||
// ---------------------------------------------------- HID Mouse ------------------------------------------------------
|
// ---------------------------------------------------- HID Mouse ------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Note: The mock HID mouse tests require that USB low speed mouse be connected. The mouse should...
|
Note: The mock HID mouse tests require that USB low speed mouse be connected. The mouse should...
|
||||||
|
|
@@ -9,7 +9,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "usb/usb_types_ch9.h"
|
#include "usb/usb_types_ch9.h"
|
||||||
#include "test_usb_mock_msc.h"
|
#include "mock_msc.h"
|
||||||
|
|
||||||
// ---------------------------------------------------- MSC SCSI -------------------------------------------------------
|
// ---------------------------------------------------- MSC SCSI -------------------------------------------------------
|
||||||
|
|
@@ -9,7 +9,7 @@
|
|||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "test_usb_mock_msc.h"
|
#include "mock_msc.h"
|
||||||
#include "test_hcd_common.h"
|
#include "test_hcd_common.h"
|
||||||
|
|
||||||
// --------------------------------------------------- Test Cases ------------------------------------------------------
|
// --------------------------------------------------- Test Cases ------------------------------------------------------
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#include "usb/usb_types_ch9.h"
|
#include "usb/usb_types_ch9.h"
|
||||||
#include "test_hcd_common.h"
|
#include "test_hcd_common.h"
|
||||||
#include "test_usb_common.h"
|
#include "test_usb_common.h"
|
||||||
|
#include "mock_msc.h"
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
|
|
||||||
#define PORT_NUM 1
|
#define PORT_NUM 1
|
||||||
|
@@ -150,7 +150,7 @@ TEST_CASE("Test HCD control pipe STALL", "[ctrl][full_speed]")
|
|||||||
int num_enqueued = 0;
|
int num_enqueued = 0;
|
||||||
for (int i = 0; i < NUM_URBS; i++) {
|
for (int i = 0; i < NUM_URBS; i++) {
|
||||||
if (hcd_urb_enqueue(default_pipe, urb_list[i]) != ESP_OK) {
|
if (hcd_urb_enqueue(default_pipe, urb_list[i]) != ESP_OK) {
|
||||||
//STALL may occur before we are done enqueing
|
// STALL may occur before we are done enqueuing
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
num_enqueued++;
|
num_enqueued++;
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "test_usb_mock_msc.h"
|
#include "mock_msc.h"
|
||||||
#include "test_usb_mock_hid.h"
|
#include "mock_hid.h"
|
||||||
#include "test_hcd_common.h"
|
#include "test_hcd_common.h"
|
||||||
|
|
||||||
// --------------------------------------------------- Test Cases ------------------------------------------------------
|
// --------------------------------------------------- Test Cases ------------------------------------------------------
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "test_usb_mock_msc.h"
|
#include "mock_msc.h"
|
||||||
#include "test_usb_common.h"
|
#include "test_usb_common.h"
|
||||||
#include "test_hcd_common.h"
|
#include "test_hcd_common.h"
|
||||||
|
|
||||||
|
@@ -7,5 +7,5 @@ There are two sets of tests in this application:
|
|||||||
1. Low-speed: Expects low-speed USB mouse with interrupt endpoint to be connected
|
1. Low-speed: Expects low-speed USB mouse with interrupt endpoint to be connected
|
||||||
2. Full-speed: Expects full-speed USB flash disk with 2 bulk endpoints to be connected
|
2. Full-speed: Expects full-speed USB flash disk with 2 bulk endpoints to be connected
|
||||||
|
|
||||||
For running these tests locally, you will have to update device definitions (VID, PID, ...) in [test_usb_mock_msc.h](../common/test_usb_mock_msc.h) and [test_usb_mock_hid.h](../common/test_usb_mock_hid.h).
|
For running these tests locally, you will have to update device definitions (VID, PID, ...) in [mock_msc.h](../common/mock_msc.h) and [mock_hid.h](../common/mock_hid.h).
|
||||||
|
|
||||||
|
@@ -168,7 +168,7 @@ void ctrl_client_async_seq_task(void *arg)
|
|||||||
}
|
}
|
||||||
case TEST_STAGE_DEV_CLOSE: {
|
case TEST_STAGE_DEV_CLOSE: {
|
||||||
ESP_LOGD(CTRL_CLIENT_TAG, "Close");
|
ESP_LOGD(CTRL_CLIENT_TAG, "Close");
|
||||||
vTaskDelay(10); // Give USB Host Lib some time to process all trnsfers
|
vTaskDelay(10); // Give USB Host Lib some time to process all transfers
|
||||||
TEST_ASSERT_EQUAL(ESP_OK, usb_host_device_close(ctrl_obj.client_hdl, ctrl_obj.dev_hdl));
|
TEST_ASSERT_EQUAL(ESP_OK, usb_host_device_close(ctrl_obj.client_hdl, ctrl_obj.dev_hdl));
|
||||||
exit_loop = true;
|
exit_loop = true;
|
||||||
break;
|
break;
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "test_usb_mock_msc.h"
|
#include "mock_msc.h"
|
||||||
#include "test_usb_common.h"
|
#include "test_usb_common.h"
|
||||||
#include "msc_client.h"
|
#include "msc_client.h"
|
||||||
#include "usb/usb_host.h"
|
#include "usb/usb_host.h"
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "test_usb_mock_msc.h"
|
#include "mock_msc.h"
|
||||||
#include "test_usb_common.h"
|
#include "test_usb_common.h"
|
||||||
#include "msc_client.h"
|
#include "msc_client.h"
|
||||||
#include "usb/usb_host.h"
|
#include "usb/usb_host.h"
|
||||||
@@ -133,7 +133,7 @@ void msc_client_async_enum_task(void *arg)
|
|||||||
const usb_config_desc_t *config_desc;
|
const usb_config_desc_t *config_desc;
|
||||||
const usb_config_desc_t *config_desc_ref = (const usb_config_desc_t *)mock_msc_scsi_config_desc;
|
const usb_config_desc_t *config_desc_ref = (const usb_config_desc_t *)mock_msc_scsi_config_desc;
|
||||||
TEST_ASSERT_EQUAL(ESP_OK, usb_host_get_active_config_descriptor(msc_obj.dev_hdl, &config_desc));
|
TEST_ASSERT_EQUAL(ESP_OK, usb_host_get_active_config_descriptor(msc_obj.dev_hdl, &config_desc));
|
||||||
TEST_ASSERT_EQUAL_MESSAGE(config_desc_ref->wTotalLength, config_desc->wTotalLength, "Incorrent length of CFG descriptor");
|
TEST_ASSERT_EQUAL_MESSAGE(config_desc_ref->wTotalLength, config_desc->wTotalLength, "Incorrect length of CFG descriptor");
|
||||||
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(config_desc_ref, config_desc, config_desc_ref->wTotalLength, "Configuration descriptors do not match");
|
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(config_desc_ref, config_desc, config_desc_ref->wTotalLength, "Configuration descriptors do not match");
|
||||||
msc_obj.next_stage = TEST_STAGE_CHECK_STR_DESC;
|
msc_obj.next_stage = TEST_STAGE_CHECK_STR_DESC;
|
||||||
skip_event_handling = true; // Need to execute TEST_STAGE_CHECK_STR_DESC
|
skip_event_handling = true; // Need to execute TEST_STAGE_CHECK_STR_DESC
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "test_usb_common.h"
|
#include "test_usb_common.h"
|
||||||
#include "test_usb_mock_msc.h"
|
#include "mock_msc.h"
|
||||||
#include "msc_client.h"
|
#include "msc_client.h"
|
||||||
#include "usb/usb_host.h"
|
#include "usb/usb_host.h"
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "test_usb_common.h"
|
#include "test_usb_common.h"
|
||||||
#include "test_usb_mock_msc.h"
|
#include "mock_msc.h"
|
||||||
#include "usb/usb_host.h"
|
#include "usb/usb_host.h"
|
||||||
|
|
||||||
void setUp(void)
|
void setUp(void)
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_intr_alloc.h"
|
#include "esp_intr_alloc.h"
|
||||||
#include "test_usb_common.h"
|
#include "test_usb_common.h"
|
||||||
#include "test_usb_mock_msc.h"
|
#include "mock_msc.h"
|
||||||
#include "msc_client.h"
|
#include "msc_client.h"
|
||||||
#include "ctrl_client.h"
|
#include "ctrl_client.h"
|
||||||
#include "usb/usb_host.h"
|
#include "usb/usb_host.h"
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_intr_alloc.h"
|
#include "esp_intr_alloc.h"
|
||||||
#include "test_usb_common.h"
|
#include "test_usb_common.h"
|
||||||
#include "test_usb_mock_msc.h"
|
#include "mock_msc.h"
|
||||||
#include "msc_client.h"
|
#include "msc_client.h"
|
||||||
#include "ctrl_client.h"
|
#include "ctrl_client.h"
|
||||||
#include "usb/usb_host.h"
|
#include "usb/usb_host.h"
|
||||||
|
Reference in New Issue
Block a user