Kiibohd Controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

usb_desc.c 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. #include "usb_desc.h"
  2. // USB Descriptors are binary data which the USB host reads to
  3. // automatically detect a USB device's capabilities. The format
  4. // and meaning of every field is documented in numerous USB
  5. // standards. When working with USB descriptors, despite the
  6. // complexity of the standards and poor writing quality in many
  7. // of those documents, remember descriptors are nothing more
  8. // than constant binary data that tells the USB host what the
  9. // device can do. Computers will load drivers based on this data.
  10. // Those drivers then communicate on the endpoints specified by
  11. // the descriptors.
  12. // To configure a new combination of interfaces or make minor
  13. // changes to existing configuration (eg, change the name or ID
  14. // numbers), usually you would edit "usb_desc.h". This file
  15. // is meant to be configured by the header, so generally it is
  16. // only edited to add completely new USB interfaces or features.
  17. // **************************************************************
  18. // USB Device
  19. // **************************************************************
  20. #define LSB(n) ((n) & 255)
  21. #define MSB(n) (((n) >> 8) & 255)
  22. // USB Device Descriptor. The USB host reads this first, to learn
  23. // what type of device is connected.
  24. static uint8_t device_descriptor[] = {
  25. 18, // bLength
  26. 1, // bDescriptorType
  27. 0x00, 0x02, // bcdUSB
  28. #ifdef DEVICE_CLASS
  29. DEVICE_CLASS, // bDeviceClass
  30. #else
  31. 0,
  32. #endif
  33. #ifdef DEVICE_SUBCLASS
  34. DEVICE_SUBCLASS, // bDeviceSubClass
  35. #else
  36. 0,
  37. #endif
  38. #ifdef DEVICE_PROTOCOL
  39. DEVICE_PROTOCOL, // bDeviceProtocol
  40. #else
  41. 0,
  42. #endif
  43. EP0_SIZE, // bMaxPacketSize0
  44. LSB(VENDOR_ID), MSB(VENDOR_ID), // idVendor
  45. LSB(PRODUCT_ID), MSB(PRODUCT_ID), // idProduct
  46. 0x00, 0x01, // bcdDevice
  47. 1, // iManufacturer
  48. 2, // iProduct
  49. 3, // iSerialNumber
  50. 1 // bNumConfigurations
  51. };
  52. // These descriptors must NOT be "const", because the USB DMA
  53. // has trouble accessing flash memory with enough bandwidth
  54. // while the processor is executing from flash.
  55. // **************************************************************
  56. // HID Report Descriptors
  57. // **************************************************************
  58. // Each HID interface needs a special report descriptor that tells
  59. // the meaning and format of the data.
  60. #ifdef KEYBOARD_INTERFACE
  61. // Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60
  62. static uint8_t keyboard_report_desc[] = {
  63. 0x05, 0x01, // Usage Page (Generic Desktop),
  64. 0x09, 0x06, // Usage (Keyboard),
  65. 0xA1, 0x01, // Collection (Application),
  66. 0x75, 0x01, // Report Size (1),
  67. 0x95, 0x08, // Report Count (8),
  68. 0x05, 0x07, // Usage Page (Key Codes),
  69. 0x19, 0xE0, // Usage Minimum (224),
  70. 0x29, 0xE7, // Usage Maximum (231),
  71. 0x15, 0x00, // Logical Minimum (0),
  72. 0x25, 0x01, // Logical Maximum (1),
  73. 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte
  74. 0x95, 0x08, // Report Count (8),
  75. 0x75, 0x01, // Report Size (1),
  76. 0x15, 0x00, // Logical Minimum (0),
  77. 0x25, 0x01, // Logical Maximum (1),
  78. 0x05, 0x0C, // Usage Page (Consumer),
  79. 0x09, 0xE9, // Usage (Volume Increment),
  80. 0x09, 0xEA, // Usage (Volume Decrement),
  81. 0x09, 0xE2, // Usage (Mute),
  82. 0x09, 0xCD, // Usage (Play/Pause),
  83. 0x09, 0xB5, // Usage (Scan Next Track),
  84. 0x09, 0xB6, // Usage (Scan Previous Track),
  85. 0x09, 0xB7, // Usage (Stop),
  86. 0x09, 0xB8, // Usage (Eject),
  87. 0x81, 0x02, // Input (Data, Variable, Absolute), ;Media keys
  88. 0x95, 0x05, // Report Count (5),
  89. 0x75, 0x01, // Report Size (1),
  90. 0x05, 0x08, // Usage Page (LEDs),
  91. 0x19, 0x01, // Usage Minimum (1),
  92. 0x29, 0x05, // Usage Maximum (5),
  93. 0x91, 0x02, // Output (Data, Variable, Absolute), ;LED report
  94. 0x95, 0x01, // Report Count (1),
  95. 0x75, 0x03, // Report Size (3),
  96. 0x91, 0x03, // Output (Constant), ;LED report padding
  97. 0x95, 0x06, // Report Count (6),
  98. 0x75, 0x08, // Report Size (8),
  99. 0x15, 0x00, // Logical Minimum (0),
  100. 0x25, 0x7F, // Logical Maximum(104),
  101. 0x05, 0x07, // Usage Page (Key Codes),
  102. 0x19, 0x00, // Usage Minimum (0),
  103. 0x29, 0x7F, // Usage Maximum (104),
  104. 0x81, 0x00, // Input (Data, Array), ;Normal keys
  105. 0xc0 // End Collection
  106. };
  107. #endif
  108. #ifdef MOUSE_INTERFACE
  109. // Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension
  110. static uint8_t mouse_report_desc[] = {
  111. 0x05, 0x01, // Usage Page (Generic Desktop)
  112. 0x09, 0x02, // Usage (Mouse)
  113. 0xA1, 0x01, // Collection (Application)
  114. 0x05, 0x09, // Usage Page (Button)
  115. 0x19, 0x01, // Usage Minimum (Button #1)
  116. 0x29, 0x03, // Usage Maximum (Button #3)
  117. 0x15, 0x00, // Logical Minimum (0)
  118. 0x25, 0x01, // Logical Maximum (1)
  119. 0x95, 0x03, // Report Count (3)
  120. 0x75, 0x01, // Report Size (1)
  121. 0x81, 0x02, // Input (Data, Variable, Absolute)
  122. 0x95, 0x01, // Report Count (1)
  123. 0x75, 0x05, // Report Size (5)
  124. 0x81, 0x03, // Input (Constant)
  125. 0x05, 0x01, // Usage Page (Generic Desktop)
  126. 0x09, 0x30, // Usage (X)
  127. 0x09, 0x31, // Usage (Y)
  128. 0x15, 0x81, // Logical Minimum (-127)
  129. 0x25, 0x7F, // Logical Maximum (127)
  130. 0x75, 0x08, // Report Size (8),
  131. 0x95, 0x02, // Report Count (2),
  132. 0x81, 0x06, // Input (Data, Variable, Relative)
  133. 0x09, 0x38, // Usage (Wheel)
  134. 0x95, 0x01, // Report Count (1),
  135. 0x81, 0x06, // Input (Data, Variable, Relative)
  136. 0xC0 // End Collection
  137. };
  138. #endif
  139. #ifdef JOYSTICK_INTERFACE
  140. static uint8_t joystick_report_desc[] = {
  141. 0x05, 0x01, // Usage Page (Generic Desktop)
  142. 0x09, 0x04, // Usage (Joystick)
  143. 0xA1, 0x01, // Collection (Application)
  144. 0x15, 0x00, // Logical Minimum (0)
  145. 0x25, 0x01, // Logical Maximum (1)
  146. 0x75, 0x01, // Report Size (1)
  147. 0x95, 0x20, // Report Count (32)
  148. 0x05, 0x09, // Usage Page (Button)
  149. 0x19, 0x01, // Usage Minimum (Button #1)
  150. 0x29, 0x20, // Usage Maximum (Button #32)
  151. 0x81, 0x02, // Input (variable,absolute)
  152. 0x15, 0x00, // Logical Minimum (0)
  153. 0x25, 0x07, // Logical Maximum (7)
  154. 0x35, 0x00, // Physical Minimum (0)
  155. 0x46, 0x3B, 0x01, // Physical Maximum (315)
  156. 0x75, 0x04, // Report Size (4)
  157. 0x95, 0x01, // Report Count (1)
  158. 0x65, 0x14, // Unit (20)
  159. 0x05, 0x01, // Usage Page (Generic Desktop)
  160. 0x09, 0x39, // Usage (Hat switch)
  161. 0x81, 0x42, // Input (variable,absolute,null_state)
  162. 0x05, 0x01, // Usage Page (Generic Desktop)
  163. 0x09, 0x01, // Usage (Pointer)
  164. 0xA1, 0x00, // Collection ()
  165. 0x15, 0x00, // Logical Minimum (0)
  166. 0x26, 0xFF, 0x03, // Logical Maximum (1023)
  167. 0x75, 0x0A, // Report Size (10)
  168. 0x95, 0x04, // Report Count (4)
  169. 0x09, 0x30, // Usage (X)
  170. 0x09, 0x31, // Usage (Y)
  171. 0x09, 0x32, // Usage (Z)
  172. 0x09, 0x35, // Usage (Rz)
  173. 0x81, 0x02, // Input (variable,absolute)
  174. 0xC0, // End Collection
  175. 0x15, 0x00, // Logical Minimum (0)
  176. 0x26, 0xFF, 0x03, // Logical Maximum (1023)
  177. 0x75, 0x0A, // Report Size (10)
  178. 0x95, 0x02, // Report Count (2)
  179. 0x09, 0x36, // Usage (Slider)
  180. 0x09, 0x36, // Usage (Slider)
  181. 0x81, 0x02, // Input (variable,absolute)
  182. 0xC0 // End Collection
  183. };
  184. #endif
  185. // **************************************************************
  186. // USB Configuration
  187. // **************************************************************
  188. // USB Configuration Descriptor. This huge descriptor tells all
  189. // of the devices capbilities.
  190. static uint8_t config_descriptor[CONFIG_DESC_SIZE] = {
  191. // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
  192. 9, // bLength;
  193. 2, // bDescriptorType;
  194. LSB(CONFIG_DESC_SIZE), // wTotalLength
  195. MSB(CONFIG_DESC_SIZE),
  196. NUM_INTERFACE, // bNumInterfaces
  197. 1, // bConfigurationValue
  198. 0, // iConfiguration
  199. 0xC0, // bmAttributes
  200. 50, // bMaxPower
  201. #ifdef CDC_IAD_DESCRIPTOR
  202. // interface association descriptor, USB ECN, Table 9-Z
  203. 8, // bLength
  204. 11, // bDescriptorType
  205. CDC_STATUS_INTERFACE, // bFirstInterface
  206. 2, // bInterfaceCount
  207. 0x02, // bFunctionClass
  208. 0x02, // bFunctionSubClass
  209. 0x01, // bFunctionProtocol
  210. 4, // iFunction
  211. #endif
  212. #ifdef CDC_DATA_INTERFACE
  213. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  214. 9, // bLength
  215. 4, // bDescriptorType
  216. CDC_STATUS_INTERFACE, // bInterfaceNumber
  217. 0, // bAlternateSetting
  218. 1, // bNumEndpoints
  219. 0x02, // bInterfaceClass
  220. 0x02, // bInterfaceSubClass
  221. 0x01, // bInterfaceProtocol
  222. 0, // iInterface
  223. // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
  224. 5, // bFunctionLength
  225. 0x24, // bDescriptorType
  226. 0x00, // bDescriptorSubtype
  227. 0x10, 0x01, // bcdCDC
  228. // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
  229. 5, // bFunctionLength
  230. 0x24, // bDescriptorType
  231. 0x01, // bDescriptorSubtype
  232. 0x01, // bmCapabilities
  233. 1, // bDataInterface
  234. // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
  235. 4, // bFunctionLength
  236. 0x24, // bDescriptorType
  237. 0x02, // bDescriptorSubtype
  238. 0x06, // bmCapabilities
  239. // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
  240. 5, // bFunctionLength
  241. 0x24, // bDescriptorType
  242. 0x06, // bDescriptorSubtype
  243. CDC_STATUS_INTERFACE, // bMasterInterface
  244. CDC_DATA_INTERFACE, // bSlaveInterface0
  245. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  246. 7, // bLength
  247. 5, // bDescriptorType
  248. CDC_ACM_ENDPOINT | 0x80, // bEndpointAddress
  249. 0x03, // bmAttributes (0x03=intr)
  250. CDC_ACM_SIZE, 0, // wMaxPacketSize
  251. 64, // bInterval
  252. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  253. 9, // bLength
  254. 4, // bDescriptorType
  255. CDC_DATA_INTERFACE, // bInterfaceNumber
  256. 0, // bAlternateSetting
  257. 2, // bNumEndpoints
  258. 0x0A, // bInterfaceClass
  259. 0x00, // bInterfaceSubClass
  260. 0x00, // bInterfaceProtocol
  261. 0, // iInterface
  262. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  263. 7, // bLength
  264. 5, // bDescriptorType
  265. CDC_RX_ENDPOINT, // bEndpointAddress
  266. 0x02, // bmAttributes (0x02=bulk)
  267. CDC_RX_SIZE, 0, // wMaxPacketSize
  268. 0, // bInterval
  269. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  270. 7, // bLength
  271. 5, // bDescriptorType
  272. CDC_TX_ENDPOINT | 0x80, // bEndpointAddress
  273. 0x02, // bmAttributes (0x02=bulk)
  274. CDC_TX_SIZE, 0, // wMaxPacketSize
  275. 0, // bInterval
  276. #endif // CDC_DATA_INTERFACE
  277. #ifdef KEYBOARD_INTERFACE
  278. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  279. 9, // bLength
  280. 4, // bDescriptorType
  281. KEYBOARD_INTERFACE, // bInterfaceNumber
  282. 0, // bAlternateSetting
  283. 1, // bNumEndpoints
  284. 0x03, // bInterfaceClass (0x03 = HID)
  285. 0x01, // bInterfaceSubClass (0x01 = Boot)
  286. 0x01, // bInterfaceProtocol (0x01 = Keyboard)
  287. 0, // iInterface
  288. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  289. 9, // bLength
  290. 0x21, // bDescriptorType
  291. 0x11, 0x01, // bcdHID
  292. 0, // bCountryCode
  293. 1, // bNumDescriptors
  294. 0x22, // bDescriptorType
  295. LSB(sizeof(keyboard_report_desc)), // wDescriptorLength
  296. MSB(sizeof(keyboard_report_desc)),
  297. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  298. 7, // bLength
  299. 5, // bDescriptorType
  300. KEYBOARD_ENDPOINT | 0x80, // bEndpointAddress
  301. 0x03, // bmAttributes (0x03=intr)
  302. KEYBOARD_SIZE, 0, // wMaxPacketSize
  303. KEYBOARD_INTERVAL, // bInterval
  304. #endif // KEYBOARD_INTERFACE
  305. #ifdef MOUSE_INTERFACE
  306. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  307. 9, // bLength
  308. 4, // bDescriptorType
  309. MOUSE_INTERFACE, // bInterfaceNumber
  310. 0, // bAlternateSetting
  311. 1, // bNumEndpoints
  312. 0x03, // bInterfaceClass (0x03 = HID)
  313. 0x01, // bInterfaceSubClass (0x01 = Boot)
  314. 0x02, // bInterfaceProtocol (0x02 = Mouse)
  315. 0, // iInterface
  316. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  317. 9, // bLength
  318. 0x21, // bDescriptorType
  319. 0x11, 0x01, // bcdHID
  320. 0, // bCountryCode
  321. 1, // bNumDescriptors
  322. 0x22, // bDescriptorType
  323. LSB(sizeof(mouse_report_desc)), // wDescriptorLength
  324. MSB(sizeof(mouse_report_desc)),
  325. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  326. 7, // bLength
  327. 5, // bDescriptorType
  328. MOUSE_ENDPOINT | 0x80, // bEndpointAddress
  329. 0x03, // bmAttributes (0x03=intr)
  330. MOUSE_SIZE, 0, // wMaxPacketSize
  331. MOUSE_INTERVAL, // bInterval
  332. #endif // MOUSE_INTERFACE
  333. #ifdef JOYSTICK_INTERFACE
  334. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  335. 9, // bLength
  336. 4, // bDescriptorType
  337. JOYSTICK_INTERFACE, // bInterfaceNumber
  338. 0, // bAlternateSetting
  339. 1, // bNumEndpoints
  340. 0x03, // bInterfaceClass (0x03 = HID)
  341. 0x00, // bInterfaceSubClass
  342. 0x00, // bInterfaceProtocol
  343. 0, // iInterface
  344. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  345. 9, // bLength
  346. 0x21, // bDescriptorType
  347. 0x11, 0x01, // bcdHID
  348. 0, // bCountryCode
  349. 1, // bNumDescriptors
  350. 0x22, // bDescriptorType
  351. LSB(sizeof(joystick_report_desc)), // wDescriptorLength
  352. MSB(sizeof(joystick_report_desc)),
  353. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  354. 7, // bLength
  355. 5, // bDescriptorType
  356. JOYSTICK_ENDPOINT | 0x80, // bEndpointAddress
  357. 0x03, // bmAttributes (0x03=intr)
  358. JOYSTICK_SIZE, 0, // wMaxPacketSize
  359. JOYSTICK_INTERVAL, // bInterval
  360. #endif
  361. };
  362. // **************************************************************
  363. // String Descriptors
  364. // **************************************************************
  365. // The descriptors above can provide human readable strings,
  366. // referenced by index numbers. These descriptors are the
  367. // actual string data
  368. struct usb_string_descriptor_struct {
  369. uint8_t bLength;
  370. uint8_t bDescriptorType;
  371. uint16_t wString[];
  372. };
  373. static struct usb_string_descriptor_struct string0 = {
  374. 4,
  375. 3,
  376. {0x0409}
  377. };
  378. static struct usb_string_descriptor_struct string1 = {
  379. sizeof(STR_MANUFACTURER),
  380. 3,
  381. STR_MANUFACTURER
  382. };
  383. static struct usb_string_descriptor_struct string2 = {
  384. sizeof(STR_PRODUCT),
  385. 3,
  386. STR_PRODUCT
  387. };
  388. static struct usb_string_descriptor_struct string3 = {
  389. sizeof(STR_SERIAL),
  390. 3,
  391. STR_SERIAL
  392. };
  393. // **************************************************************
  394. // Descriptors List
  395. // **************************************************************
  396. // This table provides access to all the descriptor data above.
  397. const usb_descriptor_list_t usb_descriptor_list[] = {
  398. //wValue, wIndex, address, length
  399. {0x0100, 0x0000, device_descriptor, sizeof(device_descriptor)},
  400. {0x0200, 0x0000, config_descriptor, sizeof(config_descriptor)},
  401. #ifdef KEYBOARD_INTERFACE
  402. {0x2200, KEYBOARD_INTERFACE, keyboard_report_desc, sizeof(keyboard_report_desc)},
  403. {0x2100, KEYBOARD_INTERFACE, config_descriptor+KEYBOARD_DESC_OFFSET, 9},
  404. #endif
  405. #ifdef MOUSE_INTERFACE
  406. {0x2200, MOUSE_INTERFACE, mouse_report_desc, sizeof(mouse_report_desc)},
  407. {0x2100, MOUSE_INTERFACE, config_descriptor+MOUSE_DESC_OFFSET, 9},
  408. #endif
  409. #ifdef JOYSTICK_INTERFACE
  410. {0x2200, JOYSTICK_INTERFACE, joystick_report_desc, sizeof(joystick_report_desc)},
  411. {0x2100, JOYSTICK_INTERFACE, config_descriptor+JOYSTICK_DESC_OFFSET, 9},
  412. #endif
  413. {0x0300, 0x0000, (const uint8_t *)&string0, 4},
  414. {0x0301, 0x0409, (const uint8_t *)&string1, sizeof(STR_MANUFACTURER)},
  415. {0x0302, 0x0409, (const uint8_t *)&string2, sizeof(STR_PRODUCT)},
  416. {0x0303, 0x0409, (const uint8_t *)&string3, sizeof(STR_SERIAL)},
  417. {0, 0, NULL, 0}
  418. };
  419. // **************************************************************
  420. // Endpoint Configuration
  421. // **************************************************************
  422. #if 0
  423. // 0x00 = not used
  424. // 0x19 = Recieve only
  425. // 0x15 = Transmit only
  426. // 0x1D = Transmit & Recieve
  427. //
  428. const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS] =
  429. {
  430. 0x00, 0x15, 0x19, 0x15, 0x00, 0x00, 0x00, 0x00,
  431. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  432. };
  433. #endif
  434. const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS] =
  435. {
  436. #if (defined(ENDPOINT1_CONFIG) && NUM_ENDPOINTS >= 1)
  437. ENDPOINT1_CONFIG,
  438. #elif (NUM_ENDPOINTS >= 1)
  439. ENDPOINT_UNUSED,
  440. #endif
  441. #if (defined(ENDPOINT2_CONFIG) && NUM_ENDPOINTS >= 2)
  442. ENDPOINT2_CONFIG,
  443. #elif (NUM_ENDPOINTS >= 2)
  444. ENDPOINT_UNUSED,
  445. #endif
  446. #if (defined(ENDPOINT3_CONFIG) && NUM_ENDPOINTS >= 3)
  447. ENDPOINT3_CONFIG,
  448. #elif (NUM_ENDPOINTS >= 3)
  449. ENDPOINT_UNUSED,
  450. #endif
  451. #if (defined(ENDPOINT4_CONFIG) && NUM_ENDPOINTS >= 4)
  452. ENDPOINT4_CONFIG,
  453. #elif (NUM_ENDPOINTS >= 4)
  454. ENDPOINT_UNUSED,
  455. #endif
  456. #if (defined(ENDPOINT5_CONFIG) && NUM_ENDPOINTS >= 5)
  457. ENDPOINT5_CONFIG,
  458. #elif (NUM_ENDPOINTS >= 5)
  459. ENDPOINT_UNUSED,
  460. #endif
  461. #if (defined(ENDPOINT6_CONFIG) && NUM_ENDPOINTS >= 6)
  462. ENDPOINT6_CONFIG,
  463. #elif (NUM_ENDPOINTS >= 6)
  464. ENDPOINT_UNUSED,
  465. #endif
  466. #if (defined(ENDPOINT7_CONFIG) && NUM_ENDPOINTS >= 7)
  467. ENDPOINT7_CONFIG,
  468. #elif (NUM_ENDPOINTS >= 7)
  469. ENDPOINT_UNUSED,
  470. #endif
  471. #if (defined(ENDPOINT8_CONFIG) && NUM_ENDPOINTS >= 8)
  472. ENDPOINT8_CONFIG,
  473. #elif (NUM_ENDPOINTS >= 8)
  474. ENDPOINT_UNUSED,
  475. #endif
  476. #if (defined(ENDPOINT9_CONFIG) && NUM_ENDPOINTS >= 9)
  477. ENDPOINT9_CONFIG,
  478. #elif (NUM_ENDPOINTS >= 9)
  479. ENDPOINT_UNUSED,
  480. #endif
  481. #if (defined(ENDPOINT10_CONFIG) && NUM_ENDPOINTS >= 10)
  482. ENDPOINT10_CONFIG,
  483. #elif (NUM_ENDPOINTS >= 10)
  484. ENDPOINT_UNUSED,
  485. #endif
  486. #if (defined(ENDPOINT11_CONFIG) && NUM_ENDPOINTS >= 11)
  487. ENDPOINT11_CONFIG,
  488. #elif (NUM_ENDPOINTS >= 11)
  489. ENDPOINT_UNUSED,
  490. #endif
  491. #if (defined(ENDPOINT12_CONFIG) && NUM_ENDPOINTS >= 12)
  492. ENDPOINT12_CONFIG,
  493. #elif (NUM_ENDPOINTS >= 12)
  494. ENDPOINT_UNUSED,
  495. #endif
  496. #if (defined(ENDPOINT13_CONFIG) && NUM_ENDPOINTS >= 13)
  497. ENDPOINT13_CONFIG,
  498. #elif (NUM_ENDPOINTS >= 13)
  499. ENDPOINT_UNUSED,
  500. #endif
  501. #if (defined(ENDPOINT14_CONFIG) && NUM_ENDPOINTS >= 14)
  502. ENDPOINT14_CONFIG,
  503. #elif (NUM_ENDPOINTS >= 14)
  504. ENDPOINT_UNUSED,
  505. #endif
  506. #if (defined(ENDPOINT15_CONFIG) && NUM_ENDPOINTS >= 15)
  507. ENDPOINT15_CONFIG,
  508. #elif (NUM_ENDPOINTS >= 15)
  509. ENDPOINT_UNUSED,
  510. #endif
  511. };