mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-29 05:38:42 +00: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:
@@ -8,8 +8,8 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "unity.h"
|
||||
#include "test_usb_mock_msc.h"
|
||||
#include "test_usb_mock_hid.h"
|
||||
#include "mock_msc.h"
|
||||
#include "mock_hid.h"
|
||||
#include "test_hcd_common.h"
|
||||
|
||||
// --------------------------------------------------- Test Cases ------------------------------------------------------
|
||||
@@ -41,14 +41,14 @@ Note: Some mice will NAK until it is moved, so try moving the mouse around if th
|
||||
|
||||
TEST_CASE("Test HCD interrupt pipe URBs", "[intr][low_speed]")
|
||||
{
|
||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); //Trigger a connection
|
||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||
TEST_ASSERT_EQUAL_MESSAGE(TEST_HID_DEV_SPEED, port_speed, "Connected device is not Low Speed!");
|
||||
vTaskDelay(pdMS_TO_TICKS(100)); //Short delay send of SOF (for FS) or EOPs (for LS)
|
||||
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
||||
|
||||
hcd_pipe_handle_t default_pipe = test_hcd_pipe_alloc(port_hdl, NULL, 0, port_speed); //Create a default pipe (using a NULL EP descriptor)
|
||||
hcd_pipe_handle_t default_pipe = test_hcd_pipe_alloc(port_hdl, NULL, 0, port_speed); // Create a default pipe (using a NULL EP descriptor)
|
||||
uint8_t dev_addr = test_hcd_enum_device(default_pipe);
|
||||
|
||||
//Allocate interrupt pipe and URBS
|
||||
// Allocate interrupt pipe and URBS
|
||||
hcd_pipe_handle_t intr_pipe = test_hcd_pipe_alloc(port_hdl, &mock_hid_mouse_in_ep_desc, dev_addr, port_speed);
|
||||
urb_t *urb_list[NUM_URBS];
|
||||
for (int i = 0; i < NUM_URBS; i++) {
|
||||
@@ -57,31 +57,31 @@ TEST_CASE("Test HCD interrupt pipe URBs", "[intr][low_speed]")
|
||||
urb_list[i]->transfer.context = URB_CONTEXT_VAL;
|
||||
}
|
||||
|
||||
//Enqueue URBs
|
||||
// Enqueue URBs
|
||||
for (int i = 0; i < NUM_URBS; i++) {
|
||||
TEST_ASSERT_EQUAL(ESP_OK, hcd_urb_enqueue(intr_pipe, urb_list[i]));
|
||||
}
|
||||
int iter_count = NUM_URB_ITERS;
|
||||
for (iter_count = NUM_URB_ITERS; iter_count > 0; iter_count--) {
|
||||
//Wait for an URB to be done
|
||||
// Wait for an URB to be done
|
||||
test_hcd_expect_pipe_event(intr_pipe, HCD_PIPE_EVENT_URB_DONE);
|
||||
//Dequeue the URB and check results
|
||||
// Dequeue the URB and check results
|
||||
urb_t *urb = hcd_urb_dequeue(intr_pipe);
|
||||
TEST_ASSERT_EQUAL_MESSAGE(USB_TRANSFER_STATUS_COMPLETED, urb->transfer.status, "Transfer NOT completed");
|
||||
TEST_ASSERT_EQUAL(URB_CONTEXT_VAL, urb->transfer.context);
|
||||
mock_hid_process_report((mock_hid_mouse_report_t *)urb->transfer.data_buffer, iter_count);
|
||||
//Requeue URB
|
||||
// Requeue URB
|
||||
if (iter_count > NUM_URBS) {
|
||||
TEST_ASSERT_EQUAL(ESP_OK, hcd_urb_enqueue(intr_pipe, urb));
|
||||
}
|
||||
}
|
||||
|
||||
//Free URB list and pipe
|
||||
// Free URB list and pipe
|
||||
for (int i = 0; i < NUM_URBS; i++) {
|
||||
test_hcd_free_urb(urb_list[i]);
|
||||
}
|
||||
test_hcd_pipe_free(intr_pipe);
|
||||
test_hcd_pipe_free(default_pipe);
|
||||
//Clearnup
|
||||
// Clearnup
|
||||
test_hcd_wait_for_disconn(port_hdl, false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user