Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

866 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 4
  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 4
  530. #define FLIGHTSIM_RX_SIZE 64
  531. #define FLIGHTSIM_RX_INTERVAL 1
  532. #define SEREMU_INTERFACE 1 // Serial emulation
  533. #define SEREMU_TX_ENDPOINT 1
  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 ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  540. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  541. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  542. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  543. #elif defined(USB_FLIGHTSIM_JOYSTICK)
  544. #define VENDOR_ID 0x16C0
  545. #define PRODUCT_ID 0x0488
  546. #define BCD_DEVICE 0x0211
  547. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  548. #define MANUFACTURER_NAME_LEN 11
  549. #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'}
  550. #define PRODUCT_NAME_LEN 26
  551. #define EP0_SIZE 64
  552. #define NUM_ENDPOINTS 5
  553. #define NUM_INTERFACE 3
  554. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  555. #define FLIGHTSIM_TX_ENDPOINT 3
  556. #define FLIGHTSIM_TX_SIZE 64
  557. #define FLIGHTSIM_TX_INTERVAL 1
  558. #define FLIGHTSIM_RX_ENDPOINT 4
  559. #define FLIGHTSIM_RX_SIZE 64
  560. #define FLIGHTSIM_RX_INTERVAL 1
  561. #define SEREMU_INTERFACE 1 // Serial emulation
  562. #define SEREMU_TX_ENDPOINT 1
  563. #define SEREMU_TX_SIZE 64
  564. #define SEREMU_TX_INTERVAL 1
  565. #define SEREMU_RX_ENDPOINT 2
  566. #define SEREMU_RX_SIZE 32
  567. #define SEREMU_RX_INTERVAL 2
  568. #define JOYSTICK_INTERFACE 2 // Joystick
  569. #define JOYSTICK_ENDPOINT 5
  570. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  571. #define JOYSTICK_INTERVAL 1
  572. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  573. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  574. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  575. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  576. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  577. #elif defined(USB_MTPDISK)
  578. #define VENDOR_ID 0x16C0
  579. #define PRODUCT_ID 0x04D1
  580. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  581. #define MANUFACTURER_NAME_LEN 11
  582. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','T','P',' ','D','i','s','k'}
  583. #define PRODUCT_NAME_LEN 15
  584. #define EP0_SIZE 64
  585. #define NUM_ENDPOINTS 4
  586. #define NUM_INTERFACE 2
  587. #define MTP_INTERFACE 0 // MTP Disk
  588. #define MTP_TX_ENDPOINT 3
  589. #define MTP_TX_SIZE 64
  590. #define MTP_RX_ENDPOINT 3
  591. #define MTP_RX_SIZE 64
  592. #define MTP_EVENT_ENDPOINT 4
  593. #define MTP_EVENT_SIZE 16
  594. #define MTP_EVENT_INTERVAL 10
  595. #define SEREMU_INTERFACE 1 // Serial emulation
  596. #define SEREMU_TX_ENDPOINT 1
  597. #define SEREMU_TX_SIZE 64
  598. #define SEREMU_TX_INTERVAL 1
  599. #define SEREMU_RX_ENDPOINT 2
  600. #define SEREMU_RX_SIZE 32
  601. #define SEREMU_RX_INTERVAL 2
  602. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  603. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  604. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  605. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  606. #elif defined(USB_AUDIO)
  607. #define VENDOR_ID 0x16C0
  608. #define PRODUCT_ID 0x04D2
  609. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  610. #define MANUFACTURER_NAME_LEN 11
  611. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','A','u','d','i','o'}
  612. #define PRODUCT_NAME_LEN 12
  613. #define EP0_SIZE 64
  614. #define NUM_ENDPOINTS 5
  615. #define NUM_INTERFACE 4
  616. #define SEREMU_INTERFACE 0 // Serial emulation
  617. #define SEREMU_TX_ENDPOINT 1
  618. #define SEREMU_TX_SIZE 64
  619. #define SEREMU_TX_INTERVAL 1
  620. #define SEREMU_RX_ENDPOINT 2
  621. #define SEREMU_RX_SIZE 32
  622. #define SEREMU_RX_INTERVAL 2
  623. #define AUDIO_INTERFACE 1 // Audio (uses 3 consecutive interfaces)
  624. #define AUDIO_TX_ENDPOINT 3
  625. #define AUDIO_TX_SIZE 180
  626. #define AUDIO_RX_ENDPOINT 4
  627. #define AUDIO_RX_SIZE 180
  628. #define AUDIO_SYNC_ENDPOINT 5
  629. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  630. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  631. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  632. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  633. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  634. #elif defined(USB_MIDI_AUDIO_SERIAL)
  635. #define VENDOR_ID 0x16C0
  636. #define PRODUCT_ID 0x048A
  637. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  638. #define MANUFACTURER_NAME_LEN 11
  639. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','/','A','u','d','i','o'}
  640. #define PRODUCT_NAME_LEN 17
  641. #define EP0_SIZE 64
  642. #define NUM_ENDPOINTS 8
  643. #define NUM_INTERFACE 6
  644. #define CDC_IAD_DESCRIPTOR 1
  645. #define CDC_STATUS_INTERFACE 0
  646. #define CDC_DATA_INTERFACE 1 // Serial
  647. #define CDC_ACM_ENDPOINT 1
  648. #define CDC_RX_ENDPOINT 2
  649. #define CDC_TX_ENDPOINT 3
  650. #define CDC_ACM_SIZE 16
  651. #define CDC_RX_SIZE 64
  652. #define CDC_TX_SIZE 64
  653. #define MIDI_INTERFACE 2 // MIDI
  654. #define MIDI_NUM_CABLES 1
  655. #define MIDI_TX_ENDPOINT 4
  656. #define MIDI_TX_SIZE 64
  657. #define MIDI_RX_ENDPOINT 5
  658. #define MIDI_RX_SIZE 64
  659. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  660. #define AUDIO_TX_ENDPOINT 6
  661. #define AUDIO_TX_SIZE 180
  662. #define AUDIO_RX_ENDPOINT 7
  663. #define AUDIO_RX_SIZE 180
  664. #define AUDIO_SYNC_ENDPOINT 8
  665. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  666. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  667. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  668. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  669. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  670. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  671. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  672. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  673. #elif defined(USB_MIDI16_AUDIO_SERIAL)
  674. #define VENDOR_ID 0x16C0
  675. #define PRODUCT_ID 0x048A
  676. #define BCD_DEVICE 0x0212
  677. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  678. #define MANUFACTURER_NAME_LEN 11
  679. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6','/','A','u','d','i','o'}
  680. #define PRODUCT_NAME_LEN 20
  681. #define EP0_SIZE 64
  682. #define NUM_ENDPOINTS 8
  683. #define NUM_INTERFACE 6
  684. #define CDC_IAD_DESCRIPTOR 1
  685. #define CDC_STATUS_INTERFACE 0
  686. #define CDC_DATA_INTERFACE 1 // Serial
  687. #define CDC_ACM_ENDPOINT 1
  688. #define CDC_RX_ENDPOINT 2
  689. #define CDC_TX_ENDPOINT 3
  690. #define CDC_ACM_SIZE 16
  691. #define CDC_RX_SIZE 64
  692. #define CDC_TX_SIZE 64
  693. #define MIDI_INTERFACE 2 // MIDI
  694. #define MIDI_NUM_CABLES 16
  695. #define MIDI_TX_ENDPOINT 4
  696. #define MIDI_TX_SIZE 64
  697. #define MIDI_RX_ENDPOINT 5
  698. #define MIDI_RX_SIZE 64
  699. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  700. #define AUDIO_TX_ENDPOINT 6
  701. #define AUDIO_TX_SIZE 180
  702. #define AUDIO_RX_ENDPOINT 7
  703. #define AUDIO_RX_SIZE 180
  704. #define AUDIO_SYNC_ENDPOINT 8
  705. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  706. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  707. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  708. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  709. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  710. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  711. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  712. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  713. #elif defined(USB_EVERYTHING)
  714. #define VENDOR_ID 0x16C0
  715. #define PRODUCT_ID 0x0476
  716. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  717. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  718. #define DEVICE_CLASS 0xEF
  719. #define DEVICE_SUBCLASS 0x02
  720. #define DEVICE_PROTOCOL 0x01
  721. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  722. #define MANUFACTURER_NAME_LEN 11
  723. #define PRODUCT_NAME {'A','l','l',' ','T','h','e',' ','T','h','i','n','g','s'}
  724. #define PRODUCT_NAME_LEN 14
  725. #define EP0_SIZE 64
  726. #define NUM_ENDPOINTS 15
  727. #define NUM_INTERFACE 13
  728. #define CDC_IAD_DESCRIPTOR 1
  729. #define CDC_STATUS_INTERFACE 0
  730. #define CDC_DATA_INTERFACE 1 // Serial
  731. #define CDC_ACM_ENDPOINT 1
  732. #define CDC_RX_ENDPOINT 2
  733. #define CDC_TX_ENDPOINT 2
  734. #define CDC_ACM_SIZE 16
  735. #define CDC_RX_SIZE 64
  736. #define CDC_TX_SIZE 64
  737. #define MIDI_INTERFACE 2 // MIDI
  738. #define MIDI_NUM_CABLES 16
  739. #define MIDI_TX_ENDPOINT 3
  740. #define MIDI_TX_SIZE 64
  741. #define MIDI_RX_ENDPOINT 3
  742. #define MIDI_RX_SIZE 64
  743. #define KEYBOARD_INTERFACE 3 // Keyboard
  744. #define KEYBOARD_ENDPOINT 4
  745. #define KEYBOARD_SIZE 8
  746. #define KEYBOARD_INTERVAL 1
  747. #define MOUSE_INTERFACE 4 // Mouse
  748. #define MOUSE_ENDPOINT 5
  749. #define MOUSE_SIZE 8
  750. #define MOUSE_INTERVAL 2
  751. #define RAWHID_INTERFACE 5 // RawHID
  752. #define RAWHID_TX_ENDPOINT 6
  753. #define RAWHID_TX_SIZE 64
  754. #define RAWHID_TX_INTERVAL 1
  755. #define RAWHID_RX_ENDPOINT 6
  756. #define RAWHID_RX_SIZE 64
  757. #define RAWHID_RX_INTERVAL 1
  758. #define FLIGHTSIM_INTERFACE 6 // Flight Sim Control
  759. #define FLIGHTSIM_TX_ENDPOINT 9
  760. #define FLIGHTSIM_TX_SIZE 64
  761. #define FLIGHTSIM_TX_INTERVAL 1
  762. #define FLIGHTSIM_RX_ENDPOINT 9
  763. #define FLIGHTSIM_RX_SIZE 64
  764. #define FLIGHTSIM_RX_INTERVAL 1
  765. #define JOYSTICK_INTERFACE 7 // Joystick
  766. #define JOYSTICK_ENDPOINT 10
  767. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  768. #define JOYSTICK_INTERVAL 1
  769. /*
  770. #define MTP_INTERFACE 8 // MTP Disk
  771. #define MTP_TX_ENDPOINT 11
  772. #define MTP_TX_SIZE 64
  773. #define MTP_RX_ENDPOINT 3
  774. #define MTP_RX_SIZE 64
  775. #define MTP_EVENT_ENDPOINT 11
  776. #define MTP_EVENT_SIZE 16
  777. #define MTP_EVENT_INTERVAL 10
  778. */
  779. #define KEYMEDIA_INTERFACE 8 // Keyboard Media Keys
  780. #define KEYMEDIA_ENDPOINT 12
  781. #define KEYMEDIA_SIZE 8
  782. #define KEYMEDIA_INTERVAL 4
  783. #define AUDIO_INTERFACE 9 // Audio (uses 3 consecutive interfaces)
  784. #define AUDIO_TX_ENDPOINT 13
  785. #define AUDIO_TX_SIZE 180
  786. #define AUDIO_RX_ENDPOINT 13
  787. #define AUDIO_RX_SIZE 180
  788. #define AUDIO_SYNC_ENDPOINT 14
  789. #define MULTITOUCH_INTERFACE 12 // Touchscreen
  790. #define MULTITOUCH_ENDPOINT 15
  791. #define MULTITOUCH_SIZE 8
  792. #define MULTITOUCH_FINGERS 10
  793. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  794. #define ENDPOINT2_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  795. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  796. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  797. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  798. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  799. #define ENDPOINT7_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  800. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ONLY
  801. #define ENDPOINT9_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  802. #define ENDPOINT10_CONFIG ENDPOINT_TRANSMIT_ONLY
  803. #define ENDPOINT11_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  804. #define ENDPOINT12_CONFIG ENDPOINT_TRANSMIT_ONLY
  805. #define ENDPOINT13_CONFIG (ENDPOINT_RECEIVE_ISOCHRONOUS|ENDPOINT_TRANSMIT_ISOCHRONOUS)
  806. #define ENDPOINT14_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  807. #define ENDPOINT15_CONFIG ENDPOINT_TRANSMIT_ONLY
  808. #endif
  809. #ifdef USB_DESC_LIST_DEFINE
  810. #if defined(NUM_ENDPOINTS) && NUM_ENDPOINTS > 0
  811. // NUM_ENDPOINTS = number of non-zero endpoints (0 to 7)
  812. extern const uint32_t usb_endpoint_config_table[NUM_ENDPOINTS];
  813. typedef struct {
  814. uint16_t wValue;
  815. uint16_t wIndex;
  816. const uint8_t *addr;
  817. uint16_t length;
  818. } usb_descriptor_list_t;
  819. extern const usb_descriptor_list_t usb_descriptor_list[];
  820. #endif // NUM_ENDPOINTS
  821. #endif // USB_DESC_LIST_DEFINE