ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
usb_descriptors.h File Reference
#include "tusb.h"
#include "tinyusb_types.h"
Include dependency graph for usb_descriptors.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _PID_MAP(itf, n)

Variables

tusb_desc_device_t descriptor_tinyusb
tusb_desc_strarray_device_t descriptor_str_tinyusb
const tusb_desc_device_t descriptor_dev_kconfig
tusb_desc_strarray_device_t descriptor_str_kconfig
const uint8_t descriptor_cfg_kconfig []

Macro Definition Documentation

◆ _PID_MAP

#define _PID_MAP ( itf,
n )
Value:
((CFG_TUD_##itf) << (n))
const int n
Definition test_mmult.c:17

Definition at line 16 of file usb_descriptors.h.

Variable Documentation

◆ descriptor_cfg_kconfig

const uint8_t descriptor_cfg_kconfig[]
extern

Definition at line 166 of file usb_descriptors.c.

166 {
167 // Configuration number, interface count, string index, total length, attribute, power in mA
168 TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, TUSB_DESC_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
169
170#if CFG_TUD_CDC
171 // Interface number, string index, EP notification address and size, EP data address (out, in) and size.
172 TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, 0x80 | EPNUM_0_CDC_NOTIF, 8, EPNUM_0_CDC, 0x80 | EPNUM_0_CDC, CFG_TUD_CDC_EP_BUFSIZE),
173#endif
174
175#if CFG_TUD_CDC > 1
176 // Interface number, string index, EP notification address and size, EP data address (out, in) and size.
177 TUD_CDC_DESCRIPTOR(ITF_NUM_CDC1, 4, 0x80 | EPNUM_1_CDC_NOTIF, 8, EPNUM_1_CDC, 0x80 | EPNUM_1_CDC, CFG_TUD_CDC_EP_BUFSIZE),
178#endif
179
180#if CFG_TUD_MSC
181 // Interface number, string index, EP Out & EP In address, EP size
182 TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC, 0x80 | EPNUM_MSC, 64), // highspeed 512
183#endif
184};
@ ITF_NUM_TOTAL
@ TUSB_DESC_TOTAL_LEN

Referenced by tinyusb_driver_install().

◆ descriptor_dev_kconfig

const tusb_desc_device_t descriptor_dev_kconfig
extern

Definition at line 61 of file usb_descriptors.c.

61 {
62 .bLength = sizeof(descriptor_dev_kconfig),
63 .bDescriptorType = TUSB_DESC_DEVICE,
64 .bcdUSB = 0x0200,
65
67 // Use Interface Association Descriptor (IAD) for CDC
68 // As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
69 .bDeviceClass = TUSB_CLASS_MISC,
70 .bDeviceSubClass = MISC_SUBCLASS_COMMON,
71 .bDeviceProtocol = MISC_PROTOCOL_IAD,
72#else
73 .bDeviceClass = 0x00,
74 .bDeviceSubClass = 0x00,
75 .bDeviceProtocol = 0x00,
76#endif
77
78 .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
79
80#if CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID
81 .idVendor = USB_ESPRESSIF_VID,
82#else
83 .idVendor = CONFIG_TINYUSB_DESC_CUSTOM_VID,
84#endif
85
86#if CONFIG_TINYUSB_DESC_USE_DEFAULT_PID
87 .idProduct = USB_TUSB_PID,
88#else
89 .idProduct = CONFIG_TINYUSB_DESC_CUSTOM_PID,
90#endif
91
92 .bcdDevice = CONFIG_TINYUSB_DESC_BCD_DEVICE,
93
94 .iManufacturer = 0x01,
95 .iProduct = 0x02,
96 .iSerialNumber = 0x03,
97
98 .bNumConfigurations = 0x01
99};
#define USB_ESPRESSIF_VID
#define CFG_TUD_CDC
#define CFG_TUD_ENDPOINT0_SIZE
Definition tusb_config.h:83
#define USB_TUSB_PID
const tusb_desc_device_t descriptor_dev_kconfig

Referenced by tinyusb_driver_install().

◆ descriptor_str_kconfig

tusb_desc_strarray_device_t descriptor_str_kconfig
extern

Definition at line 101 of file usb_descriptors.c.

101 {
102 // array of pointer to string descriptors
103 (char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
104 CONFIG_TINYUSB_DESC_MANUFACTURER_STRING, // 1: Manufacturer
105 CONFIG_TINYUSB_DESC_PRODUCT_STRING, // 2: Product
106 CONFIG_TINYUSB_DESC_SERIAL_STRING, // 3: Serials, should use chip ID
107
108#if CONFIG_TINYUSB_CDC_ENABLED
109 CONFIG_TINYUSB_DESC_CDC_STRING, // 4: CDC Interface
110#else
111 "",
112#endif
113
114#if CONFIG_TINYUSB_MSC_ENABLED
115 CONFIG_TINYUSB_DESC_MSC_STRING, // 5: MSC Interface
116#else
117 "",
118#endif
119
120};

Referenced by tinyusb_driver_install().

◆ descriptor_str_tinyusb

tusb_desc_strarray_device_t descriptor_str_tinyusb
extern

Definition at line 51 of file usb_descriptors.c.

51 {
52 // array of pointer to string descriptors
53 (char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
54 "TinyUSB", // 1: Manufacturer
55 "TinyUSB Device", // 2: Product
56 "123456", // 3: Serials, should use chip ID
57};

◆ descriptor_tinyusb

tusb_desc_device_t descriptor_tinyusb
extern

Definition at line 21 of file usb_descriptors.c.

21 {
22 .bLength = sizeof(descriptor_tinyusb),
23 .bDescriptorType = TUSB_DESC_DEVICE,
24 .bcdUSB = 0x0200,
25
27 // Use Interface Association Descriptor (IAD) for CDC
28 // As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
29 .bDeviceClass = TUSB_CLASS_MISC,
30 .bDeviceSubClass = MISC_SUBCLASS_COMMON,
31 .bDeviceProtocol = MISC_PROTOCOL_IAD,
32#else
33 .bDeviceClass = 0x00,
34 .bDeviceSubClass = 0x00,
35 .bDeviceProtocol = 0x00,
36#endif
37
38 .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
39
40 .idVendor = 0xCafe,
41 .idProduct = USB_TUSB_PID,
42 .bcdDevice = 0x0100,
43
44 .iManufacturer = 0x01,
45 .iProduct = 0x02,
46 .iSerialNumber = 0x03,
47
48 .bNumConfigurations = 0x01
49};
tusb_desc_device_t descriptor_tinyusb