mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
fix(usb_host): Run esp-usb pre-commit:
- trailing whitespaces
- end-of-file-fixer
- codespell
- astyle_py: align pointer name
This commit is contained in:
@@ -145,7 +145,7 @@ typedef struct {
|
||||
struct {
|
||||
ext_hub_cb_t proc_req_cb; /**< Process callback */
|
||||
void *proc_req_cb_arg; /**< Process callback argument */
|
||||
const ext_port_driver_api_t* port_driver; /**< External Port Driver */
|
||||
const ext_port_driver_api_t *port_driver; /**< External Port Driver */
|
||||
} constant; /**< Constant members. Do not change after installation thus do not require a critical section or mutex */
|
||||
} ext_hub_driver_t;
|
||||
|
||||
@@ -180,7 +180,7 @@ DEFINE_CRIT_SECTION_LOCK_STATIC(ext_hub_driver_lock);
|
||||
// -----------------------------------------------------------------------------
|
||||
static bool _device_set_actions(ext_hub_dev_t *ext_hub_dev, uint32_t action_flags);
|
||||
static void device_error(ext_hub_dev_t *ext_hub_dev);
|
||||
static void device_status_change_handle(ext_hub_dev_t *ext_hub_dev, const uint8_t* data, const int length);
|
||||
static void device_status_change_handle(ext_hub_dev_t *ext_hub_dev, const uint8_t *data, const int length);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ---------------------- Callbacks (implementation) ---------------------------
|
||||
@@ -361,7 +361,7 @@ static void device_has_changed(ext_hub_dev_t *ext_hub_dev)
|
||||
// | ...
|
||||
// +---------------------------- Port N change detected
|
||||
//
|
||||
static void device_status_change_handle(ext_hub_dev_t *ext_hub_dev, const uint8_t* data, const int length)
|
||||
static void device_status_change_handle(ext_hub_dev_t *ext_hub_dev, const uint8_t *data, const int length)
|
||||
{
|
||||
uint32_t device_status = 0;
|
||||
// Driver does not support Hubs with EP IN wMaxPacketSize > 4
|
||||
@@ -415,14 +415,14 @@ static void device_error(ext_hub_dev_t *ext_hub_dev)
|
||||
static esp_err_t device_port_new(ext_hub_dev_t *ext_hub_dev, uint8_t port_idx)
|
||||
{
|
||||
ext_port_config_t port_config = {
|
||||
.context = (void*) ext_hub_dev,
|
||||
.context = (void *) ext_hub_dev,
|
||||
.parent_dev_hdl = ext_hub_dev->constant.dev_hdl,
|
||||
.parent_port_num = port_idx + 1,
|
||||
.port_power_delay_ms = ext_hub_dev->constant.hub_desc->bPwrOn2PwrGood * 2,
|
||||
};
|
||||
|
||||
assert(p_ext_hub_driver->constant.port_driver);
|
||||
esp_err_t ret = p_ext_hub_driver->constant.port_driver->new (&port_config, (void**) &ext_hub_dev->constant.ports[port_idx]);
|
||||
esp_err_t ret = p_ext_hub_driver->constant.port_driver->new (&port_config, (void **) &ext_hub_dev->constant.ports[port_idx]);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(EXT_HUB_TAG, "[%d:%d] Port allocation error: %s", ext_hub_dev->constant.dev_addr, port_idx + 1, esp_err_to_name(ret));
|
||||
goto fail;
|
||||
@@ -1208,7 +1208,7 @@ void *ext_hub_get_client(void)
|
||||
EXT_HUB_ENTER_CRITICAL();
|
||||
driver_installed = (p_ext_hub_driver != NULL);
|
||||
EXT_HUB_EXIT_CRITICAL();
|
||||
return (driver_installed) ? (void*) p_ext_hub_driver : NULL;
|
||||
return (driver_installed) ? (void *) p_ext_hub_driver : NULL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -78,7 +78,7 @@ struct ext_port_s {
|
||||
usb_device_handle_t parent_dev_hdl; /**< Ports' parent device handle */
|
||||
uint8_t parent_dev_addr; /**< Ports' parent device bus address */
|
||||
// Port related constant members
|
||||
void* context; /**< Ports' parent External Hub handle */
|
||||
void *context; /**< Ports' parent External Hub handle */
|
||||
uint8_t port_num; /**< Ports' parent External Hub Port number */
|
||||
int power_on_delay_ms; /**< Ports' Power on time to Power Good, ms */
|
||||
} constant; /**< Constant members. Do not change after installation thus do not require a critical section or mutex */
|
||||
@@ -181,7 +181,7 @@ static inline bool port_is_enabled(ext_port_t *ext_port)
|
||||
* - true Port connection changed
|
||||
* - false Port connection not changed
|
||||
*/
|
||||
static inline bool port_has_changed_connection(ext_port_t * ext_port)
|
||||
static inline bool port_has_changed_connection(ext_port_t *ext_port)
|
||||
{
|
||||
return ext_port->status.wPortChange.C_PORT_CONNECTION ? true : false;
|
||||
}
|
||||
@@ -230,7 +230,7 @@ static inline bool port_has_finished_reset(ext_port_t *ext_port)
|
||||
* - ESP_ERR_NOT_SUPPORTED: The request type is not supported by the External Hub Driver
|
||||
* - ESP_OK: Status has been requested
|
||||
*/
|
||||
static esp_err_t port_request_status(ext_port_t* ext_port)
|
||||
static esp_err_t port_request_status(ext_port_t *ext_port)
|
||||
{
|
||||
ext_port_parent_request_data_t data = {
|
||||
.type = EXT_PORT_PARENT_REQ_CONTROL,
|
||||
@@ -469,7 +469,7 @@ static ext_port_t *get_port_from_pending_list(void)
|
||||
* - ESP_ERR_NOT_FINISHED: Unable to allocate the port object: parent device is not available
|
||||
* - ESP_OK: Port object created successfully
|
||||
*/
|
||||
static esp_err_t port_alloc(void* context, usb_device_handle_t parent_dev_hdl, uint8_t parent_port_num, uint16_t port_delay_ms, ext_port_t **port_obj)
|
||||
static esp_err_t port_alloc(void *context, usb_device_handle_t parent_dev_hdl, uint8_t parent_port_num, uint16_t port_delay_ms, ext_port_t **port_obj)
|
||||
{
|
||||
uint8_t parent_dev_addr = 0;
|
||||
EXT_PORT_CHECK(context != NULL && parent_dev_hdl != NULL, ESP_ERR_INVALID_ARG);
|
||||
@@ -1247,7 +1247,7 @@ static esp_err_t port_gone(void *port_hdl)
|
||||
* - ESP_ERR_INVALID_ARG: The port handle can't be NULL
|
||||
* - ESP_OK: Port action was requested
|
||||
*/
|
||||
static esp_err_t port_get_status(void* port_hdl)
|
||||
static esp_err_t port_get_status(void *port_hdl)
|
||||
{
|
||||
EXT_PORT_CHECK(p_ext_port_driver != NULL, ESP_ERR_NOT_ALLOWED);
|
||||
EXT_PORT_CHECK(port_hdl != NULL, ESP_ERR_INVALID_ARG);
|
||||
@@ -1269,7 +1269,7 @@ static esp_err_t port_get_status(void* port_hdl)
|
||||
* - ESP_ERR_INVALID_ARG: The port handle can't be NULL, the status data can't be NULL
|
||||
* - ESP_OK: Port action was requested
|
||||
*/
|
||||
static esp_err_t port_set_status(void* port_hdl, const usb_port_status_t *port_status)
|
||||
static esp_err_t port_set_status(void *port_hdl, const usb_port_status_t *port_status)
|
||||
{
|
||||
EXT_PORT_CHECK(p_ext_port_driver != NULL, ESP_ERR_NOT_ALLOWED);
|
||||
EXT_PORT_CHECK(port_hdl != NULL && port_status != NULL, ESP_ERR_INVALID_ARG);
|
||||
@@ -1298,7 +1298,7 @@ static esp_err_t port_set_status(void* port_hdl, const usb_port_status_t *port_s
|
||||
* - ESP_ERR_INVALID_ARG: The port handle can't be NULL
|
||||
* - ESP_OK: Port action was requested
|
||||
*/
|
||||
static esp_err_t port_req_process(void* port_hdl)
|
||||
static esp_err_t port_req_process(void *port_hdl)
|
||||
{
|
||||
EXT_PORT_CHECK(p_ext_port_driver != NULL, ESP_ERR_NOT_ALLOWED);
|
||||
EXT_PORT_CHECK(port_hdl != NULL, ESP_ERR_INVALID_ARG);
|
||||
@@ -1443,7 +1443,7 @@ const ext_port_driver_api_t *ext_port_get_driver(void)
|
||||
return &ext_port_driver;
|
||||
}
|
||||
|
||||
void* ext_port_get_context(ext_port_hdl_t port_hdl)
|
||||
void *ext_port_get_context(ext_port_hdl_t port_hdl)
|
||||
{
|
||||
EXT_PORT_CHECK(p_ext_port_driver != NULL, NULL);
|
||||
ext_port_t *ext_port = (ext_port_t *)port_hdl;
|
||||
|
||||
@@ -1407,7 +1407,7 @@ esp_err_t hcd_port_init(int port_number, const hcd_port_config_t *port_config, h
|
||||
// USB-HAL's size is dependent on its configuration, namely on number of channels in the configuration
|
||||
// We must first initialize the HAL, to get the number of channels and then allocate memory for the channels
|
||||
usb_dwc_hal_init(port_obj->hal, port_number);
|
||||
port_obj->hal->channels.hdls = calloc(port_obj->hal->constant_config.chan_num_total, sizeof(usb_dwc_hal_chan_t*));
|
||||
port_obj->hal->channels.hdls = calloc(port_obj->hal->constant_config.chan_num_total, sizeof(usb_dwc_hal_chan_t *));
|
||||
HCD_CHECK_FROM_CRIT(port_obj->hal->channels.hdls != NULL, ESP_ERR_NO_MEM);
|
||||
|
||||
port_obj->initialized = true;
|
||||
@@ -1669,7 +1669,7 @@ static bool pipe_args_usb_compliance_verification(const hcd_pipe_config_t *pipe_
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool pipe_alloc_hcd_support_verification(usb_dwc_hal_context_t *hal, const usb_ep_desc_t * ep_desc)
|
||||
static bool pipe_alloc_hcd_support_verification(usb_dwc_hal_context_t *hal, const usb_ep_desc_t *ep_desc)
|
||||
{
|
||||
assert(hal != NULL);
|
||||
assert(ep_desc != NULL);
|
||||
|
||||
@@ -34,4 +34,4 @@ or run the executable directly:
|
||||
|
||||
```
|
||||
./build/host_test_usb_host_layer.elf
|
||||
```
|
||||
```
|
||||
|
||||
@@ -13,7 +13,7 @@ This test directory uses freertos as a real component
|
||||
|
||||
# Build
|
||||
|
||||
Tests build regularly like an idf project. Currently only working on Linux machines.
|
||||
Tests build regularly like an idf project. Currently only working on Linux machines.
|
||||
|
||||
```
|
||||
idf.py --preview set-target linux
|
||||
@@ -34,4 +34,4 @@ or run the executable directly:
|
||||
|
||||
```
|
||||
./build/host_test_usbh_layer.elf
|
||||
```
|
||||
```
|
||||
|
||||
@@ -128,7 +128,7 @@ In order to communicate events to the client of the HCD, the HCD does not attemp
|
||||
There are two types callbacks that the HCD offers:
|
||||
|
||||
- Port callback will run whenever an event a port occurs. `hcd_port_handle_event()` should be called after a port event occurs.
|
||||
- A pipe callback on each pipe, that will run when a event occurs on a pipe.
|
||||
- A pipe callback on each pipe, that will run when a event occurs on a pipe.
|
||||
|
||||
The client of the HCD can also forego callbacks entirely and simply poll for port and pipe events using the `hcd_port_handle_event()` and `hcd_pipe_get_event()` respectively.
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ extern "C" {
|
||||
/**
|
||||
* @brief Handle of enumeration control object
|
||||
*/
|
||||
typedef struct enum_ctx_handle_s * enum_ctx_handle_t;
|
||||
typedef struct enum_ctx_handle_s *enum_ctx_handle_t;
|
||||
|
||||
// ------------------------------ Events ---------------------------------------
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef bool (*ext_hub_cb_t)(bool in_isr, void *user_arg);
|
||||
typedef struct {
|
||||
ext_hub_cb_t proc_req_cb; /**< External Hub process callback */
|
||||
void *proc_req_cb_arg; /**< External Hub process callback argument */
|
||||
const ext_port_driver_api_t* port_driver; /**< External Port Driver */
|
||||
const ext_port_driver_api_t *port_driver; /**< External Port Driver */
|
||||
} ext_hub_config_t;
|
||||
|
||||
// ------------------------------ Driver ---------------------------------------
|
||||
@@ -55,7 +55,7 @@ typedef struct {
|
||||
* - ESP_ERR_NO_MEM: Insufficient memory
|
||||
* - ESP_ERR_INVALID_STATE: External Hub driver already installed
|
||||
*/
|
||||
esp_err_t ext_hub_install(const ext_hub_config_t* config);
|
||||
esp_err_t ext_hub_install(const ext_hub_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Uninstall External Hub Driver
|
||||
|
||||
@@ -128,7 +128,7 @@ typedef struct {
|
||||
* Structure is used to create new port
|
||||
*/
|
||||
typedef struct {
|
||||
void* context; /**< Ports' parent external Hub handle */
|
||||
void *context; /**< Ports' parent external Hub handle */
|
||||
usb_device_handle_t parent_dev_hdl; /**< Ports' parent device handle */
|
||||
uint8_t parent_port_num; /**< Ports' parent port number */
|
||||
uint16_t port_power_delay_ms; /**< Ports' Power on time to Power Good, ms */
|
||||
@@ -193,7 +193,7 @@ const ext_port_driver_api_t *ext_port_get_driver(void);
|
||||
* @return
|
||||
* - Pointer to the External Port Driver context
|
||||
*/
|
||||
void* ext_port_get_context(ext_port_hdl_t port_hdl);
|
||||
void *ext_port_get_context(ext_port_hdl_t port_hdl);
|
||||
|
||||
/**
|
||||
* @brief Returns External Port's port number
|
||||
|
||||
@@ -87,7 +87,7 @@ bLength : 0x22 (34 bytes)
|
||||
bDescriptorType : 0x03 (String Descriptor)
|
||||
wData : " SanDisk 3.2Gen1"
|
||||
|
||||
----------------------------- String Descriptor Ser ----------------------------
|
||||
----------------------------- String Descriptor Set ----------------------------
|
||||
bLength : 0xF2 (242 bytes)
|
||||
bDescriptorType : 0x03 (String Descriptor)
|
||||
wData : "0101cdd1e856b427bbb796f870561a4b2b817af9da9872c8d75217cccdd5d5eccb3a0000000000000000000096abe1a3ff83610095558107aea948b4"
|
||||
|
||||
@@ -51,7 +51,7 @@ The Mocked Device has a Final State Machine (FSM), which could be configured to
|
||||
|
||||
FSM is described in the **mock_dev_stage_t** structure and could be found in [mock_dev.h](main/mock_dev.h).
|
||||
|
||||
Available stages:
|
||||
Available stages:
|
||||
- Request Short Device Descriptor
|
||||
- Request Full Device Descriptor
|
||||
- Request Short Configuration Descriptor
|
||||
@@ -165,7 +165,7 @@ TEST_CASE("enum::complete", "[mock_enum_device]")
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
// Test remained logic
|
||||
}
|
||||
```
|
||||
@@ -346,4 +346,3 @@ E (121120) USBH: Dev 33 EP 0 STALL
|
||||
E (121120) ENUM: Bad transfer status 4: CHECK_CONFIG
|
||||
E (121120) ENUM: [0:0] CHECK_CONFIG FAILED
|
||||
```
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ uint16_t const *tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
||||
}
|
||||
|
||||
// Advanced
|
||||
uint8_t const * tud_descriptor_bos_cb(void)
|
||||
uint8_t const *tud_descriptor_bos_cb(void)
|
||||
{
|
||||
printf("\t <- BOS Descriptor request\n");
|
||||
return NULL;
|
||||
|
||||
@@ -77,7 +77,7 @@ typedef struct {
|
||||
ext_port_parent_request_data_t data;
|
||||
} ext_port_hub_request_msg_t;
|
||||
|
||||
static const ext_port_driver_api_t* port_api;
|
||||
static const ext_port_driver_api_t *port_api;
|
||||
SemaphoreHandle_t _process_cd_req = NULL;
|
||||
QueueHandle_t _ext_port_hub_req_queue = NULL;
|
||||
QueueHandle_t _ext_port_event_queue = NULL;
|
||||
@@ -180,11 +180,11 @@ void test_ext_port_setup(void)
|
||||
// Install External Port driver
|
||||
ext_port_driver_config_t ext_port_config = {
|
||||
.proc_req_cb = test_ext_port_callback,
|
||||
.proc_req_cb_arg = (void*)_process_cd_req,
|
||||
.proc_req_cb_arg = (void *)_process_cd_req,
|
||||
.event_cb = test_ext_port_event_callback,
|
||||
.event_cb_arg = (void*)_ext_port_event_queue,
|
||||
.event_cb_arg = (void *)_ext_port_event_queue,
|
||||
.hub_request_cb = test_ext_port_hub_request,
|
||||
.hub_request_cb_arg = (void*)_ext_port_hub_req_queue,
|
||||
.hub_request_cb_arg = (void *)_ext_port_hub_req_queue,
|
||||
};
|
||||
TEST_ASSERT_EQUAL(ESP_OK, ext_port_install(&ext_port_config));
|
||||
port_api = ext_port_get_driver();
|
||||
@@ -203,7 +203,7 @@ void test_ext_port_teardown(void)
|
||||
ext_port_hdl_t test_ext_port_new(ext_port_config_t *config)
|
||||
{
|
||||
ext_port_hdl_t port = NULL;
|
||||
TEST_ASSERT_EQUAL(ESP_OK, port_api->new (config, (void**) &port));
|
||||
TEST_ASSERT_EQUAL(ESP_OK, port_api->new (config, (void **) &port));
|
||||
TEST_ASSERT_NOT_NULL(port);
|
||||
// Adding the port should trigger the process request callback
|
||||
test_wait_ext_port_process_request();
|
||||
|
||||
@@ -199,9 +199,9 @@ void hub_detach(void)
|
||||
test_hcd_wait_for_disconn(hub.root_port_hdl, true);
|
||||
}
|
||||
|
||||
void* hub_get_context(void)
|
||||
void *hub_get_context(void)
|
||||
{
|
||||
return (void*) &hub;
|
||||
return (void *) &hub;
|
||||
}
|
||||
|
||||
uint8_t hub_get_port_num(void)
|
||||
|
||||
@@ -72,7 +72,7 @@ void hub_child_quick_enum(hcd_pipe_handle_t ctrl_pipe, uint8_t dev_addr, uint8_t
|
||||
*
|
||||
* @return void* pointer to a Hub context
|
||||
*/
|
||||
void* hub_get_context(void);
|
||||
void *hub_get_context(void);
|
||||
|
||||
/**
|
||||
* @brief Get number of ports
|
||||
|
||||
@@ -92,8 +92,8 @@ TEST_CASE("Port: disconnected", "[low_speed][full_speed][high_speed]")
|
||||
TEST_ASSERT_TRUE(TEST_PORT_NUM_EMPTY <= port_num);
|
||||
// Create External Port
|
||||
ext_port_config_t port_config = {
|
||||
.context = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.context = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_port_num = TEST_PORT_NUM_EMPTY,
|
||||
.port_power_delay_ms = hub_get_port_poweron_delay_ms(),
|
||||
};
|
||||
@@ -136,8 +136,8 @@ TEST_CASE("Port: enumerate child device Low-speed", "[ext_port][low_speed]")
|
||||
TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_LS <= port_num);
|
||||
// Create External Port
|
||||
ext_port_config_t port_config = {
|
||||
.context = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.context = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_port_num = TEST_PORT_NUM_DEVICE_LS,
|
||||
.port_power_delay_ms = hub_get_port_poweron_delay_ms(),
|
||||
};
|
||||
@@ -146,7 +146,7 @@ TEST_CASE("Port: enumerate child device Low-speed", "[ext_port][low_speed]")
|
||||
test_ext_port_power_on(TEST_PORT_NUM_DEVICE_LS, port_hdl);
|
||||
// Wait connection
|
||||
usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_LS, port_hdl);
|
||||
printf("Hub port: %s speed device \n", (char*[]) {
|
||||
printf("Hub port: %s speed device \n", (char *[]) {
|
||||
"Low", "Full", "High"
|
||||
}[port_speed]);
|
||||
// Check the device speed
|
||||
@@ -193,8 +193,8 @@ TEST_CASE("Port: enumerate child device Full-speed", "[ext_port][full_speed]")
|
||||
TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num);
|
||||
// Create External Port
|
||||
ext_port_config_t port_config = {
|
||||
.context = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.context = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_port_num = TEST_PORT_NUM_DEVICE_FSHS,
|
||||
.port_power_delay_ms = hub_get_port_poweron_delay_ms(),
|
||||
};
|
||||
@@ -203,7 +203,7 @@ TEST_CASE("Port: enumerate child device Full-speed", "[ext_port][full_speed]")
|
||||
test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
// Wait connection
|
||||
usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
printf("Hub port: %s speed device \n", (char*[]) {
|
||||
printf("Hub port: %s speed device \n", (char *[]) {
|
||||
"Low", "Full", "High"
|
||||
}[port_speed]);
|
||||
// Check the device speed
|
||||
@@ -250,8 +250,8 @@ TEST_CASE("Port: enumerate child device High-speed", "[ext_port][high_speed]")
|
||||
TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num);
|
||||
// Create External Port
|
||||
ext_port_config_t port_config = {
|
||||
.context = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.context = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_port_num = TEST_PORT_NUM_DEVICE_FSHS,
|
||||
.port_power_delay_ms = hub_get_port_poweron_delay_ms(),
|
||||
};
|
||||
@@ -260,7 +260,7 @@ TEST_CASE("Port: enumerate child device High-speed", "[ext_port][high_speed]")
|
||||
test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
// Wait connection
|
||||
usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
printf("Hub port: %s speed device \n", (char*[]) {
|
||||
printf("Hub port: %s speed device \n", (char *[]) {
|
||||
"Low", "Full", "High"
|
||||
}[port_speed]);
|
||||
// Check the device speed
|
||||
@@ -307,8 +307,8 @@ TEST_CASE("Port: recycle", "[ext_port][full_speed][high_speed]")
|
||||
TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num);
|
||||
// Create External Port
|
||||
ext_port_config_t port_config = {
|
||||
.context = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.context = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_port_num = TEST_PORT_NUM_DEVICE_FSHS,
|
||||
.port_power_delay_ms = hub_get_port_poweron_delay_ms(),
|
||||
};
|
||||
@@ -317,7 +317,7 @@ TEST_CASE("Port: recycle", "[ext_port][full_speed][high_speed]")
|
||||
test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
// Wait connection
|
||||
usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
printf("Hub port: %s speed device \n", (char*[]) {
|
||||
printf("Hub port: %s speed device \n", (char *[]) {
|
||||
"Low", "Full", "High"
|
||||
}[port_speed]);
|
||||
// Wait disconnection
|
||||
@@ -331,7 +331,7 @@ TEST_CASE("Port: recycle", "[ext_port][full_speed][high_speed]")
|
||||
// Verify that port still available
|
||||
printf("Verify the port is still available...\n");
|
||||
port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
printf("Hub port: %s speed device \n", (char*[]) {
|
||||
printf("Hub port: %s speed device \n", (char *[]) {
|
||||
"Low", "Full", "High"
|
||||
}[port_speed]);
|
||||
// Wait disconnection
|
||||
@@ -352,8 +352,8 @@ TEST_CASE("Port: recycle when port is gone", "[ext_port][low_speed][full_speed][
|
||||
TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num);
|
||||
// Create External Port
|
||||
ext_port_config_t port_config = {
|
||||
.context = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.context = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_port_num = TEST_PORT_NUM_DEVICE_FSHS,
|
||||
.port_power_delay_ms = hub_get_port_poweron_delay_ms(),
|
||||
};
|
||||
@@ -362,7 +362,7 @@ TEST_CASE("Port: recycle when port is gone", "[ext_port][low_speed][full_speed][
|
||||
test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
// Wait connection
|
||||
usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
printf("Hub port: %s speed device \n", (char*[]) {
|
||||
printf("Hub port: %s speed device \n", (char *[]) {
|
||||
"Low", "Full", "High"
|
||||
}[port_speed]);
|
||||
|
||||
@@ -397,8 +397,8 @@ TEST_CASE("Port: disable", "[ext_port][full_speed][high_speed]")
|
||||
TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num);
|
||||
// Create External Port
|
||||
ext_port_config_t port_config = {
|
||||
.context = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.context = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_port_num = TEST_PORT_NUM_DEVICE_FSHS,
|
||||
.port_power_delay_ms = hub_get_port_poweron_delay_ms(),
|
||||
};
|
||||
@@ -407,7 +407,7 @@ TEST_CASE("Port: disable", "[ext_port][full_speed][high_speed]")
|
||||
test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
// Wait connection
|
||||
usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
printf("Hub port: %s speed device \n", (char*[]) {
|
||||
printf("Hub port: %s speed device \n", (char *[]) {
|
||||
"Low", "Full", "High"
|
||||
}[port_speed]);
|
||||
printf("Disable the port ...\n");
|
||||
@@ -440,8 +440,8 @@ TEST_CASE("Port: gone in state - powered on", "[ext_port][full_speed][high_speed
|
||||
TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num);
|
||||
// Create External Port
|
||||
ext_port_config_t port_config = {
|
||||
.context = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.context = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_port_num = TEST_PORT_NUM_DEVICE_FSHS,
|
||||
.port_power_delay_ms = hub_get_port_poweron_delay_ms(),
|
||||
};
|
||||
@@ -478,8 +478,8 @@ TEST_CASE("Port: gone in state - enabled", "[ext_port][full_speed][high_speed]")
|
||||
TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num);
|
||||
// Create External Port
|
||||
ext_port_config_t port_config = {
|
||||
.context = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */,
|
||||
.context = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */,
|
||||
.parent_port_num = TEST_PORT_NUM_DEVICE_FSHS,
|
||||
.port_power_delay_ms = hub_get_port_poweron_delay_ms(),
|
||||
};
|
||||
@@ -488,7 +488,7 @@ TEST_CASE("Port: gone in state - enabled", "[ext_port][full_speed][high_speed]")
|
||||
test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
// Wait connection
|
||||
usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl);
|
||||
printf("Hub port: %s speed device \n", (char*[]) {
|
||||
printf("Hub port: %s speed device \n", (char *[]) {
|
||||
"Low", "Full", "High"
|
||||
}[port_speed]);
|
||||
//
|
||||
|
||||
@@ -33,7 +33,7 @@ Procedure:
|
||||
TEST_CASE("Test HCD port disconnect event, port enabled", "[port][low_speed][full_speed][high_speed]")
|
||||
{
|
||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||
printf("Connected %s speed device \n", (char*[]) {
|
||||
printf("Connected %s speed device \n", (char *[]) {
|
||||
"Low", "Full", "High"
|
||||
}[port_speed]);
|
||||
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
||||
|
||||
@@ -9,4 +9,3 @@ There are three sets of tests in this application:
|
||||
3. High-speed: Expects high-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 [dev_msc.c](../common/dev_msc.c) and [dev_hid.c](../common/dev_hid.c).
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ TEST_CASE("Test USB Host multiconfig client (single client)", "[usb_host][full_s
|
||||
.bConfigurationValue = B_CONFIGURATION_VALUE,
|
||||
};
|
||||
|
||||
xTaskCreatePinnedToCore(multiconf_client_async_task, "async client", 4096, (void*)&multiconf_params, 2, &client_task, 0);
|
||||
xTaskCreatePinnedToCore(multiconf_client_async_task, "async client", 4096, (void *)&multiconf_params, 2, &client_task, 0);
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(client_task, "Failed to create async client task");
|
||||
// Start the task
|
||||
xTaskNotifyGive(client_task);
|
||||
@@ -335,7 +335,7 @@ TEST_CASE("Test USB Host multiconfig client (single client)", "[usb_host][full_s
|
||||
TaskHandle_t host_lib_task_hdl;
|
||||
// Get Current task handle
|
||||
TaskHandle_t pending_task = xTaskGetCurrentTaskHandle();
|
||||
xTaskCreatePinnedToCore(host_lib_task, "host lib", 4096, (void*)pending_task, 2, &host_lib_task_hdl, 0);
|
||||
xTaskCreatePinnedToCore(host_lib_task, "host lib", 4096, (void *)pending_task, 2, &host_lib_task_hdl, 0);
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(host_lib_task_hdl, "Failed to create host lib task");
|
||||
|
||||
// Wait for the device to be open
|
||||
|
||||
@@ -1235,7 +1235,7 @@ exit:
|
||||
esp_err_t usb_host_free_config_desc(const usb_config_desc_t *config_desc)
|
||||
{
|
||||
HOST_CHECK(config_desc != NULL, ESP_ERR_INVALID_ARG);
|
||||
heap_caps_free((usb_config_desc_t*)config_desc);
|
||||
heap_caps_free((usb_config_desc_t *)config_desc);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user