summaryrefslogtreecommitdiff
path: root/tests/support
diff options
context:
space:
mode:
Diffstat (limited to 'tests/support')
-rw-r--r--tests/support/descriptor_test.c89
-rw-r--r--tests/support/descriptor_test.h15
-rw-r--r--tests/support/tusb_config.h1
3 files changed, 104 insertions, 1 deletions
diff --git a/tests/support/descriptor_test.c b/tests/support/descriptor_test.c
index 725baa841..e8daadb91 100644
--- a/tests/support/descriptor_test.c
+++ b/tests/support/descriptor_test.c
@@ -151,7 +151,7 @@ const app_configuration_desc_t desc_configuration =
.bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION,
.wTotalLength = sizeof(app_configuration_desc_t) - 1, // exclude termination
- .bNumInterfaces = 3,
+ .bNumInterfaces = 5,
.bConfigurationValue = 1,
.iConfiguration = 0x00,
@@ -263,5 +263,92 @@ const app_configuration_desc_t desc_configuration =
.bInterval = 1
},
+ //------------- CDC Serial -------------//
+ .cdc_comm_interface =
+ {
+ .bLength = sizeof(tusb_descriptor_interface_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
+ .bInterfaceNumber = 4,
+ .bAlternateSetting = 0,
+ .bNumEndpoints = 1,
+ .bInterfaceClass = TUSB_CLASS_CDC,
+ .bInterfaceSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL,
+ .bInterfaceProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
+ .iInterface = 0x00
+ },
+
+ .cdc_header =
+ {
+ .bLength = sizeof(cdc_desc_func_header_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
+ .bDescriptorSubType = CDC_FUNC_DESC_HEADER,
+ .bcdCDC = 0x0120
+ },
+
+ .cdc_acm =
+ {
+ .bLength = sizeof(cdc_desc_func_abstract_control_management_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
+ .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
+ .bmCapabilities = { // 0x06
+ .support_line_request = 1,
+ .support_send_break = 1
+ }
+ },
+
+ .cdc_union =
+ {
+ .bLength = sizeof(cdc_desc_func_union_t), // plus number of
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
+ .bDescriptorSubType = CDC_FUNC_DESC_UNION,
+ .bControlInterface = 1,
+ .bSubordinateInterface = 2,
+ },
+
+ .cdc_endpoint_notification =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
+ .bEndpointAddress = 0x84,
+ .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
+ .wMaxPacketSize = 8,
+ .bInterval = 0x0a // lowest polling rate
+ },
+
+ //------------- CDC Data Interface -------------//
+ .cdc_data_interface =
+ {
+ .bLength = sizeof(tusb_descriptor_interface_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
+ .bInterfaceNumber = 5,
+ .bAlternateSetting = 0x00,
+ .bNumEndpoints = 2,
+ .bInterfaceClass = TUSB_CLASS_CDC_DATA,
+ .bInterfaceSubClass = 0,
+ .bInterfaceProtocol = 0,
+ .iInterface = 0x00
+ },
+
+ .cdc_endpoint_out =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
+ .bEndpointAddress = 5,
+ .bmAttributes = { .xfer = TUSB_XFER_BULK },
+ .wMaxPacketSize = 64,
+ .bInterval = 0
+ },
+
+ .cdc_endpoint_in =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
+ .bEndpointAddress = 0x85,
+ .bmAttributes = { .xfer = TUSB_XFER_BULK },
+ .wMaxPacketSize = 64,
+ .bInterval = 0
+ },
+
+ // TODO CDC & RNDIS
.ConfigDescTermination = 0,
};
diff --git a/tests/support/descriptor_test.h b/tests/support/descriptor_test.h
index 39d23e2c1..a452d95ef 100644
--- a/tests/support/descriptor_test.h
+++ b/tests/support/descriptor_test.h
@@ -59,6 +59,7 @@
#include "common/common.h"
#include "class/hid.h"
#include "class/msc.h"
+#include "class/cdc.h"
typedef struct
{
@@ -98,6 +99,20 @@ typedef struct
tusb_descriptor_endpoint_t msc_endpoint_in;
tusb_descriptor_endpoint_t msc_endpoint_out;
+ //------------- CDC Serial -------------//
+ //CDC Control Interface
+ tusb_descriptor_interface_t cdc_comm_interface;
+ cdc_desc_func_header_t cdc_header;
+ cdc_desc_func_abstract_control_management_t cdc_acm;
+ cdc_desc_func_union_t cdc_union;
+ tusb_descriptor_endpoint_t cdc_endpoint_notification;
+
+ //CDC Data Interface
+ tusb_descriptor_interface_t cdc_data_interface;
+ tusb_descriptor_endpoint_t cdc_endpoint_out;
+ tusb_descriptor_endpoint_t cdc_endpoint_in;
+
+
unsigned char ConfigDescTermination;
} app_configuration_desc_t;
diff --git a/tests/support/tusb_config.h b/tests/support/tusb_config.h
index e9c7b92a4..320b32222 100644
--- a/tests/support/tusb_config.h
+++ b/tests/support/tusb_config.h
@@ -74,6 +74,7 @@
//------------- CLASS -------------//
#define TUSB_CFG_HOST_HID_KEYBOARD 1
#define TUSB_CFG_HOST_HID_MOUSE 1
+#define TUSB_CFG_HOST_MSC 1
#define TUSB_CFG_HOST_CDC 1
#define TUSB_CFG_HOST_CDC_RNDIS 1