ci: Add USB Host CDC and MSC pytests to pipeline
This commit is contained in:
parent
d8754830a3
commit
55ec1cf8cc
|
@ -72,7 +72,7 @@ void usb_lib_task(void *arg)
|
|||
all_clients_gone = true;
|
||||
}
|
||||
if (event_flags & USB_HOST_LIB_EVENT_FLAGS_ALL_FREE) {
|
||||
printf("All device's freed\n");
|
||||
printf("All devices freed\n");
|
||||
all_dev_free = true;
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ static void notif_cb(cdc_acm_dev_hdl_t cdc_hdl, const cdc_acm_host_dev_event_dat
|
|||
/* Basic test to check CDC communication:
|
||||
* open/read/write/close device
|
||||
* CDC-ACM specific commands: set/get_line_coding, set_control_line_state */
|
||||
TEST_CASE("USB Host CDC-ACM driver: Basic test", "[cdc_acm][ignore]")
|
||||
TEST_CASE("read_write", "[cdc_acm]")
|
||||
{
|
||||
nb_of_responses = 0;
|
||||
cdc_acm_dev_hdl_t cdc_dev = NULL;
|
||||
|
@ -180,7 +180,7 @@ TEST_CASE("USB Host CDC-ACM driver: Basic test", "[cdc_acm][ignore]")
|
|||
}
|
||||
|
||||
/* Test communication with multiple CDC-ACM devices from one thread */
|
||||
TEST_CASE("USB Host CDC-ACM driver: Multiple devices test", "[cdc_acm][ignore]")
|
||||
TEST_CASE("multiple_devices", "[cdc_acm]")
|
||||
{
|
||||
nb_of_responses = 0;
|
||||
nb_of_responses2 = 0;
|
||||
|
@ -244,7 +244,7 @@ void tx_task(void *arg)
|
|||
* In this test, one CDC device is accessed from multiple threads.
|
||||
* It has to be opened/closed just once, though.
|
||||
*/
|
||||
TEST_CASE("USB Host CDC-ACM driver: Multiple threads test", "[cdc_acm][ignore]")
|
||||
TEST_CASE("multiple_threads", "[cdc_acm]")
|
||||
{
|
||||
nb_of_responses = 0;
|
||||
cdc_acm_dev_hdl_t cdc_dev;
|
||||
|
@ -278,7 +278,7 @@ TEST_CASE("USB Host CDC-ACM driver: Multiple threads test", "[cdc_acm][ignore]")
|
|||
}
|
||||
|
||||
/* Test CDC driver reaction to USB device sudden disconnection */
|
||||
TEST_CASE("USB Host CDC-ACM driver: Sudden disconnection test", "[cdc_acm][ignore]")
|
||||
TEST_CASE("sudden_disconnection", "[cdc_acm]")
|
||||
{
|
||||
test_install_cdc_driver();
|
||||
|
||||
|
@ -315,7 +315,7 @@ TEST_CASE("USB Host CDC-ACM driver: Sudden disconnection test", "[cdc_acm][ignor
|
|||
* -# Send unsupported CDC request
|
||||
* -# Write to read-only device
|
||||
*/
|
||||
TEST_CASE("USB Host CDC-ACM driver: Error handling", "[cdc_acm][ignore]")
|
||||
TEST_CASE("error_handling", "[cdc_acm]")
|
||||
{
|
||||
cdc_acm_dev_hdl_t cdc_dev;
|
||||
cdc_acm_host_device_config_t dev_config = {
|
||||
|
@ -375,7 +375,7 @@ TEST_CASE("USB Host CDC-ACM driver: Error handling", "[cdc_acm][ignore]")
|
|||
|
||||
/* Following test case implements dual CDC-ACM USB device that can be used as mock device for CDC-ACM Host tests */
|
||||
void run_usb_dual_cdc_device(void);
|
||||
TEST_CASE("USB_CDC_Mock_Device_App", "[cdc_acm_device][ignore]")
|
||||
TEST_CASE("mock_device_app", "[cdc_acm_device][ignore]")
|
||||
{
|
||||
run_usb_dual_cdc_device();
|
||||
}
|
||||
|
|
|
@ -19,9 +19,36 @@ void tinyusb_cdc_rx_callback(int itf, cdcacm_event_t *event)
|
|||
tinyusb_cdcacm_write_flush(itf, 0);
|
||||
}
|
||||
|
||||
static const tusb_desc_device_t cdc_device_descriptor = {
|
||||
.bLength = sizeof(cdc_device_descriptor),
|
||||
.bDescriptorType = TUSB_DESC_DEVICE,
|
||||
.bcdUSB = 0x0200,
|
||||
.bDeviceClass = TUSB_CLASS_MISC,
|
||||
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
|
||||
.bDeviceProtocol = MISC_PROTOCOL_IAD,
|
||||
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
|
||||
.idVendor = USB_ESPRESSIF_VID,
|
||||
.idProduct = 0x4002,
|
||||
.bcdDevice = 0x0100,
|
||||
.iManufacturer = 0x01,
|
||||
.iProduct = 0x02,
|
||||
.iSerialNumber = 0x03,
|
||||
.bNumConfigurations = 0x01
|
||||
};
|
||||
|
||||
const uint16_t cdc_desc_config_len = TUD_CONFIG_DESC_LEN + 2 * TUD_CDC_DESC_LEN;
|
||||
static const uint8_t cdc_desc_configuration[] = {
|
||||
TUD_CONFIG_DESCRIPTOR(1, 4, 0, cdc_desc_config_len, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
|
||||
TUD_CDC_DESCRIPTOR(0, 4, 0x81, 8, 0x02, 0x82, 64),
|
||||
TUD_CDC_DESCRIPTOR(2, 4, 0x83, 8, 0x04, 0x84, 64),
|
||||
};
|
||||
|
||||
void run_usb_dual_cdc_device(void)
|
||||
{
|
||||
const tinyusb_config_t tusb_cfg = {}; // the configuration using default values
|
||||
const tinyusb_config_t tusb_cfg = {
|
||||
.device_descriptor = &cdc_device_descriptor,
|
||||
.configuration_descriptor = cdc_desc_configuration
|
||||
};
|
||||
ESP_ERROR_CHECK(tinyusb_driver_install(&tusb_cfg));
|
||||
|
||||
tinyusb_config_cdcacm_t amc_cfg = {
|
||||
|
|
Loading…
Reference in New Issue