2 Copyright 2018 Massdrop Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef _UDI_DEVICE_CONF_H_
19 #define _UDI_DEVICE_CONF_H_
21 #include "udi_device_epsize.h"
22 #include "usb_protocol.h"
24 #include "usb_protocol_hid.h"
26 #define DEVICE_CLASS 0
27 #define DEVICE_SUBCLASS 0
28 #define DEVICE_PROTOCOL 0
32 //#define MOUSE_ENABLE //rules.mk
37 //#define EXTRAKEY_ENABLE //rules.mk
38 #ifdef EXTRAKEY_ENABLE
42 //#define RAW_ENABLE //rules.mk
47 //#define CONSOLE_ENABLE //deferred implementation
48 //#ifdef CONSOLE_ENABLE
52 //#define NKRO_ENABLE //rules.mk
57 //#define MIDI_ENABLE //deferred implementation
62 //#define VIRTSER_ENABLE //rules.mk
65 //because CDC uses IAD (interface association descriptor
66 //per USB Interface Association Descriptor Device Class Code and Use Model 7/23/2003 Rev 1.0)
68 #define DEVICE_CLASS 0xEF
69 #undef DEVICE_SUBCLASS
70 #define DEVICE_SUBCLASS 0x02
71 #undef DEVICE_PROTOCOL
72 #define DEVICE_PROTOCOL 0x01
75 /* number of interfaces */
76 #define NEXT_INTERFACE_0 0
79 #define KEYBOARD_INTERFACE NEXT_INTERFACE_0
80 #define NEXT_INTERFACE_1 (KEYBOARD_INTERFACE + 1)
81 #define UDI_HID_KBD_IFACE_NUMBER KEYBOARD_INTERFACE
83 #define NEXT_INTERFACE_1 NEXT_INTERFACE_0
86 // It is important that the Raw HID interface is at a constant
87 // interface number, to support Linux/OSX platforms and chrome.hid
88 // If Raw HID is enabled, let it be always 1.
90 #define RAW_INTERFACE NEXT_INTERFACE_1
91 #define NEXT_INTERFACE_2 (RAW_INTERFACE + 1)
93 #define NEXT_INTERFACE_2 NEXT_INTERFACE_1
97 #define MOUSE_INTERFACE NEXT_INTERFACE_2
98 #define UDI_HID_MOU_IFACE_NUMBER MOUSE_INTERFACE
99 #define NEXT_INTERFACE_3 (MOUSE_INTERFACE + 1)
101 #define NEXT_INTERFACE_3 NEXT_INTERFACE_2
105 #define EXTRAKEY_INTERFACE NEXT_INTERFACE_3
106 #define NEXT_INTERFACE_4 (EXTRAKEY_INTERFACE + 1)
107 #define UDI_HID_EXK_IFACE_NUMBER EXTRAKEY_INTERFACE
109 #define NEXT_INTERFACE_4 NEXT_INTERFACE_3
113 #define CONSOLE_INTERFACE NEXT_INTERFACE_4
114 #define NEXT_INTERFACE_5 (CONSOLE_INTERFACE + 1)
116 #define NEXT_INTERFACE_5 NEXT_INTERFACE_4
120 #define NKRO_INTERFACE NEXT_INTERFACE_5
121 #define NEXT_INTERFACE_6 (NKRO_INTERFACE + 1)
122 #define UDI_HID_NKRO_IFACE_NUMBER NKRO_INTERFACE
124 #define NEXT_INTERFACE_6 NEXT_INTERFACE_5
128 #define AC_INTERFACE NEXT_INTERFACE_6
129 #define AS_INTERFACE (AC_INTERFACE + 1)
130 #define NEXT_INTERFACE_7 (AS_INTERFACE + 1)
132 #define NEXT_INTERFACE_7 NEXT_INTERFACE_6
136 #define CCI_INTERFACE NEXT_INTERFACE_7
137 #define CDI_INTERFACE (CCI_INTERFACE + 1)
138 #define NEXT_INTERFACE_8 (CDI_INTERFACE + 1)
139 #define CDC_STATUS_INTERFACE CCI_INTERFACE
140 #define CDC_DATA_INTERFACE CDI_INTERFACE
142 #define NEXT_INTERFACE_8 NEXT_INTERFACE_7
145 /* nubmer of interfaces */
146 #define TOTAL_INTERFACES NEXT_INTERFACE_8
147 #define USB_DEVICE_NB_INTERFACE TOTAL_INTERFACES
150 // **********************************************************************
151 // Endopoint number and size
152 // **********************************************************************
153 #define USB_DEVICE_EP_CTRL_SIZE 8
155 #define NEXT_IN_EPNUM_0 1
156 #define NEXT_OUT_EPNUM_0 1
159 #define KEYBOARD_IN_EPNUM NEXT_IN_EPNUM_0
160 #define UDI_HID_KBD_EP_IN KEYBOARD_IN_EPNUM
161 #define NEXT_IN_EPNUM_1 (KEYBOARD_IN_EPNUM + 1)
162 #define UDI_HID_KBD_EP_SIZE KEYBOARD_EPSIZE
163 #define KBD_POLLING_INTERVAL 10
164 #ifndef UDI_HID_KBD_STRING_ID
165 #define UDI_HID_KBD_STRING_ID 0
168 #define NEXT_IN_EPNUM_1 NEXT_IN_EPNUM_0
172 #define MOUSE_IN_EPNUM NEXT_IN_EPNUM_1
173 #define NEXT_IN_EPNUM_2 (MOUSE_IN_EPNUM + 1)
174 #define UDI_HID_MOU_EP_IN MOUSE_IN_EPNUM
175 #define UDI_HID_MOU_EP_SIZE MOUSE_EPSIZE
176 #define MOU_POLLING_INTERVAL 10
177 #ifndef UDI_HID_MOU_STRING_ID
178 #define UDI_HID_MOU_STRING_ID 0
181 #define NEXT_IN_EPNUM_2 NEXT_IN_EPNUM_1
185 #define EXTRAKEY_IN_EPNUM NEXT_IN_EPNUM_2
186 #define UDI_HID_EXK_EP_IN EXTRAKEY_IN_EPNUM
187 #define NEXT_IN_EPNUM_3 (EXTRAKEY_IN_EPNUM + 1)
188 #define UDI_HID_EXK_EP_SIZE EXTRAKEY_EPSIZE
189 #define EXTRAKEY_POLLING_INTERVAL 10
190 #ifndef UDI_HID_EXK_STRING_ID
191 #define UDI_HID_EXK_STRING_ID 0
194 #define NEXT_IN_EPNUM_3 NEXT_IN_EPNUM_2
198 #define RAW_IN_EPNUM NEXT_IN_EPNUM_3
199 #define UDI_HID_RAW_EP_IN RAW_IN_EPNUM
200 #define NEXT_IN_EPNUM_4 (RAW_IN_EPNUM + 1)
201 #define RAW_OUT_EPNUM NEXT_OUT_EPNUM_0
202 #define UDI_HID_RAW_EP_OUT RAW_OUT_EPNUM
203 #define NEXT_OUT_EPNUM_1 (RAW_OUT_EPNUM + 1)
204 #define RAW_POLLING_INTERVAL 1
205 #ifndef UDI_HID_RAW_STRING_ID
206 #define UDI_HID_RAW_STRING_ID 0
209 #define NEXT_IN_EPNUM_4 NEXT_IN_EPNUM_3
210 #define NEXT_OUT_EPNUM_1 NEXT_OUT_EPNUM_0
214 #define CONSOLE_IN_EPNUM NEXT_IN_EPNUM_4
215 #define NEXT_IN_EPNUM_5 (CONSOLE_IN_EPNUM + 1)
216 #define CONSOLE_OUT_EPNUM NEXT_OUT_EPNUM_1
217 #define NEXT_OUT_EPNUM_2 (CONSOLE_OUT_EPNUM + 1)
218 #define CONSOLE_POLLING_INTERVAL 1
220 #define NEXT_IN_EPNUM_5 NEXT_IN_EPNUM_4
221 #define NEXT_OUT_EPNUM_2 NEXT_OUT_EPNUM_1
225 #define NKRO_IN_EPNUM NEXT_IN_EPNUM_5
226 #define UDI_HID_NKRO_EP_IN NKRO_IN_EPNUM
227 #define NEXT_IN_EPNUM_6 (NKRO_IN_EPNUM + 1)
228 #define UDI_HID_NKRO_EP_SIZE NKRO_EPSIZE
229 #define NKRO_POLLING_INTERVAL 1
230 #ifndef UDI_HID_NKRO_STRING_ID
231 #define UDI_HID_NKRO_STRING_ID 0
234 #define NEXT_IN_EPNUM_6 NEXT_IN_EPNUM_5
238 #define MIDI_STREAM_IN_EPNUM NEXT_IN_EPNUM_6
239 #define NEXT_IN_EPNUM_7 (MIDI_STREAM_IN_EPNUM + 1)
240 #define MIDI_STREAM_OUT_EPNUM NEXT_OUT_EPNUM_2
241 #define NEXT_OUT_EPNUM_3 (MIDI_STREAM_OUT_EPNUM + 1)
242 #define MIDI_POLLING_INTERVAL 5
244 #define NEXT_IN_EPNUM_7 NEXT_IN_EPNUM_6
245 #define NEXT_OUT_EPNUM_3 NEXT_OUT_EPNUM_2
249 #define CDC_NOTIFICATION_EPNUM NEXT_IN_EPNUM_7
250 #define CDC_ACM_ENDPOINT CDC_NOTIFICATION_EPNUM
251 #define CDC_TX_ENDPOINT (CDC_NOTIFICATION_EPNUM + 1)
252 #define NEXT_IN_EPNUM_8 (CDC_TX_ENDPOINT + 1)
254 #define CDC_OUT_EPNUM NEXT_OUT_EPNUM_3
255 #define CDC_RX_ENDPOINT CDC_OUT_EPNUM
256 #define NEXT_OUT_EPNUM_4 (CDC_OUT_EPNUM + 1)
258 #define CDC_ACM_SIZE CDC_NOTIFICATION_EPSIZE
259 #define CDC_RX_SIZE CDC_EPSIZE //KFSMOD was 64
260 #define CDC_TX_SIZE CDC_RX_SIZE
261 #define CDC_ACM_POLLING_INTERVAL 255
262 #define CDC_EP_INTERVAL_STATUS CDC_ACM_POLLING_INTERVAL
263 #define CDC_DATA_POLLING_INTERVAL 5
264 #define CDC_EP_INTERVAL_DATA CDC_DATA_POLLING_INTERVAL
265 #define CDC_STATUS_NAME L"Virtual Serial Port - Status"
266 #define CDC_DATA_NAME L"Virtual Serial Port - Data"
268 #define NEXT_IN_EPNUM_8 NEXT_IN_EPNUM_7
269 #define NEXT_OUT_EPNUM_4 NEXT_OUT_EPNUM_3
272 #define TOTAL_OUT_EP NEXT_OUT_EPNUM_4
273 #define TOTAL_IN_EP NEXT_IN_EPNUM_8
274 #define USB_DEVICE_MAX_EP (max(NEXT_OUT_EPNUM_4, NEXT_IN_EPNUM_8))
276 #if USB_DEVICE_MAX_EP > 8
277 #error "There are not enough available endpoints to support all functions. Remove some in the rules.mk file.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO, MIDI, VIRTSER)"
281 // **********************************************************************
282 // KBD Descriptor structure and content
283 // **********************************************************************
289 usb_iface_desc_t iface;
290 usb_hid_descriptor_t hid;
292 } udi_hid_kbd_desc_t;
296 } udi_hid_kbd_report_desc_t;
298 #define UDI_HID_KBD_DESC {\
299 .iface.bLength = sizeof(usb_iface_desc_t),\
300 .iface.bDescriptorType = USB_DT_INTERFACE,\
301 .iface.bInterfaceNumber = UDI_HID_KBD_IFACE_NUMBER,\
302 .iface.bAlternateSetting = 0,\
303 .iface.bNumEndpoints = 1,\
304 .iface.bInterfaceClass = HID_CLASS,\
305 .iface.bInterfaceSubClass = HID_SUB_CLASS_BOOT,\
306 .iface.bInterfaceProtocol = HID_PROTOCOL_KEYBOARD,\
307 .iface.iInterface = UDI_HID_KBD_STRING_ID,\
308 .hid.bLength = sizeof(usb_hid_descriptor_t),\
309 .hid.bDescriptorType = USB_DT_HID,\
310 .hid.bcdHID = LE16(USB_HID_BDC_V1_11),\
311 .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE,\
312 .hid.bNumDescriptors = USB_HID_NUM_DESC,\
313 .hid.bRDescriptorType = USB_DT_HID_REPORT,\
314 .hid.wDescriptorLength = LE16(sizeof(udi_hid_kbd_report_desc_t)),\
315 .ep.bLength = sizeof(usb_ep_desc_t),\
316 .ep.bDescriptorType = USB_DT_ENDPOINT,\
317 .ep.bEndpointAddress = UDI_HID_KBD_EP_IN | USB_EP_DIR_IN,\
318 .ep.bmAttributes = USB_EP_TYPE_INTERRUPT,\
319 .ep.wMaxPacketSize = LE16(UDI_HID_KBD_EP_SIZE),\
320 .ep.bInterval = KBD_POLLING_INTERVAL,\
323 //set report buffer (from host)
324 extern uint8_t udi_hid_kbd_report_set;
326 //report buffer (to host)
327 #define UDI_HID_KBD_REPORT_SIZE 8
328 extern uint8_t udi_hid_kbd_report[UDI_HID_KBD_REPORT_SIZE];
330 COMPILER_PACK_RESET()
334 // **********************************************************************
335 // EXK Descriptor structure and content
336 // **********************************************************************
342 usb_iface_desc_t iface;
343 usb_hid_descriptor_t hid;
345 } udi_hid_exk_desc_t;
349 } udi_hid_exk_report_desc_t;
351 #define UDI_HID_EXK_DESC {\
352 .iface.bLength = sizeof(usb_iface_desc_t),\
353 .iface.bDescriptorType = USB_DT_INTERFACE,\
354 .iface.bInterfaceNumber = UDI_HID_EXK_IFACE_NUMBER,\
355 .iface.bAlternateSetting = 0,\
356 .iface.bNumEndpoints = 1,\
357 .iface.bInterfaceClass = HID_CLASS,\
358 .iface.bInterfaceSubClass = HID_SUB_CLASS_BOOT,\
359 .iface.bInterfaceProtocol = HID_PROTOCOL_GENERIC,\
360 .iface.iInterface = UDI_HID_EXK_STRING_ID,\
361 .hid.bLength = sizeof(usb_hid_descriptor_t),\
362 .hid.bDescriptorType = USB_DT_HID,\
363 .hid.bcdHID = LE16(USB_HID_BDC_V1_11),\
364 .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE,\
365 .hid.bNumDescriptors = USB_HID_NUM_DESC,\
366 .hid.bRDescriptorType = USB_DT_HID_REPORT,\
367 .hid.wDescriptorLength = LE16(sizeof(udi_hid_exk_report_desc_t)),\
368 .ep.bLength = sizeof(usb_ep_desc_t),\
369 .ep.bDescriptorType = USB_DT_ENDPOINT,\
370 .ep.bEndpointAddress = UDI_HID_EXK_EP_IN | USB_EP_DIR_IN,\
371 .ep.bmAttributes = USB_EP_TYPE_INTERRUPT,\
372 .ep.wMaxPacketSize = LE16(UDI_HID_EXK_EP_SIZE),\
373 .ep.bInterval = EXTRAKEY_POLLING_INTERVAL,\
376 //set report buffer (from host)
377 extern uint8_t udi_hid_exk_report_set;
380 #define UDI_HID_EXK_REPORT_SIZE 3
385 uint16_t report_data;
387 uint8_t raw[UDI_HID_EXK_REPORT_SIZE];
388 } udi_hid_exk_report_t;
390 extern udi_hid_exk_report_t udi_hid_exk_report;
392 COMPILER_PACK_RESET()
396 // **********************************************************************
397 // NKRO Descriptor structure and content
398 // **********************************************************************
404 usb_iface_desc_t iface;
405 usb_hid_descriptor_t hid;
407 } udi_hid_nkro_desc_t;
411 } udi_hid_nkro_report_desc_t;
413 #define UDI_HID_NKRO_DESC {\
414 .iface.bLength = sizeof(usb_iface_desc_t),\
415 .iface.bDescriptorType = USB_DT_INTERFACE,\
416 .iface.bInterfaceNumber = UDI_HID_NKRO_IFACE_NUMBER,\
417 .iface.bAlternateSetting = 0,\
418 .iface.bNumEndpoints = 1,\
419 .iface.bInterfaceClass = HID_CLASS,\
420 .iface.bInterfaceSubClass = HID_SUB_CLASS_NOBOOT,\
421 .iface.bInterfaceProtocol = HID_PROTOCOL_KEYBOARD,\
422 .iface.iInterface = UDI_HID_NKRO_STRING_ID,\
423 .hid.bLength = sizeof(usb_hid_descriptor_t),\
424 .hid.bDescriptorType = USB_DT_HID,\
425 .hid.bcdHID = LE16(USB_HID_BDC_V1_11),\
426 .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE,\
427 .hid.bNumDescriptors = USB_HID_NUM_DESC,\
428 .hid.bRDescriptorType = USB_DT_HID_REPORT,\
429 .hid.wDescriptorLength = LE16(sizeof(udi_hid_nkro_report_desc_t)),\
430 .ep.bLength = sizeof(usb_ep_desc_t),\
431 .ep.bDescriptorType = USB_DT_ENDPOINT,\
432 .ep.bEndpointAddress = UDI_HID_NKRO_EP_IN | USB_EP_DIR_IN,\
433 .ep.bmAttributes = USB_EP_TYPE_INTERRUPT,\
434 .ep.wMaxPacketSize = LE16(UDI_HID_NKRO_EP_SIZE),\
435 .ep.bInterval = NKRO_POLLING_INTERVAL,\
439 extern uint8_t udi_hid_nkro_report_set;
442 #define UDI_HID_NKRO_REPORT_SIZE 32
443 extern uint8_t udi_hid_nkro_report[UDI_HID_NKRO_REPORT_SIZE];
445 COMPILER_PACK_RESET()
449 // **********************************************************************
450 // MOU Descriptor structure and content
451 // **********************************************************************
457 usb_iface_desc_t iface;
458 usb_hid_descriptor_t hid;
460 } udi_hid_mou_desc_t;
463 uint8_t array[77];//MOU PDS
464 } udi_hid_mou_report_desc_t;
466 #define UDI_HID_MOU_DESC {\
467 .iface.bLength = sizeof(usb_iface_desc_t),\
468 .iface.bDescriptorType = USB_DT_INTERFACE,\
469 .iface.bInterfaceNumber = MOUSE_INTERFACE,\
470 .iface.bAlternateSetting = 0,\
471 .iface.bNumEndpoints = 1,\
472 .iface.bInterfaceClass = HID_CLASS,\
473 .iface.bInterfaceSubClass = HID_SUB_CLASS_BOOT,\
474 .iface.bInterfaceProtocol = HID_PROTOCOL_MOUSE,\
475 .iface.iInterface = UDI_HID_MOU_STRING_ID,\
476 .hid.bLength = sizeof(usb_hid_descriptor_t),\
477 .hid.bDescriptorType = USB_DT_HID,\
478 .hid.bcdHID = LE16(USB_HID_BDC_V1_11),\
479 .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE,\
480 .hid.bNumDescriptors = USB_HID_NUM_DESC,\
481 .hid.bRDescriptorType = USB_DT_HID_REPORT,\
482 .hid.wDescriptorLength = LE16(sizeof(udi_hid_mou_report_desc_t)),\
483 .ep.bLength = sizeof(usb_ep_desc_t),\
484 .ep.bDescriptorType = USB_DT_ENDPOINT,\
485 .ep.bEndpointAddress = UDI_HID_MOU_EP_IN | USB_EP_DIR_IN,\
486 .ep.bmAttributes = USB_EP_TYPE_INTERRUPT,\
487 .ep.wMaxPacketSize = LE16(UDI_HID_MOU_EP_SIZE),\
488 .ep.bInterval = MOU_POLLING_INTERVAL,\
491 //no set report buffer
494 #define UDI_HID_MOU_REPORT_SIZE 5 //MOU PDS
495 extern uint8_t udi_hid_mou_report[UDI_HID_MOU_REPORT_SIZE];
497 COMPILER_PACK_RESET()
501 // **********************************************************************
502 // RAW Descriptor structure and content
503 // **********************************************************************
509 usb_iface_desc_t iface;
510 usb_hid_descriptor_t hid;
511 usb_ep_desc_t ep_out;
513 } udi_hid_raw_desc_t;
517 } udi_hid_raw_report_desc_t;
519 #define UDI_HID_RAW_DESC {\
520 .iface.bLength = sizeof(usb_iface_desc_t),\
521 .iface.bDescriptorType = USB_DT_INTERFACE,\
522 .iface.bInterfaceNumber = RAW_INTERFACE,\
523 .iface.bAlternateSetting = 0,\
524 .iface.bNumEndpoints = 2,\
525 .iface.bInterfaceClass = HID_CLASS,\
526 .iface.bInterfaceSubClass = HID_SUB_CLASS_NOBOOT,\
527 .iface.bInterfaceProtocol = HID_SUB_CLASS_NOBOOT,\
528 .iface.iInterface = UDI_HID_RAW_STRING_ID,\
529 .hid.bLength = sizeof(usb_hid_descriptor_t),\
530 .hid.bDescriptorType = USB_DT_HID,\
531 .hid.bcdHID = LE16(USB_HID_BDC_V1_11),\
532 .hid.bCountryCode = USB_HID_NO_COUNTRY_CODE,\
533 .hid.bNumDescriptors = USB_HID_NUM_DESC,\
534 .hid.bRDescriptorType = USB_DT_HID_REPORT,\
535 .hid.wDescriptorLength = LE16(sizeof(udi_hid_raw_report_desc_t)),\
536 .ep_out.bLength = sizeof(usb_ep_desc_t),\
537 .ep_out.bDescriptorType = USB_DT_ENDPOINT,\
538 .ep_out.bEndpointAddress = UDI_HID_RAW_EP_OUT | USB_EP_DIR_OUT,\
539 .ep_out.bmAttributes = USB_EP_TYPE_INTERRUPT,\
540 .ep_out.wMaxPacketSize = LE16(RAW_EPSIZE),\
541 .ep_out.bInterval = RAW_POLLING_INTERVAL,\
542 .ep_in.bLength = sizeof(usb_ep_desc_t),\
543 .ep_in.bDescriptorType = USB_DT_ENDPOINT,\
544 .ep_in.bEndpointAddress = UDI_HID_RAW_EP_IN | USB_EP_DIR_IN,\
545 .ep_in.bmAttributes = USB_EP_TYPE_INTERRUPT,\
546 .ep_in.wMaxPacketSize = LE16(RAW_EPSIZE),\
547 .ep_in.bInterval = RAW_POLLING_INTERVAL,\
550 #define UDI_HID_RAW_REPORT_SIZE RAW_EPSIZE
552 extern uint8_t udi_hid_raw_report_set[UDI_HID_RAW_REPORT_SIZE];
555 extern uint8_t udi_hid_raw_report[UDI_HID_RAW_REPORT_SIZE];
557 COMPILER_PACK_RESET()
561 // **********************************************************************
562 // CDC Descriptor structure and content
563 // **********************************************************************
569 uint8_t bFunctionLength;
570 uint8_t bDescriptorType;
571 uint8_t bDescriptorSubtype;
573 } usb_cdc_hdr_desc_t;
576 uint8_t bFunctionLength;
577 uint8_t bDescriptorType;
578 uint8_t bDescriptorSubtype;
579 uint8_t bmCapabilities;
580 uint8_t bDataInterface;
581 } usb_cdc_call_mgmt_desc_t;
584 uint8_t bFunctionLength;
585 uint8_t bDescriptorType;
586 uint8_t bDescriptorSubtype;
587 uint8_t bmCapabilities;
588 } usb_cdc_acm_desc_t;
591 uint8_t bFunctionLength;
592 uint8_t bDescriptorType;
593 uint8_t bDescriptorSubtype;
594 uint8_t bMasterInterface;
595 uint8_t bSlaveInterface0;
596 } usb_cdc_union_desc_t;
599 usb_association_desc_t iaface;
600 usb_iface_desc_t iface_c;
601 usb_cdc_hdr_desc_t fd;
602 usb_cdc_call_mgmt_desc_t mfd;
603 usb_cdc_acm_desc_t acmd;
604 usb_cdc_union_desc_t ufd;
606 usb_iface_desc_t iface_d;
611 #define CDC_DESCRIPTOR {\
612 .iaface.bLength = sizeof(usb_association_desc_t),\
613 .iaface.bDescriptorType = USB_DT_IAD,\
614 .iaface.bFirstInterface = CDC_STATUS_INTERFACE,\
615 .iaface.bInterfaceCount = 2,\
616 .iaface.bFunctionClass = CDC_CLASS_DEVICE,\
617 .iaface.bFunctionSubClass = CDC_SUBCLASS_ACM,\
618 .iaface.bFunctionProtocol = CDC_PROTOCOL_V25TER,\
619 .iaface.iFunction = 0,\
620 .iface_c.bLength = sizeof(usb_iface_desc_t),\
621 .iface_c.bDescriptorType = USB_DT_INTERFACE,\
622 .iface_c.bInterfaceNumber = CDC_STATUS_INTERFACE,\
623 .iface_c.bAlternateSetting = 0,\
624 .iface_c.bNumEndpoints = 1,\
625 .iface_c.bInterfaceClass = 0x02,\
626 .iface_c.bInterfaceSubClass = 0x02,\
627 .iface_c.bInterfaceProtocol = CDC_PROTOCOL_V25TER,\
628 .iface_c.iInterface = 0,\
629 .fd.bFunctionLength = sizeof(usb_cdc_hdr_desc_t),\
630 .fd.bDescriptorType = CDC_CS_INTERFACE,\
631 .fd.bDescriptorSubtype = CDC_SCS_HEADER,\
632 .fd.bcdCDC = 0x0110,\
633 .mfd.bFunctionLength = sizeof(usb_cdc_call_mgmt_desc_t),\
634 .mfd.bDescriptorType = CDC_CS_INTERFACE,\
635 .mfd.bDescriptorSubtype = CDC_SCS_CALL_MGMT,\
636 .mfd.bmCapabilities = CDC_CALL_MGMT_SUPPORTED,\
637 .mfd.bDataInterface = CDC_DATA_INTERFACE,\
638 .acmd.bFunctionLength = sizeof(usb_cdc_acm_desc_t),\
639 .acmd.bDescriptorType = CDC_CS_INTERFACE,\
640 .acmd.bDescriptorSubtype = CDC_SCS_ACM,\
641 .acmd.bmCapabilities = CDC_ACM_SUPPORT_LINE_REQUESTS,\
642 .ufd.bFunctionLength = sizeof(usb_cdc_union_desc_t),\
643 .ufd.bDescriptorType = CDC_CS_INTERFACE,\
644 .ufd.bDescriptorSubtype = CDC_SCS_UNION,\
645 .ufd.bMasterInterface = CDC_STATUS_INTERFACE,\
646 .ufd.bSlaveInterface0 = CDC_DATA_INTERFACE,\
647 .ep_c.bLength = sizeof(usb_ep_desc_t),\
648 .ep_c.bDescriptorType = USB_DT_ENDPOINT,\
649 .ep_c.bEndpointAddress = CDC_ACM_ENDPOINT | USB_EP_DIR_IN,\
650 .ep_c.bmAttributes = USB_EP_TYPE_INTERRUPT,\
651 .ep_c.wMaxPacketSize = LE16(CDC_ACM_SIZE),\
652 .ep_c.bInterval = CDC_EP_INTERVAL_STATUS,\
653 .iface_d.bLength = sizeof(usb_iface_desc_t),\
654 .iface_d.bDescriptorType = USB_DT_INTERFACE,\
655 .iface_d.bInterfaceNumber = CDC_DATA_INTERFACE,\
656 .iface_d.bAlternateSetting = 0,\
657 .iface_d.bNumEndpoints = 2,\
658 .iface_d.bInterfaceClass = CDC_CLASS_DATA,\
659 .iface_d.bInterfaceSubClass = 0,\
660 .iface_d.bInterfaceProtocol = 0,\
661 .iface_d.iInterface = 0,\
662 .ep_rx.bLength = sizeof(usb_ep_desc_t),\
663 .ep_rx.bDescriptorType = USB_DT_ENDPOINT,\
664 .ep_rx.bEndpointAddress = CDC_RX_ENDPOINT | USB_EP_DIR_OUT,\
665 .ep_rx.bmAttributes = USB_EP_TYPE_BULK,\
666 .ep_rx.wMaxPacketSize = LE16(CDC_RX_SIZE),\
667 .ep_rx.bInterval = CDC_EP_INTERVAL_DATA,\
668 .ep_tx.bLength = sizeof(usb_ep_desc_t),\
669 .ep_tx.bDescriptorType = USB_DT_ENDPOINT,\
670 .ep_tx.bEndpointAddress = CDC_TX_ENDPOINT | USB_EP_DIR_IN,\
671 .ep_tx.bmAttributes = USB_EP_TYPE_BULK,\
672 .ep_tx.wMaxPacketSize = LE16(CDC_TX_SIZE),\
673 .ep_tx.bInterval = CDC_EP_INTERVAL_DATA,\
676 COMPILER_PACK_RESET()
680 // **********************************************************************
681 // CONFIGURATION Descriptor structure and content
682 // **********************************************************************
686 usb_conf_desc_t conf;
688 udi_hid_kbd_desc_t hid_kbd;
691 udi_hid_mou_desc_t hid_mou;
694 udi_hid_exk_desc_t hid_exk;
697 udi_hid_raw_desc_t hid_raw;
700 udi_hid_con_desc_t hid_con;
703 udi_hid_nkro_desc_t hid_nkro;
706 udi_hid_midi_desc_t hid_midi;
709 udi_cdc_desc_t cdc_serial;
713 COMPILER_PACK_RESET()
715 #endif //_UDI_DEVICE_CONF_H_