1 /* Teensyduino Core Library
2 * http://www.pjrc.com/teensy/
3 * Copyright (c) 2013 PJRC.COM, LLC.
4 * Modified by Jacob Alexander (2013-2014)
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * 1. The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * 2. If the Software is incorporated into a build system that allows
18 * selection among a list of target devices, then similar target
19 * devices manufactured by PJRC.COM must be included in the list of
20 * target devices and selectable in the same manner.
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 // ----- Includes -----
41 #define LSB(n) ((n) & 255)
42 #define MSB(n) (((n) >> 8) & 255)
46 // ----- USB Device Descriptor -----
48 // USB Device Descriptor. The USB host reads this first, to learn
49 // what type of device is connected.
50 static uint8_t device_descriptor[] = {
54 DEVICE_CLASS, // bDeviceClass
55 DEVICE_SUBCLASS, // bDeviceSubClass
56 DEVICE_PROTOCOL, // bDeviceProtocol
57 EP0_SIZE, // bMaxPacketSize0
58 LSB(VENDOR_ID), MSB(VENDOR_ID), // idVendor
59 LSB(PRODUCT_ID), MSB(PRODUCT_ID), // idProduct
60 0x00, 0x01, // bcdDevice
64 1 // bNumConfigurations
67 // USB Device Qualifier Descriptor
68 static uint8_t device_qualifier_descriptor[] = {
69 0 // Indicate only single speed
70 /* Device qualifier example (used for specifying multiple USB speeds)
74 DEVICE_CLASS, // bDeviceClass
75 DEVICE_SUBCLASS, // bDeviceSubClass
76 DEVICE_PROTOCOL, // bDeviceProtocol
77 EP0_SIZE, // bMaxPacketSize0
78 0, // bNumOtherSpeedConfigurations
83 // USB Debug Descriptor
84 // XXX Not sure of exact use, lsusb requests it
85 static uint8_t usb_debug_descriptor[] = {
90 // These descriptors must NOT be "const", because the USB DMA
91 // has trouble accessing flash memory with enough bandwidth
92 // while the processor is executing from flash.
97 // ----- USB HID Report Descriptsors -----
99 // Each HID interface needs a special report descriptor that tells
100 // the meaning and format of the data.
102 // Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60
103 static uint8_t keyboard_report_desc[] = {
104 // Keyboard Collection
105 0x05, 0x01, // Usage Page (Generic Desktop),
106 0x09, 0x06, // Usage (Keyboard),
107 0xA1, 0x01, // Collection (Application) - Keyboard,
110 0x75, 0x01, // Report Size (1),
111 0x95, 0x08, // Report Count (8),
112 0x05, 0x07, // Usage Page (Key Codes),
113 0x19, 0xE0, // Usage Minimum (224),
114 0x29, 0xE7, // Usage Maximum (231),
115 0x15, 0x00, // Logical Minimum (0),
116 0x25, 0x01, // Logical Maximum (1),
117 0x81, 0x02, // Input (Data, Variable, Absolute),
120 0x75, 0x08, // Report Size (8),
121 0x95, 0x01, // Report Count (1),
122 0x81, 0x03, // Output (Constant),
125 0x75, 0x01, // Report Size (1),
126 0x95, 0x05, // Report Count (5),
127 0x05, 0x08, // Usage Page (LEDs),
128 0x19, 0x01, // Usage Minimum (1),
129 0x29, 0x05, // Usage Maximum (5),
130 0x91, 0x02, // Output (Data, Variable, Absolute),
132 // LED Report Padding
133 0x75, 0x03, // Report Size (3),
134 0x95, 0x01, // Report Count (1),
135 0x91, 0x03, // Output (Constant),
138 0x75, 0x08, // Report Size (8),
139 0x95, 0x06, // Report Count (6),
140 0x15, 0x00, // Logical Minimum (0),
141 0x25, 0x7F, // Logical Maximum(104),
142 0x05, 0x07, // Usage Page (Key Codes),
143 0x19, 0x00, // Usage Minimum (0),
144 0x29, 0x7F, // Usage Maximum (104),
145 0x81, 0x00, // Input (Data, Array),
146 0xc0, // End Collection - Keyboard
149 // Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60
150 static uint8_t nkro_keyboard_report_desc[] = {
151 // Keyboard Collection
152 0x05, 0x01, // Usage Page (Generic Desktop),
153 0x09, 0x06, // Usage (Keyboard),
154 0xA1, 0x01, // Collection (Application) - Keyboard,
157 0x85, 0x01, // Report ID (1),
158 0x75, 0x01, // Report Size (1),
159 0x95, 0x08, // Report Count (8),
160 0x15, 0x00, // Logical Minimum (0),
161 0x25, 0x01, // Logical Maximum (1),
162 0x05, 0x07, // Usage Page (Key Codes),
163 0x19, 0xE0, // Usage Minimum (224),
164 0x29, 0xE7, // Usage Maximum (231),
165 0x81, 0x02, // Input (Data, Variable, Absolute),
168 0x85, 0x02, // Report ID (2),
169 0x75, 0x01, // Report Size (1),
170 0x95, 0x05, // Report Count (5),
171 0x05, 0x08, // Usage Page (LEDs),
172 0x19, 0x01, // Usage Minimum (1),
173 0x29, 0x05, // Usage Maximum (5),
174 0x91, 0x02, // Output (Data, Variable, Absolute),
176 // LED Report Padding
177 0x75, 0x03, // Report Size (3),
178 0x95, 0x01, // Report Count (1),
179 0x91, 0x03, // Output (Constant),
181 // Normal Keys - Using an NKRO Bitmap
184 // Supports all keys defined by the spec, except 1-3 which define error events
185 // and 0 which is "no keys pressed"
186 // See http://www.usb.org/developers/hidpage/Hut1_12v2.pdf Chapter 10
187 // Or Macros/PartialMap/usb_hid.h
189 // 50 (ISO \ due to \ bug) and 156 (Clear due to Delete bug) must be excluded
190 // due to a Linux bug with bitmaps (not useful anyways)
191 // 165-175 are reserved/unused as well as 222-223 and 232-65535
192 // 224-231 are used for modifiers (see above)
194 // Compatibility Notes:
195 // - Using a second endpoint for a boot mode device helps with compatibility
196 // - DO NOT use Padding in the descriptor for bitfields
197 // (Mac OSX silently fails... Windows/Linux work correctly)
199 // Packing of bitmaps are as follows:
200 // 4-49 : 6 bytes + 1 Report ID byte (0x04-0x31) ( 46 bits + 2 padding bits for 6 bytes total)
201 // 51-155 : 14 bytes + 1 Report ID byte (0x33-0x9B) (105 bits + 6 padding bits for 15 bytes total)
202 // 157-164 : 1 byte + 1 Report ID byte (0x9D-0xA4) ( 8 bits)
203 // 176-221 : 6 bytes + 1 Report ID byte (0xB0-0xDD) ( 46 bits + 2 padding bits for 6 bytes total)
205 // 4-49 (6 bytes/46 bits) - MainKeys
206 0x85, 0x03, // Report ID (3),
207 0x75, 0x01, // Report Size (1),
208 0x95, 0x2E, // Report Count (46),
209 0x15, 0x00, // Logical Minimum (0),
210 0x25, 0x01, // Logical Maximum (1),
211 0x05, 0x07, // Usage Page (Key Codes),
212 0x19, 0x04, // Usage Minimum (4),
213 0x29, 0x31, // Usage Maximum (49),
214 0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield),
216 // Should pad 2 bits according to the spec, but OSX doesn't like this -HaaTa
218 // 51-155 (14 bytes/105 bits) - SecondaryKeys
219 0x85, 0x04, // Report ID (4),
220 0x75, 0x01, // Report Size (1),
221 0x95, 0x69, // Report Count (105),
222 0x15, 0x00, // Logical Minimum (0),
223 0x25, 0x01, // Logical Maximum (1),
224 0x05, 0x07, // Usage Page (Key Codes),
225 0x19, 0x33, // Usage Minimum (51),
226 0x29, 0x9B, // Usage Maximum (155),
227 0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield),
229 // Should pad 6 bits according to the spec, but OSX doesn't like this -HaaTa
231 // 157-164 (1 byte/8 bits) - TertiaryKeys
232 0x85, 0x05, // Report ID (5),
233 0x75, 0x01, // Report Size (1),
234 0x95, 0x08, // Report Count (8),
235 0x15, 0x00, // Logical Minimum (0),
236 0x25, 0x01, // Logical Maximum (1),
237 0x05, 0x07, // Usage Page (Key Codes),
238 0x19, 0x9D, // Usage Minimum (157),
239 0x29, 0xA4, // Usage Maximum (164),
240 0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield),
242 // 176-221 (6 bytes/46 bits) - QuartiaryKeys
243 0x85, 0x06, // Report ID (6),
244 0x75, 0x01, // Report Size (1),
245 0x95, 0x2D, // Report Count (45),
246 0x15, 0x00, // Logical Minimum (0),
247 0x25, 0x01, // Logical Maximum (1),
248 0x05, 0x07, // Usage Page (Key Codes),
249 0x19, 0xB0, // Usage Minimum (176),
250 0x29, 0xDD, // Usage Maximum (221),
251 0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield),
253 // Should pad 2 bits according to the spec, but OSX doesn't like this -HaaTa
255 0xc0, // End Collection - Keyboard
257 // System Control Collection
260 // Not bothering with NKRO for this table. If there's need, I can implement it. -HaaTa
261 // Using a 1KRO scheme
262 0x05, 0x01, // Usage Page (Generic Desktop),
263 0x09, 0x80, // Usage (System Control),
264 0xA1, 0x01, // Collection (Application),
265 0x85, 0x07, // Report ID (7),
266 0x75, 0x08, // Report Size (8),
267 0x95, 0x01, // Report Count (1),
268 0x16, 0x81, 0x00, // Logical Minimum (129),
269 0x26, 0xB7, 0x00, // Logical Maximum (183),
270 0x19, 0x81, // Usage Minimum (129),
271 0x29, 0xB7, // Usage Maximum (183),
272 0x81, 0x00, // Input (Data, Array),
273 0xc0, // End Collection - System Control
275 // Consumer Control Collection - Media Keys
278 // Not bothering with NKRO for this table. If there's a need, I can implement it. -HaaTa
279 // Using a 1KRO scheme
280 0x05, 0x0c, // Usage Page (Consumer),
281 0x09, 0x01, // Usage (Consumer Control),
282 0xA1, 0x01, // Collection (Application),
283 0x85, 0x08, // Report ID (8),
284 0x75, 0x10, // Report Size (16),
285 0x95, 0x01, // Report Count (1),
286 0x16, 0x20, 0x00, // Logical Minimum (32),
287 0x26, 0x9C, 0x02, // Logical Maximum (668),
288 0x05, 0x0C, // Usage Page (Consumer),
289 0x19, 0x20, // Usage Minimum (32),
290 0x2A, 0x9C, 0x02, // Usage Maximum (668),
291 0x81, 0x00, // Input (Data, Array),
292 0xc0, // End Collection - Consumer Control
296 // Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension
297 static uint8_t mouse_report_desc[] = {
298 0x05, 0x01, // Usage Page (Generic Desktop)
299 0x09, 0x02, // Usage (Mouse)
300 0xA1, 0x01, // Collection (Application)
301 0x05, 0x09, // Usage Page (Button)
302 0x19, 0x01, // Usage Minimum (Button #1)
303 0x29, 0x03, // Usage Maximum (Button #3)
304 0x15, 0x00, // Logical Minimum (0)
305 0x25, 0x01, // Logical Maximum (1)
306 0x95, 0x03, // Report Count (3)
307 0x75, 0x01, // Report Size (1)
308 0x81, 0x02, // Input (Data, Variable, Absolute)
309 0x95, 0x01, // Report Count (1)
310 0x75, 0x05, // Report Size (5)
311 0x81, 0x03, // Input (Constant)
312 0x05, 0x01, // Usage Page (Generic Desktop)
313 0x09, 0x30, // Usage (X)
314 0x09, 0x31, // Usage (Y)
315 0x15, 0x00, // Logical Minimum (0)
316 0x26, 0xFF, 0x7F, // Logical Maximum (32767)
317 0x75, 0x10, // Report Size (16),
318 0x95, 0x02, // Report Count (2),
319 0x81, 0x02, // Input (Data, Variable, Absolute)
320 0x09, 0x38, // Usage (Wheel)
321 0x15, 0x81, // Logical Minimum (-127)
322 0x25, 0x7F, // Logical Maximum (127)
323 0x75, 0x08, // Report Size (8),
324 0x95, 0x01, // Report Count (1),
325 0x81, 0x06, // Input (Data, Variable, Relative)
326 0xC0 // End Collection
332 // ----- USB Configuration -----
334 // USB Configuration Descriptor. This huge descriptor tells all
335 // of the devices capbilities.
336 static uint8_t config_descriptor[CONFIG_DESC_SIZE] = {
337 // --- Configuration ---
339 // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
341 2, // bDescriptorType;
342 LSB(CONFIG_DESC_SIZE), // wTotalLength
343 MSB(CONFIG_DESC_SIZE),
344 NUM_INTERFACE, // bNumInterfaces
345 1, // bConfigurationValue
347 0xA0, // bmAttributes
350 // --- Keyboard HID --- Boot Mode Keyboard Interface
352 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
354 4, // bDescriptorType
355 KEYBOARD_INTERFACE, // bInterfaceNumber
356 0, // bAlternateSetting
358 0x03, // bInterfaceClass (0x03 = HID)
359 0x01, // bInterfaceSubClass (0x00 = Non-Boot, 0x01 = Boot)
360 0x01, // bInterfaceProtocol (0x01 = Keyboard)
363 // HID interface descriptor, HID 1.11 spec, section 6.2.1
365 0x21, // bDescriptorType
366 0x11, 0x01, // bcdHID
368 1, // bNumDescriptors
369 0x22, // bDescriptorType
370 LSB(sizeof(keyboard_report_desc)), // wDescriptorLength
371 MSB(sizeof(keyboard_report_desc)),
373 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
375 5, // bDescriptorType
376 KEYBOARD_ENDPOINT | 0x80, // bEndpointAddress
377 0x03, // bmAttributes (0x03=intr)
378 KEYBOARD_SIZE, 0, // wMaxPacketSize
379 KEYBOARD_INTERVAL, // bInterval
381 // --- NKRO Keyboard HID --- OS Mode Keyboard Interface
383 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
385 4, // bDescriptorType
386 NKRO_KEYBOARD_INTERFACE, // bInterfaceNumber
387 0, // bAlternateSetting
389 0x03, // bInterfaceClass (0x03 = HID)
390 0x00, // bInterfaceSubClass (0x00 = Non-Boot, 0x01 = Boot)
391 0x01, // bInterfaceProtocol (0x01 = Keyboard)
394 // HID interface descriptor, HID 1.11 spec, section 6.2.1
396 0x21, // bDescriptorType
397 0x11, 0x01, // bcdHID
399 1, // bNumDescriptors
400 0x22, // bDescriptorType
401 LSB(sizeof(nkro_keyboard_report_desc)), // wDescriptorLength
402 MSB(sizeof(nkro_keyboard_report_desc)),
404 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
406 5, // bDescriptorType
407 NKRO_KEYBOARD_ENDPOINT | 0x80, // bEndpointAddress
408 0x03, // bmAttributes (0x03=intr)
409 NKRO_KEYBOARD_SIZE, 0, // wMaxPacketSize
410 NKRO_KEYBOARD_INTERVAL, // bInterval
412 // --- Serial CDC --- CDC IAD Descriptor
414 // interface association descriptor, USB ECN, Table 9-Z
416 11, // bDescriptorType
417 CDC_STATUS_INTERFACE, // bFirstInterface
418 2, // bInterfaceCount
419 0x02, // bFunctionClass
420 0x02, // bFunctionSubClass
421 0x01, // bFunctionProtocol
424 // --- Serial CDC --- CDC Data Interface
426 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
428 4, // bDescriptorType
429 CDC_STATUS_INTERFACE, // bInterfaceNumber
430 0, // bAlternateSetting
432 0x02, // bInterfaceClass
433 0x02, // bInterfaceSubClass
434 0x01, // bInterfaceProtocol
437 // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
438 5, // bFunctionLength
439 0x24, // bDescriptorType
440 0x00, // bDescriptorSubtype
441 0x10, 0x01, // bcdCDC
443 // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
444 5, // bFunctionLength
445 0x24, // bDescriptorType
446 0x01, // bDescriptorSubtype
447 0x01, // bmCapabilities
448 CDC_DATA_INTERFACE, // bDataInterface
450 // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
451 4, // bFunctionLength
452 0x24, // bDescriptorType
453 0x02, // bDescriptorSubtype
454 0x06, // bmCapabilities
456 // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
457 5, // bFunctionLength
458 0x24, // bDescriptorType
459 0x06, // bDescriptorSubtype
460 CDC_STATUS_INTERFACE, // bMasterInterface
461 CDC_DATA_INTERFACE, // bSlaveInterface0
463 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
465 5, // bDescriptorType
466 CDC_ACM_ENDPOINT | 0x80, // bEndpointAddress
467 0x03, // bmAttributes (0x03=intr)
468 CDC_ACM_SIZE, 0, // wMaxPacketSize
471 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
473 4, // bDescriptorType
474 CDC_DATA_INTERFACE, // bInterfaceNumber
475 0, // bAlternateSetting
477 0x0A, // bInterfaceClass
478 0x00, // bInterfaceSubClass
479 0x00, // bInterfaceProtocol
482 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
484 5, // bDescriptorType
485 CDC_RX_ENDPOINT, // bEndpointAddress
486 0x02, // bmAttributes (0x02=bulk)
487 CDC_RX_SIZE, 0, // wMaxPacketSize
490 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
492 5, // bDescriptorType
493 CDC_TX_ENDPOINT | 0x80, // bEndpointAddress
494 0x02, // bmAttributes (0x02=bulk)
495 CDC_TX_SIZE, 0, // wMaxPacketSize
501 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
503 4, // bDescriptorType
504 MOUSE_INTERFACE, // bInterfaceNumber
505 0, // bAlternateSetting
507 0x03, // bInterfaceClass (0x03 = HID)
508 0x00, // bInterfaceSubClass (0x01 = Boot)
509 0x00, // bInterfaceProtocol (0x02 = Mouse)
512 // HID interface descriptor, HID 1.11 spec, section 6.2.1
514 0x21, // bDescriptorType
515 0x11, 0x01, // bcdHID
517 1, // bNumDescriptors
518 0x22, // bDescriptorType
519 LSB(sizeof(mouse_report_desc)), // wDescriptorLength
520 MSB(sizeof(mouse_report_desc)),
522 // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
524 5, // bDescriptorType
525 MOUSE_ENDPOINT | 0x80, // bEndpointAddress
526 0x03, // bmAttributes (0x03=intr)
527 MOUSE_SIZE, 0, // wMaxPacketSize
528 MOUSE_INTERVAL, // bInterval
529 #endif // MOUSE_INTERFACE
535 // ----- String Descriptors -----
537 // The descriptors above can provide human readable strings,
538 // referenced by index numbers. These descriptors are the
539 // actual string data
541 struct usb_string_descriptor_struct {
543 uint8_t bDescriptorType;
547 extern struct usb_string_descriptor_struct usb_string_manufacturer_name
548 __attribute__ ((weak, alias("usb_string_manufacturer_name_default")));
549 extern struct usb_string_descriptor_struct usb_string_product_name
550 __attribute__ ((weak, alias("usb_string_product_name_default")));
551 extern struct usb_string_descriptor_struct usb_string_serial_number
552 __attribute__ ((weak, alias("usb_string_serial_number_default")));
554 struct usb_string_descriptor_struct string0 = {
560 struct usb_string_descriptor_struct usb_string_manufacturer_name_default = {
561 sizeof(STR_MANUFACTURER),
565 struct usb_string_descriptor_struct usb_string_product_name_default = {
570 struct usb_string_descriptor_struct usb_string_serial_number_default = {
578 // ----- Descriptors List -----
580 // This table provides access to all the descriptor data above.
582 const usb_descriptor_list_t usb_descriptor_list[] = {
583 //wValue, wIndex, address, length
584 {0x0100, 0x0000, device_descriptor, sizeof(device_descriptor)},
585 {0x0200, 0x0000, config_descriptor, sizeof(config_descriptor)},
586 {0x0600, 0x0000, device_qualifier_descriptor, sizeof(device_qualifier_descriptor)},
587 {0x0A00, 0x0000, usb_debug_descriptor, sizeof(usb_debug_descriptor)},
588 {0x2200, KEYBOARD_INTERFACE, keyboard_report_desc, sizeof(keyboard_report_desc)},
589 {0x2100, KEYBOARD_INTERFACE, config_descriptor + KEYBOARD_DESC_OFFSET, 9},
590 {0x2200, NKRO_KEYBOARD_INTERFACE, nkro_keyboard_report_desc, sizeof(nkro_keyboard_report_desc)},
591 {0x2100, NKRO_KEYBOARD_INTERFACE, config_descriptor + NKRO_KEYBOARD_DESC_OFFSET, 9},
593 {0x2200, MOUSE_INTERFACE, mouse_report_desc, sizeof(mouse_report_desc)},
594 {0x2100, MOUSE_INTERFACE, config_descriptor+MOUSE_DESC_OFFSET, 9},
596 {0x0300, 0x0000, (const uint8_t *)&string0, 0},
597 {0x0301, 0x0409, (const uint8_t *)&usb_string_manufacturer_name, 0},
598 {0x0302, 0x0409, (const uint8_t *)&usb_string_product_name, 0},
599 {0x0303, 0x0409, (const uint8_t *)&usb_string_serial_number, 0},
605 // ----- Endpoint Configuration -----
607 // See usb_desc.h for Endpoint configuration
609 // 0x19 = Recieve only
610 // 0x15 = Transmit only
611 // 0x1D = Transmit & Recieve
613 const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS] =
615 #if (defined(ENDPOINT1_CONFIG) && NUM_ENDPOINTS >= 1)
617 #elif (NUM_ENDPOINTS >= 1)
620 #if (defined(ENDPOINT2_CONFIG) && NUM_ENDPOINTS >= 2)
622 #elif (NUM_ENDPOINTS >= 2)
625 #if (defined(ENDPOINT3_CONFIG) && NUM_ENDPOINTS >= 3)
627 #elif (NUM_ENDPOINTS >= 3)
630 #if (defined(ENDPOINT4_CONFIG) && NUM_ENDPOINTS >= 4)
632 #elif (NUM_ENDPOINTS >= 4)
635 #if (defined(ENDPOINT5_CONFIG) && NUM_ENDPOINTS >= 5)
637 #elif (NUM_ENDPOINTS >= 5)
640 #if (defined(ENDPOINT6_CONFIG) && NUM_ENDPOINTS >= 6)
642 #elif (NUM_ENDPOINTS >= 6)
645 #if (defined(ENDPOINT7_CONFIG) && NUM_ENDPOINTS >= 7)
647 #elif (NUM_ENDPOINTS >= 7)
650 #if (defined(ENDPOINT8_CONFIG) && NUM_ENDPOINTS >= 8)
652 #elif (NUM_ENDPOINTS >= 8)
655 #if (defined(ENDPOINT9_CONFIG) && NUM_ENDPOINTS >= 9)
657 #elif (NUM_ENDPOINTS >= 9)
660 #if (defined(ENDPOINT10_CONFIG) && NUM_ENDPOINTS >= 10)
662 #elif (NUM_ENDPOINTS >= 10)
665 #if (defined(ENDPOINT11_CONFIG) && NUM_ENDPOINTS >= 11)
667 #elif (NUM_ENDPOINTS >= 11)
670 #if (defined(ENDPOINT12_CONFIG) && NUM_ENDPOINTS >= 12)
672 #elif (NUM_ENDPOINTS >= 12)
675 #if (defined(ENDPOINT13_CONFIG) && NUM_ENDPOINTS >= 13)
677 #elif (NUM_ENDPOINTS >= 13)
680 #if (defined(ENDPOINT14_CONFIG) && NUM_ENDPOINTS >= 14)
682 #elif (NUM_ENDPOINTS >= 14)
685 #if (defined(ENDPOINT15_CONFIG) && NUM_ENDPOINTS >= 15)
687 #elif (NUM_ENDPOINTS >= 15)