Teensy 4.1 core updated for C++20
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.

863 lines
35KB

  1. /* Teensyduino Core Library
  2. * http://www.pjrc.com/teensy/
  3. * Copyright (c) 2017 PJRC.COM, LLC.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * 1. The above copyright notice and this permission notice shall be
  14. * included in all copies or substantial portions of the Software.
  15. *
  16. * 2. If the Software is incorporated into a build system that allows
  17. * selection among a list of target devices, then similar target
  18. * devices manufactured by PJRC.COM must be included in the list of
  19. * target devices and selectable in the same manner.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  25. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  26. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  28. * SOFTWARE.
  29. */
  30. #pragma once
  31. // This header is NOT meant to be included when compiling
  32. // user sketches in Arduino. The low-level functions
  33. // provided by usb_dev.c are meant to be called only by
  34. // code which provides higher-level interfaces to the user.
  35. #include <stdint.h>
  36. #include <stddef.h>
  37. #define ENDPOINT_TRANSMIT_UNUSED 0x00020000
  38. #define ENDPOINT_TRANSMIT_ISOCHRONOUS 0x00C40000
  39. #define ENDPOINT_TRANSMIT_BULK 0x00C80000
  40. #define ENDPOINT_TRANSMIT_INTERRUPT 0x00CC0000
  41. #define ENDPOINT_RECEIVE_UNUSED 0x00000002
  42. #define ENDPOINT_RECEIVE_ISOCHRONOUS 0x000000C4
  43. #define ENDPOINT_RECEIVE_BULK 0x000000C8
  44. #define ENDPOINT_RECEIVE_INTERRUPT 0x000000CC
  45. /*
  46. Each group of #define lines below corresponds to one of the
  47. settings in the Tools > USB Type menu. This file defines what
  48. type of USB device is actually created for each of those menu
  49. options.
  50. Each "interface" is a set of functionality your PC or Mac will
  51. use and treat as if it is a unique device. Within each interface,
  52. the "endpoints" are the actual communication channels. Most
  53. interfaces use 1, 2 or 3 endpoints. By editing only this file,
  54. you can customize the USB Types to be any collection of interfaces.
  55. To modify a USB Type, delete the XYZ_INTERFACE lines for any
  56. interfaces you wish to remove, and copy them from another USB Type
  57. for any you want to add.
  58. Give each interface a unique number, and edit NUM_INTERFACE to
  59. reflect the total number of interfaces.
  60. Next, assign unique endpoint numbers to all the endpoints across
  61. all the interfaces your device has. You can reuse an endpoint
  62. number for transmit and receive, but the same endpoint number must
  63. not be used twice to transmit, or twice to receive.
  64. Most endpoints also require their maximum size, and some also
  65. need an interval specification (the number of milliseconds the
  66. PC will check for data from that endpoint). For existing
  67. interfaces, usually these other settings should not be changed.
  68. Edit NUM_ENDPOINTS to be at least the largest endpoint number used.
  69. Edit the ENDPOINT*_CONFIG lines so each endpoint is configured
  70. the proper way (transmit, receive, or both).
  71. If you are using existing interfaces (making your own device with
  72. a different set of interfaces) the code in all other files should
  73. automatically adapt to the new endpoints you specify here.
  74. If you need to create a new type of interface, you'll need to write
  75. the code which sends and receives packets, and presents an API to
  76. the user. Usually, a pair of files are added for the actual code,
  77. and code is also added in usb_dev.c for any control transfers,
  78. interrupt-level code, or other very low-level stuff not possible
  79. from the packet send/receive functons. Code also is added in
  80. usb_inst.c to create an instance of your C++ object. This message
  81. gives a quick summary of things you will need to know:
  82. https://forum.pjrc.com/threads/49045?p=164512&viewfull=1#post164512
  83. You may edit the Vendor and Product ID numbers, and strings. If
  84. the numbers are changed, Teensyduino may not be able to automatically
  85. find and reboot your board when you click the Upload button in
  86. the Arduino IDE. You will need to press the Program button on
  87. Teensy to initiate programming.
  88. Some operating systems, especially Windows, may cache USB device
  89. info. Changes to the device name may not update on the same
  90. computer unless the vendor or product ID numbers change, or the
  91. "bcdDevice" revision code is increased.
  92. If these instructions are missing steps or could be improved, please
  93. let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
  94. */
  95. #if defined(USB_SERIAL)
  96. #define VENDOR_ID 0x16C0
  97. #define PRODUCT_ID 0x0483
  98. #define DEVICE_CLASS 2 // 2 = Communication Class
  99. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  100. #define MANUFACTURER_NAME_LEN 11
  101. #define PRODUCT_NAME {'U','S','B',' ','S','e','r','i','a','l'}
  102. #define PRODUCT_NAME_LEN 10
  103. #define EP0_SIZE 64
  104. #define NUM_ENDPOINTS 4
  105. #define NUM_USB_BUFFERS 12
  106. #define NUM_INTERFACE 2
  107. #define CDC_STATUS_INTERFACE 0
  108. #define CDC_DATA_INTERFACE 1
  109. #define CDC_ACM_ENDPOINT 2
  110. #define CDC_RX_ENDPOINT 3
  111. #define CDC_TX_ENDPOINT 4
  112. #define CDC_ACM_SIZE 16
  113. #define CDC_RX_SIZE_480 512
  114. #define CDC_TX_SIZE_480 512
  115. #define CDC_RX_SIZE_12 64
  116. #define CDC_TX_SIZE_12 64
  117. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  118. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_UNUSED
  119. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_BULK
  120. #elif defined(USB_KEYBOARDONLY)
  121. #define VENDOR_ID 0x16C0
  122. #define PRODUCT_ID 0x04D0
  123. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  124. #define MANUFACTURER_NAME_LEN 11
  125. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d'}
  126. #define PRODUCT_NAME_LEN 8
  127. #define EP0_SIZE 64
  128. #define NUM_ENDPOINTS 4
  129. #define NUM_USB_BUFFERS 14
  130. #define NUM_INTERFACE 3
  131. #define SEREMU_INTERFACE 1 // Serial emulation
  132. #define SEREMU_TX_ENDPOINT 2
  133. #define SEREMU_TX_SIZE 64
  134. #define SEREMU_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  135. #define SEREMU_RX_ENDPOINT 2
  136. #define SEREMU_RX_SIZE 32
  137. #define SEREMU_RX_INTERVAL 2 // TODO: is this ok for 480 Mbit speed
  138. #define KEYBOARD_INTERFACE 0 // Keyboard
  139. #define KEYBOARD_ENDPOINT 3
  140. #define KEYBOARD_SIZE 8
  141. #define KEYBOARD_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  142. #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
  143. #define KEYMEDIA_ENDPOINT 4
  144. #define KEYMEDIA_SIZE 8
  145. #define KEYMEDIA_INTERVAL 4 // TODO: is this ok for 480 Mbit speed
  146. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  147. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  148. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  149. #elif defined(USB_HID)
  150. #define VENDOR_ID 0x16C0
  151. #define PRODUCT_ID 0x0482
  152. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  153. #define MANUFACTURER_NAME_LEN 11
  154. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
  155. #define PRODUCT_NAME_LEN 23
  156. #define EP0_SIZE 64
  157. #define NUM_ENDPOINTS 6
  158. #define NUM_USB_BUFFERS 24
  159. #define NUM_INTERFACE 5
  160. #define SEREMU_INTERFACE 2 // Serial emulation
  161. #define SEREMU_TX_ENDPOINT 2
  162. #define SEREMU_TX_SIZE 64
  163. #define SEREMU_TX_INTERVAL 1
  164. #define SEREMU_RX_ENDPOINT 2
  165. #define SEREMU_RX_SIZE 32
  166. #define SEREMU_RX_INTERVAL 2
  167. #define KEYBOARD_INTERFACE 0 // Keyboard
  168. #define KEYBOARD_ENDPOINT 3
  169. #define KEYBOARD_SIZE 8
  170. #define KEYBOARD_INTERVAL 1
  171. #define KEYMEDIA_INTERFACE 4 // Keyboard Media Keys
  172. #define KEYMEDIA_ENDPOINT 4
  173. #define KEYMEDIA_SIZE 8
  174. #define KEYMEDIA_INTERVAL 4
  175. #define MOUSE_INTERFACE 1 // Mouse
  176. #define MOUSE_ENDPOINT 5
  177. #define MOUSE_SIZE 8
  178. #define MOUSE_INTERVAL 1
  179. #define JOYSTICK_INTERFACE 3 // Joystick
  180. #define JOYSTICK_ENDPOINT 6
  181. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  182. #define JOYSTICK_INTERVAL 2
  183. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  184. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  185. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  186. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  187. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  188. #elif defined(USB_SERIAL_HID)
  189. #define VENDOR_ID 0x16C0
  190. #define PRODUCT_ID 0x0487
  191. #define DEVICE_CLASS 0xEF
  192. #define DEVICE_SUBCLASS 0x02
  193. #define DEVICE_PROTOCOL 0x01
  194. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  195. #define MANUFACTURER_NAME_LEN 11
  196. #define PRODUCT_NAME {'S','e','r','i','a','l','/','K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
  197. #define PRODUCT_NAME_LEN 30
  198. #define EP0_SIZE 64
  199. #define NUM_ENDPOINTS 7
  200. #define NUM_INTERFACE 6
  201. #define CDC_IAD_DESCRIPTOR 1
  202. #define CDC_STATUS_INTERFACE 0
  203. #define CDC_DATA_INTERFACE 1 // Serial
  204. #define CDC_ACM_ENDPOINT 2
  205. #define CDC_RX_ENDPOINT 3
  206. #define CDC_TX_ENDPOINT 3
  207. #define CDC_ACM_SIZE 16
  208. #define CDC_RX_SIZE_480 512
  209. #define CDC_TX_SIZE_480 512
  210. #define CDC_RX_SIZE_12 64
  211. #define CDC_TX_SIZE_12 64
  212. #define KEYBOARD_INTERFACE 2 // Keyboard
  213. #define KEYBOARD_ENDPOINT 4
  214. #define KEYBOARD_SIZE 8
  215. #define KEYBOARD_INTERVAL 1
  216. #define KEYMEDIA_INTERFACE 5 // Keyboard Media Keys
  217. #define KEYMEDIA_ENDPOINT 5
  218. #define KEYMEDIA_SIZE 8
  219. #define KEYMEDIA_INTERVAL 4
  220. #define MOUSE_INTERFACE 3 // Mouse
  221. #define MOUSE_ENDPOINT 6
  222. #define MOUSE_SIZE 8
  223. #define MOUSE_INTERVAL 2
  224. #define JOYSTICK_INTERFACE 4 // Joystick
  225. #define JOYSTICK_ENDPOINT 7
  226. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  227. #define JOYSTICK_INTERVAL 1
  228. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  229. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  230. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  231. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  232. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  233. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  234. #elif defined(USB_TOUCHSCREEN)
  235. #define VENDOR_ID 0x16C0
  236. #define PRODUCT_ID 0x04D3
  237. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  238. #define MANUFACTURER_NAME_LEN 11
  239. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','T','o','u','c','h','s','c','r','e','e','n'}
  240. #define PRODUCT_NAME_LEN 20
  241. #define EP0_SIZE 64
  242. #define NUM_ENDPOINTS 5
  243. #define NUM_INTERFACE 4
  244. #define SEREMU_INTERFACE 1 // Serial emulation
  245. #define SEREMU_TX_ENDPOINT 2
  246. #define SEREMU_TX_SIZE 64
  247. #define SEREMU_TX_INTERVAL 1
  248. #define SEREMU_RX_ENDPOINT 2
  249. #define SEREMU_RX_SIZE 32
  250. #define SEREMU_RX_INTERVAL 2
  251. #define KEYBOARD_INTERFACE 0 // Keyboard
  252. #define KEYBOARD_ENDPOINT 3
  253. #define KEYBOARD_SIZE 8
  254. #define KEYBOARD_INTERVAL 1
  255. #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
  256. #define KEYMEDIA_ENDPOINT 4
  257. #define KEYMEDIA_SIZE 8
  258. #define KEYMEDIA_INTERVAL 4
  259. #define MULTITOUCH_INTERFACE 3 // Touchscreen
  260. #define MULTITOUCH_ENDPOINT 5
  261. #define MULTITOUCH_SIZE 8
  262. #define MULTITOUCH_FINGERS 10
  263. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  264. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  265. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  266. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  267. #elif defined(USB_HID_TOUCHSCREEN)
  268. #define VENDOR_ID 0x16C0
  269. #define PRODUCT_ID 0x04D4
  270. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  271. #define MANUFACTURER_NAME_LEN 11
  272. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','T','o','u','c','h','s','c','r','e','e','n'}
  273. #define PRODUCT_NAME_LEN 26
  274. #define EP0_SIZE 64
  275. #define NUM_ENDPOINTS 6
  276. #define NUM_INTERFACE 5
  277. #define SEREMU_INTERFACE 2 // Serial emulation
  278. #define SEREMU_TX_ENDPOINT 2
  279. #define SEREMU_TX_SIZE 64
  280. #define SEREMU_TX_INTERVAL 1
  281. #define SEREMU_RX_ENDPOINT 2
  282. #define SEREMU_RX_SIZE 32
  283. #define SEREMU_RX_INTERVAL 2
  284. #define KEYBOARD_INTERFACE 0 // Keyboard
  285. #define KEYBOARD_ENDPOINT 3
  286. #define KEYBOARD_SIZE 8
  287. #define KEYBOARD_INTERVAL 1
  288. #define KEYMEDIA_INTERFACE 3 // Keyboard Media Keys
  289. #define KEYMEDIA_ENDPOINT 4
  290. #define KEYMEDIA_SIZE 8
  291. #define KEYMEDIA_INTERVAL 4
  292. #define MOUSE_INTERFACE 1 // Mouse
  293. #define MOUSE_ENDPOINT 6
  294. #define MOUSE_SIZE 8
  295. #define MOUSE_INTERVAL 2
  296. #define MULTITOUCH_INTERFACE 4 // Touchscreen
  297. #define MULTITOUCH_ENDPOINT 5
  298. #define MULTITOUCH_SIZE 8
  299. #define MULTITOUCH_FINGERS 10
  300. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  301. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  302. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  303. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  304. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  305. #elif defined(USB_MIDI)
  306. #define VENDOR_ID 0x16C0
  307. #define PRODUCT_ID 0x0485
  308. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  309. #define MANUFACTURER_NAME_LEN 11
  310. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  311. #define PRODUCT_NAME_LEN 11
  312. #define EP0_SIZE 64
  313. #define NUM_ENDPOINTS 4
  314. #define NUM_INTERFACE 2
  315. #define SEREMU_INTERFACE 1 // Serial emulation
  316. #define SEREMU_TX_ENDPOINT 2
  317. #define SEREMU_TX_SIZE 64
  318. #define SEREMU_TX_INTERVAL 1
  319. #define SEREMU_RX_ENDPOINT 2
  320. #define SEREMU_RX_SIZE 32
  321. #define SEREMU_RX_INTERVAL 2
  322. #define MIDI_INTERFACE 0 // MIDI
  323. #define MIDI_NUM_CABLES 1
  324. #define MIDI_TX_ENDPOINT 3
  325. #define MIDI_TX_SIZE_12 64
  326. #define MIDI_TX_SIZE_480 512
  327. #define MIDI_RX_ENDPOINT 3
  328. #define MIDI_RX_SIZE_12 64
  329. #define MIDI_RX_SIZE_480 512
  330. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  331. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  332. #elif defined(USB_MIDI4)
  333. #define VENDOR_ID 0x16C0
  334. #define PRODUCT_ID 0x0485
  335. #define BCD_DEVICE 0x0211
  336. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  337. #define MANUFACTURER_NAME_LEN 11
  338. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','4'}
  339. #define PRODUCT_NAME_LEN 13
  340. #define EP0_SIZE 64
  341. #define NUM_ENDPOINTS 3
  342. #define NUM_INTERFACE 2
  343. #define SEREMU_INTERFACE 1 // Serial emulation
  344. #define SEREMU_TX_ENDPOINT 2
  345. #define SEREMU_TX_SIZE 64
  346. #define SEREMU_TX_INTERVAL 1
  347. #define SEREMU_RX_ENDPOINT 2
  348. #define SEREMU_RX_SIZE 32
  349. #define SEREMU_RX_INTERVAL 2
  350. #define MIDI_INTERFACE 0 // MIDI
  351. #define MIDI_NUM_CABLES 4
  352. #define MIDI_TX_ENDPOINT 3
  353. #define MIDI_TX_SIZE_12 64
  354. #define MIDI_TX_SIZE_480 512
  355. #define MIDI_RX_ENDPOINT 3
  356. #define MIDI_RX_SIZE_12 64
  357. #define MIDI_RX_SIZE_480 512
  358. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  359. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  360. #elif defined(USB_MIDI16)
  361. #define VENDOR_ID 0x16C0
  362. #define PRODUCT_ID 0x0485
  363. #define BCD_DEVICE 0x0212
  364. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  365. #define MANUFACTURER_NAME_LEN 11
  366. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6'}
  367. #define PRODUCT_NAME_LEN 14
  368. #define EP0_SIZE 64
  369. #define NUM_ENDPOINTS 3
  370. #define NUM_INTERFACE 2
  371. #define SEREMU_INTERFACE 1 // Serial emulation
  372. #define SEREMU_TX_ENDPOINT 2
  373. #define SEREMU_TX_SIZE 64
  374. #define SEREMU_TX_INTERVAL 1
  375. #define SEREMU_RX_ENDPOINT 2
  376. #define SEREMU_RX_SIZE 32
  377. #define SEREMU_RX_INTERVAL 2
  378. #define MIDI_INTERFACE 0 // MIDI
  379. #define MIDI_NUM_CABLES 16
  380. #define MIDI_TX_ENDPOINT 3
  381. #define MIDI_TX_SIZE_12 64
  382. #define MIDI_TX_SIZE_480 512
  383. #define MIDI_RX_ENDPOINT 3
  384. #define MIDI_RX_SIZE_12 64
  385. #define MIDI_RX_SIZE_480 512
  386. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  387. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  388. #elif defined(USB_MIDI_SERIAL)
  389. #define VENDOR_ID 0x16C0
  390. #define PRODUCT_ID 0x0489
  391. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  392. #define MANUFACTURER_NAME_LEN 11
  393. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  394. #define PRODUCT_NAME_LEN 11
  395. #define EP0_SIZE 64
  396. #define NUM_ENDPOINTS 4
  397. #define NUM_INTERFACE 3
  398. #define CDC_IAD_DESCRIPTOR 1
  399. #define CDC_STATUS_INTERFACE 0
  400. #define CDC_DATA_INTERFACE 1 // Serial
  401. #define CDC_ACM_ENDPOINT 2
  402. #define CDC_RX_ENDPOINT 3
  403. #define CDC_TX_ENDPOINT 3
  404. #define CDC_ACM_SIZE 16
  405. #define CDC_RX_SIZE_480 512
  406. #define CDC_TX_SIZE_480 512
  407. #define CDC_RX_SIZE_12 64
  408. #define CDC_TX_SIZE_12 64
  409. #define MIDI_INTERFACE 2 // MIDI
  410. #define MIDI_NUM_CABLES 1
  411. #define MIDI_TX_ENDPOINT 4
  412. #define MIDI_TX_SIZE_12 64
  413. #define MIDI_TX_SIZE_480 512
  414. #define MIDI_RX_ENDPOINT 4
  415. #define MIDI_RX_SIZE_12 64
  416. #define MIDI_RX_SIZE_480 512
  417. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  418. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  419. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  420. #elif defined(USB_MIDI4_SERIAL)
  421. #define VENDOR_ID 0x16C0
  422. #define PRODUCT_ID 0x0489
  423. #define BCD_DEVICE 0x0211
  424. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  425. #define MANUFACTURER_NAME_LEN 11
  426. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','4'}
  427. #define PRODUCT_NAME_LEN 13
  428. #define EP0_SIZE 64
  429. #define NUM_ENDPOINTS 4
  430. #define NUM_INTERFACE 3
  431. #define CDC_IAD_DESCRIPTOR 1
  432. #define CDC_STATUS_INTERFACE 0
  433. #define CDC_DATA_INTERFACE 1 // Serial
  434. #define CDC_ACM_ENDPOINT 2
  435. #define CDC_RX_ENDPOINT 3
  436. #define CDC_TX_ENDPOINT 3
  437. #define CDC_ACM_SIZE 16
  438. #define CDC_RX_SIZE_480 512
  439. #define CDC_TX_SIZE_480 512
  440. #define CDC_RX_SIZE_12 64
  441. #define CDC_TX_SIZE_12 64
  442. #define MIDI_INTERFACE 2 // MIDI
  443. #define MIDI_NUM_CABLES 4
  444. #define MIDI_TX_ENDPOINT 4
  445. #define MIDI_TX_SIZE_12 64
  446. #define MIDI_TX_SIZE_480 512
  447. #define MIDI_RX_ENDPOINT 4
  448. #define MIDI_RX_SIZE_12 64
  449. #define MIDI_RX_SIZE_480 512
  450. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  451. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  452. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  453. #elif defined(USB_MIDI16_SERIAL)
  454. #define VENDOR_ID 0x16C0
  455. #define PRODUCT_ID 0x0489
  456. #define BCD_DEVICE 0x0212
  457. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  458. #define MANUFACTURER_NAME_LEN 11
  459. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6'}
  460. #define PRODUCT_NAME_LEN 14
  461. #define EP0_SIZE 64
  462. #define NUM_ENDPOINTS 4
  463. #define NUM_INTERFACE 3
  464. #define CDC_IAD_DESCRIPTOR 1
  465. #define CDC_STATUS_INTERFACE 0
  466. #define CDC_DATA_INTERFACE 1 // Serial
  467. #define CDC_ACM_ENDPOINT 2
  468. #define CDC_RX_ENDPOINT 3
  469. #define CDC_TX_ENDPOINT 3
  470. #define CDC_ACM_SIZE 16
  471. #define CDC_RX_SIZE_480 512
  472. #define CDC_TX_SIZE_480 512
  473. #define CDC_RX_SIZE_12 64
  474. #define CDC_TX_SIZE_12 64
  475. #define MIDI_INTERFACE 2 // MIDI
  476. #define MIDI_NUM_CABLES 16
  477. #define MIDI_TX_ENDPOINT 4
  478. #define MIDI_TX_SIZE_12 64
  479. #define MIDI_TX_SIZE_480 512
  480. #define MIDI_RX_ENDPOINT 4
  481. #define MIDI_RX_SIZE_12 64
  482. #define MIDI_RX_SIZE_480 512
  483. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  484. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  485. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  486. #elif defined(USB_RAWHID)
  487. #define VENDOR_ID 0x16C0
  488. #define PRODUCT_ID 0x0486
  489. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  490. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  491. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  492. #define MANUFACTURER_NAME_LEN 11
  493. #define PRODUCT_NAME {'T','e','e','n','s','y','d','u','i','n','o',' ','R','a','w','H','I','D'}
  494. #define PRODUCT_NAME_LEN 18
  495. #define EP0_SIZE 64
  496. #define NUM_ENDPOINTS 4
  497. #define NUM_INTERFACE 2
  498. #define RAWHID_INTERFACE 0 // RawHID
  499. #define RAWHID_TX_ENDPOINT 3
  500. #define RAWHID_TX_SIZE 64
  501. #define RAWHID_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  502. #define RAWHID_RX_ENDPOINT 4
  503. #define RAWHID_RX_SIZE 64
  504. #define RAWHID_RX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  505. #define SEREMU_INTERFACE 1 // Serial emulation
  506. #define SEREMU_TX_ENDPOINT 2
  507. #define SEREMU_TX_SIZE 64
  508. #define SEREMU_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  509. #define SEREMU_RX_ENDPOINT 2
  510. #define SEREMU_RX_SIZE 32
  511. #define SEREMU_RX_INTERVAL 2 // TODO: is this ok for 480 Mbit speed
  512. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  513. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  514. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_UNUSED
  515. #elif defined(USB_FLIGHTSIM)
  516. #define VENDOR_ID 0x16C0
  517. #define PRODUCT_ID 0x0488
  518. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  519. #define MANUFACTURER_NAME_LEN 11
  520. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','F','l','i','g','h','t',' ','S','i','m',' ','C','o','n','t','r','o','l','s'}
  521. #define PRODUCT_NAME_LEN 26
  522. #define EP0_SIZE 64
  523. #define NUM_ENDPOINTS 3
  524. #define NUM_INTERFACE 2
  525. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  526. #define FLIGHTSIM_TX_ENDPOINT 3
  527. #define FLIGHTSIM_TX_SIZE 64
  528. #define FLIGHTSIM_TX_INTERVAL 1
  529. #define FLIGHTSIM_RX_ENDPOINT 3
  530. #define FLIGHTSIM_RX_SIZE 64
  531. #define FLIGHTSIM_RX_INTERVAL 1
  532. #define SEREMU_INTERFACE 1 // Serial emulation
  533. #define SEREMU_TX_ENDPOINT 2
  534. #define SEREMU_TX_SIZE 64
  535. #define SEREMU_TX_INTERVAL 1
  536. #define SEREMU_RX_ENDPOINT 2
  537. #define SEREMU_RX_SIZE 32
  538. #define SEREMU_RX_INTERVAL 2
  539. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  540. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  541. #elif defined(USB_FLIGHTSIM_JOYSTICK)
  542. #define VENDOR_ID 0x16C0
  543. #define PRODUCT_ID 0x0488
  544. #define BCD_DEVICE 0x0211
  545. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  546. #define MANUFACTURER_NAME_LEN 11
  547. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','F','l','i','g','h','t',' ','S','i','m',' ','C','o','n','t','r','o','l','s'}
  548. #define PRODUCT_NAME_LEN 26
  549. #define EP0_SIZE 64
  550. #define NUM_ENDPOINTS 4
  551. #define NUM_INTERFACE 3
  552. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  553. #define FLIGHTSIM_TX_ENDPOINT 3
  554. #define FLIGHTSIM_TX_SIZE 64
  555. #define FLIGHTSIM_TX_INTERVAL 1
  556. #define FLIGHTSIM_RX_ENDPOINT 3
  557. #define FLIGHTSIM_RX_SIZE 64
  558. #define FLIGHTSIM_RX_INTERVAL 1
  559. #define SEREMU_INTERFACE 1 // Serial emulation
  560. #define SEREMU_TX_ENDPOINT 2
  561. #define SEREMU_TX_SIZE 64
  562. #define SEREMU_TX_INTERVAL 1
  563. #define SEREMU_RX_ENDPOINT 2
  564. #define SEREMU_RX_SIZE 32
  565. #define SEREMU_RX_INTERVAL 2
  566. #define JOYSTICK_INTERFACE 2 // Joystick
  567. #define JOYSTICK_ENDPOINT 4
  568. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  569. #define JOYSTICK_INTERVAL 1
  570. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  571. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  572. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  573. #elif defined(USB_MTPDISK)
  574. #define VENDOR_ID 0x16C0
  575. #define PRODUCT_ID 0x04D1
  576. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  577. #define MANUFACTURER_NAME_LEN 11
  578. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','T','P',' ','D','i','s','k'}
  579. #define PRODUCT_NAME_LEN 15
  580. #define EP0_SIZE 64
  581. #define NUM_ENDPOINTS 4
  582. #define NUM_INTERFACE 2
  583. #define MTP_INTERFACE 0 // MTP Disk
  584. #define MTP_TX_ENDPOINT 3
  585. #define MTP_TX_SIZE 64
  586. #define MTP_RX_ENDPOINT 3
  587. #define MTP_RX_SIZE 64
  588. #define MTP_EVENT_ENDPOINT 4
  589. #define MTP_EVENT_SIZE 16
  590. #define MTP_EVENT_INTERVAL 10
  591. #define SEREMU_INTERFACE 1 // Serial emulation
  592. #define SEREMU_TX_ENDPOINT 1
  593. #define SEREMU_TX_SIZE 64
  594. #define SEREMU_TX_INTERVAL 1
  595. #define SEREMU_RX_ENDPOINT 2
  596. #define SEREMU_RX_SIZE 32
  597. #define SEREMU_RX_INTERVAL 2
  598. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  599. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  600. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  601. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  602. #elif defined(USB_AUDIO)
  603. #define VENDOR_ID 0x16C0
  604. #define PRODUCT_ID 0x04D2
  605. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  606. #define MANUFACTURER_NAME_LEN 11
  607. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','A','u','d','i','o'}
  608. #define PRODUCT_NAME_LEN 12
  609. #define EP0_SIZE 64
  610. #define NUM_ENDPOINTS 5
  611. #define NUM_INTERFACE 4
  612. #define SEREMU_INTERFACE 0 // Serial emulation
  613. #define SEREMU_TX_ENDPOINT 2
  614. #define SEREMU_TX_SIZE 64
  615. #define SEREMU_TX_INTERVAL 1
  616. #define SEREMU_RX_ENDPOINT 2
  617. #define SEREMU_RX_SIZE 32
  618. #define SEREMU_RX_INTERVAL 2
  619. #define AUDIO_INTERFACE 1 // Audio (uses 3 consecutive interfaces)
  620. #define AUDIO_TX_ENDPOINT 3
  621. #define AUDIO_TX_SIZE 180
  622. //#define AUDIO_TX_SIZE_12 180
  623. //#define AUDIO_TX_SIZE_480 24
  624. #define AUDIO_RX_ENDPOINT 3
  625. #define AUDIO_RX_SIZE 180
  626. //#define AUDIO_RX_SIZE_12 180
  627. //#define AUDIO_RX_SIZE_480 24
  628. #define AUDIO_SYNC_ENDPOINT 4
  629. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  630. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS
  631. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  632. #elif defined(USB_MIDI_AUDIO_SERIAL)
  633. #define VENDOR_ID 0x16C0
  634. #define PRODUCT_ID 0x048A
  635. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  636. #define MANUFACTURER_NAME_LEN 11
  637. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','/','A','u','d','i','o'}
  638. #define PRODUCT_NAME_LEN 17
  639. #define EP0_SIZE 64
  640. #define NUM_ENDPOINTS 8
  641. #define NUM_INTERFACE 6
  642. #define CDC_IAD_DESCRIPTOR 1
  643. #define CDC_STATUS_INTERFACE 0
  644. #define CDC_DATA_INTERFACE 1 // Serial
  645. #define CDC_ACM_ENDPOINT 1
  646. #define CDC_RX_ENDPOINT 2
  647. #define CDC_TX_ENDPOINT 3
  648. #define CDC_ACM_SIZE 16
  649. #define CDC_RX_SIZE 64
  650. #define CDC_TX_SIZE 64
  651. #define MIDI_INTERFACE 2 // MIDI
  652. #define MIDI_NUM_CABLES 1
  653. #define MIDI_TX_ENDPOINT 4
  654. #define MIDI_TX_SIZE 64
  655. #define MIDI_RX_ENDPOINT 5
  656. #define MIDI_RX_SIZE 64
  657. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  658. #define AUDIO_TX_ENDPOINT 6
  659. #define AUDIO_TX_SIZE 180
  660. #define AUDIO_RX_ENDPOINT 7
  661. #define AUDIO_RX_SIZE 180
  662. #define AUDIO_SYNC_ENDPOINT 8
  663. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  664. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  665. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  666. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  667. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  668. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  669. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  670. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  671. #elif defined(USB_MIDI16_AUDIO_SERIAL)
  672. #define VENDOR_ID 0x16C0
  673. #define PRODUCT_ID 0x048A
  674. #define BCD_DEVICE 0x0212
  675. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  676. #define MANUFACTURER_NAME_LEN 11
  677. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6','/','A','u','d','i','o'}
  678. #define PRODUCT_NAME_LEN 20
  679. #define EP0_SIZE 64
  680. #define NUM_ENDPOINTS 8
  681. #define NUM_INTERFACE 6
  682. #define CDC_IAD_DESCRIPTOR 1
  683. #define CDC_STATUS_INTERFACE 0
  684. #define CDC_DATA_INTERFACE 1 // Serial
  685. #define CDC_ACM_ENDPOINT 1
  686. #define CDC_RX_ENDPOINT 2
  687. #define CDC_TX_ENDPOINT 3
  688. #define CDC_ACM_SIZE 16
  689. #define CDC_RX_SIZE 64
  690. #define CDC_TX_SIZE 64
  691. #define MIDI_INTERFACE 2 // MIDI
  692. #define MIDI_NUM_CABLES 16
  693. #define MIDI_TX_ENDPOINT 4
  694. #define MIDI_TX_SIZE 64
  695. #define MIDI_RX_ENDPOINT 5
  696. #define MIDI_RX_SIZE 64
  697. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  698. #define AUDIO_TX_ENDPOINT 6
  699. #define AUDIO_TX_SIZE 180
  700. #define AUDIO_RX_ENDPOINT 7
  701. #define AUDIO_RX_SIZE 180
  702. #define AUDIO_SYNC_ENDPOINT 8
  703. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  704. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  705. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  706. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  707. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  708. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  709. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  710. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  711. #elif defined(USB_EVERYTHING)
  712. #define VENDOR_ID 0x16C0
  713. #define PRODUCT_ID 0x0476
  714. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  715. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  716. #define DEVICE_CLASS 0xEF
  717. #define DEVICE_SUBCLASS 0x02
  718. #define DEVICE_PROTOCOL 0x01
  719. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  720. #define MANUFACTURER_NAME_LEN 11
  721. #define PRODUCT_NAME {'A','l','l',' ','T','h','e',' ','T','h','i','n','g','s'}
  722. #define PRODUCT_NAME_LEN 14
  723. #define EP0_SIZE 64
  724. #define NUM_ENDPOINTS 15
  725. #define NUM_INTERFACE 13
  726. #define CDC_IAD_DESCRIPTOR 1
  727. #define CDC_STATUS_INTERFACE 0
  728. #define CDC_DATA_INTERFACE 1 // Serial
  729. #define CDC_ACM_ENDPOINT 1
  730. #define CDC_RX_ENDPOINT 2
  731. #define CDC_TX_ENDPOINT 2
  732. #define CDC_ACM_SIZE 16
  733. #define CDC_RX_SIZE 64
  734. #define CDC_TX_SIZE 64
  735. #define MIDI_INTERFACE 2 // MIDI
  736. #define MIDI_NUM_CABLES 16
  737. #define MIDI_TX_ENDPOINT 3
  738. #define MIDI_TX_SIZE 64
  739. #define MIDI_RX_ENDPOINT 3
  740. #define MIDI_RX_SIZE 64
  741. #define KEYBOARD_INTERFACE 3 // Keyboard
  742. #define KEYBOARD_ENDPOINT 4
  743. #define KEYBOARD_SIZE 8
  744. #define KEYBOARD_INTERVAL 1
  745. #define MOUSE_INTERFACE 4 // Mouse
  746. #define MOUSE_ENDPOINT 5
  747. #define MOUSE_SIZE 8
  748. #define MOUSE_INTERVAL 2
  749. #define RAWHID_INTERFACE 5 // RawHID
  750. #define RAWHID_TX_ENDPOINT 6
  751. #define RAWHID_TX_SIZE 64
  752. #define RAWHID_TX_INTERVAL 1
  753. #define RAWHID_RX_ENDPOINT 6
  754. #define RAWHID_RX_SIZE 64
  755. #define RAWHID_RX_INTERVAL 1
  756. #define FLIGHTSIM_INTERFACE 6 // Flight Sim Control
  757. #define FLIGHTSIM_TX_ENDPOINT 9
  758. #define FLIGHTSIM_TX_SIZE 64
  759. #define FLIGHTSIM_TX_INTERVAL 1
  760. #define FLIGHTSIM_RX_ENDPOINT 9
  761. #define FLIGHTSIM_RX_SIZE 64
  762. #define FLIGHTSIM_RX_INTERVAL 1
  763. #define JOYSTICK_INTERFACE 7 // Joystick
  764. #define JOYSTICK_ENDPOINT 10
  765. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  766. #define JOYSTICK_INTERVAL 1
  767. /*
  768. #define MTP_INTERFACE 8 // MTP Disk
  769. #define MTP_TX_ENDPOINT 11
  770. #define MTP_TX_SIZE 64
  771. #define MTP_RX_ENDPOINT 3
  772. #define MTP_RX_SIZE 64
  773. #define MTP_EVENT_ENDPOINT 11
  774. #define MTP_EVENT_SIZE 16
  775. #define MTP_EVENT_INTERVAL 10
  776. */
  777. #define KEYMEDIA_INTERFACE 8 // Keyboard Media Keys
  778. #define KEYMEDIA_ENDPOINT 12
  779. #define KEYMEDIA_SIZE 8
  780. #define KEYMEDIA_INTERVAL 4
  781. #define AUDIO_INTERFACE 9 // Audio (uses 3 consecutive interfaces)
  782. #define AUDIO_TX_ENDPOINT 13
  783. #define AUDIO_TX_SIZE 180
  784. #define AUDIO_RX_ENDPOINT 13
  785. #define AUDIO_RX_SIZE 180
  786. #define AUDIO_SYNC_ENDPOINT 14
  787. #define MULTITOUCH_INTERFACE 12 // Touchscreen
  788. #define MULTITOUCH_ENDPOINT 15
  789. #define MULTITOUCH_SIZE 8
  790. #define MULTITOUCH_FINGERS 10
  791. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  792. #define ENDPOINT2_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  793. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  794. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  795. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  796. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  797. #define ENDPOINT7_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  798. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ONLY
  799. #define ENDPOINT9_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  800. #define ENDPOINT10_CONFIG ENDPOINT_TRANSMIT_ONLY
  801. #define ENDPOINT11_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  802. #define ENDPOINT12_CONFIG ENDPOINT_TRANSMIT_ONLY
  803. #define ENDPOINT13_CONFIG (ENDPOINT_RECEIVE_ISOCHRONOUS|ENDPOINT_TRANSMIT_ISOCHRONOUS)
  804. #define ENDPOINT14_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  805. #define ENDPOINT15_CONFIG ENDPOINT_TRANSMIT_ONLY
  806. #endif
  807. #ifdef USB_DESC_LIST_DEFINE
  808. #if defined(NUM_ENDPOINTS) && NUM_ENDPOINTS > 0
  809. // NUM_ENDPOINTS = number of non-zero endpoints (0 to 7)
  810. extern const uint32_t usb_endpoint_config_table[NUM_ENDPOINTS];
  811. typedef struct {
  812. uint16_t wValue;
  813. uint16_t wIndex;
  814. const uint8_t *addr;
  815. uint16_t length;
  816. } usb_descriptor_list_t;
  817. extern const usb_descriptor_list_t usb_descriptor_list[];
  818. #endif // NUM_ENDPOINTS
  819. #endif // USB_DESC_LIST_DEFINE