Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teensy3 usb triple serial #438

Merged
merged 10 commits into from
Feb 22, 2020
Prev Previous commit
Next Next commit
teensy3: usb_desc: Extract EMIT_CDC_IAD_DESCRIPTOR() macro
Create a macro to emit all values for a CDC Interface Association
Descriptor, and use it.

This will avoid duplication when adding support for multiple USB serial
interfaces.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
  • Loading branch information
geertu committed Feb 18, 2020
commit a0ea852ed0d419956df15a85e9732c8304160394
21 changes: 12 additions & 9 deletions teensy3/usb_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,17 @@ static uint8_t flightsim_report_desc[] = {
// USB Configuration
// **************************************************************

#define EMIT_CDC_IAD_DESCRIPTOR(prefix) \
/* interface association descriptor, USB ECN, Table 9-Z */ \
8, /* bLength */ \
11, /* bDescriptorType */ \
prefix ## _STATUS_INTERFACE, /* bFirstInterface */ \
2, /* bInterfaceCount */ \
0x02, /* bFunctionClass */ \
0x02, /* bFunctionSubClass */ \
0x01, /* bFunctionProtocol */ \
0 /* iFunction */

#define EMIT_CDC_DESCRIPTORS(prefix) \
/* interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 */ \
9, /* bLength */ \
Expand Down Expand Up @@ -660,15 +671,7 @@ static uint8_t config_descriptor[CONFIG_DESC_SIZE] = {
50, // bMaxPower

#ifdef CDC_IAD_DESCRIPTOR
// interface association descriptor, USB ECN, Table 9-Z
8, // bLength
11, // bDescriptorType
CDC_STATUS_INTERFACE, // bFirstInterface
2, // bInterfaceCount
0x02, // bFunctionClass
0x02, // bFunctionSubClass
0x01, // bFunctionProtocol
0, // iFunction
EMIT_CDC_IAD_DESCRIPTOR(CDC),
#endif

#ifdef CDC_DATA_INTERFACE
Expand Down