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.

861 lines
34KB

  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 1
  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_RX_ENDPOINT 4
  623. #define AUDIO_RX_SIZE 180
  624. #define AUDIO_SYNC_ENDPOINT 5
  625. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  626. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  627. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  628. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  629. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  630. #elif defined(USB_MIDI_AUDIO_SERIAL)
  631. #define VENDOR_ID 0x16C0
  632. #define PRODUCT_ID 0x048A
  633. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  634. #define MANUFACTURER_NAME_LEN 11
  635. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','/','A','u','d','i','o'}
  636. #define PRODUCT_NAME_LEN 17
  637. #define EP0_SIZE 64
  638. #define NUM_ENDPOINTS 8
  639. #define NUM_INTERFACE 6
  640. #define CDC_IAD_DESCRIPTOR 1
  641. #define CDC_STATUS_INTERFACE 0
  642. #define CDC_DATA_INTERFACE 1 // Serial
  643. #define CDC_ACM_ENDPOINT 1
  644. #define CDC_RX_ENDPOINT 2
  645. #define CDC_TX_ENDPOINT 3
  646. #define CDC_ACM_SIZE 16
  647. #define CDC_RX_SIZE 64
  648. #define CDC_TX_SIZE 64
  649. #define MIDI_INTERFACE 2 // MIDI
  650. #define MIDI_NUM_CABLES 1
  651. #define MIDI_TX_ENDPOINT 4
  652. #define MIDI_TX_SIZE 64
  653. #define MIDI_RX_ENDPOINT 5
  654. #define MIDI_RX_SIZE 64
  655. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  656. #define AUDIO_TX_ENDPOINT 6
  657. #define AUDIO_TX_SIZE 180
  658. #define AUDIO_RX_ENDPOINT 7
  659. #define AUDIO_RX_SIZE 180
  660. #define AUDIO_SYNC_ENDPOINT 8
  661. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  662. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  663. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  664. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  665. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  666. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  667. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  668. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  669. #elif defined(USB_MIDI16_AUDIO_SERIAL)
  670. #define VENDOR_ID 0x16C0
  671. #define PRODUCT_ID 0x048A
  672. #define BCD_DEVICE 0x0212
  673. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  674. #define MANUFACTURER_NAME_LEN 11
  675. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6','/','A','u','d','i','o'}
  676. #define PRODUCT_NAME_LEN 20
  677. #define EP0_SIZE 64
  678. #define NUM_ENDPOINTS 8
  679. #define NUM_INTERFACE 6
  680. #define CDC_IAD_DESCRIPTOR 1
  681. #define CDC_STATUS_INTERFACE 0
  682. #define CDC_DATA_INTERFACE 1 // Serial
  683. #define CDC_ACM_ENDPOINT 1
  684. #define CDC_RX_ENDPOINT 2
  685. #define CDC_TX_ENDPOINT 3
  686. #define CDC_ACM_SIZE 16
  687. #define CDC_RX_SIZE 64
  688. #define CDC_TX_SIZE 64
  689. #define MIDI_INTERFACE 2 // MIDI
  690. #define MIDI_NUM_CABLES 16
  691. #define MIDI_TX_ENDPOINT 4
  692. #define MIDI_TX_SIZE 64
  693. #define MIDI_RX_ENDPOINT 5
  694. #define MIDI_RX_SIZE 64
  695. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  696. #define AUDIO_TX_ENDPOINT 6
  697. #define AUDIO_TX_SIZE 180
  698. #define AUDIO_RX_ENDPOINT 7
  699. #define AUDIO_RX_SIZE 180
  700. #define AUDIO_SYNC_ENDPOINT 8
  701. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  702. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  703. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  704. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  705. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  706. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  707. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  708. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  709. #elif defined(USB_EVERYTHING)
  710. #define VENDOR_ID 0x16C0
  711. #define PRODUCT_ID 0x0476
  712. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  713. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  714. #define DEVICE_CLASS 0xEF
  715. #define DEVICE_SUBCLASS 0x02
  716. #define DEVICE_PROTOCOL 0x01
  717. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  718. #define MANUFACTURER_NAME_LEN 11
  719. #define PRODUCT_NAME {'A','l','l',' ','T','h','e',' ','T','h','i','n','g','s'}
  720. #define PRODUCT_NAME_LEN 14
  721. #define EP0_SIZE 64
  722. #define NUM_ENDPOINTS 15
  723. #define NUM_INTERFACE 13
  724. #define CDC_IAD_DESCRIPTOR 1
  725. #define CDC_STATUS_INTERFACE 0
  726. #define CDC_DATA_INTERFACE 1 // Serial
  727. #define CDC_ACM_ENDPOINT 1
  728. #define CDC_RX_ENDPOINT 2
  729. #define CDC_TX_ENDPOINT 2
  730. #define CDC_ACM_SIZE 16
  731. #define CDC_RX_SIZE 64
  732. #define CDC_TX_SIZE 64
  733. #define MIDI_INTERFACE 2 // MIDI
  734. #define MIDI_NUM_CABLES 16
  735. #define MIDI_TX_ENDPOINT 3
  736. #define MIDI_TX_SIZE 64
  737. #define MIDI_RX_ENDPOINT 3
  738. #define MIDI_RX_SIZE 64
  739. #define KEYBOARD_INTERFACE 3 // Keyboard
  740. #define KEYBOARD_ENDPOINT 4
  741. #define KEYBOARD_SIZE 8
  742. #define KEYBOARD_INTERVAL 1
  743. #define MOUSE_INTERFACE 4 // Mouse
  744. #define MOUSE_ENDPOINT 5
  745. #define MOUSE_SIZE 8
  746. #define MOUSE_INTERVAL 2
  747. #define RAWHID_INTERFACE 5 // RawHID
  748. #define RAWHID_TX_ENDPOINT 6
  749. #define RAWHID_TX_SIZE 64
  750. #define RAWHID_TX_INTERVAL 1
  751. #define RAWHID_RX_ENDPOINT 6
  752. #define RAWHID_RX_SIZE 64
  753. #define RAWHID_RX_INTERVAL 1
  754. #define FLIGHTSIM_INTERFACE 6 // Flight Sim Control
  755. #define FLIGHTSIM_TX_ENDPOINT 9
  756. #define FLIGHTSIM_TX_SIZE 64
  757. #define FLIGHTSIM_TX_INTERVAL 1
  758. #define FLIGHTSIM_RX_ENDPOINT 9
  759. #define FLIGHTSIM_RX_SIZE 64
  760. #define FLIGHTSIM_RX_INTERVAL 1
  761. #define JOYSTICK_INTERFACE 7 // Joystick
  762. #define JOYSTICK_ENDPOINT 10
  763. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  764. #define JOYSTICK_INTERVAL 1
  765. /*
  766. #define MTP_INTERFACE 8 // MTP Disk
  767. #define MTP_TX_ENDPOINT 11
  768. #define MTP_TX_SIZE 64
  769. #define MTP_RX_ENDPOINT 3
  770. #define MTP_RX_SIZE 64
  771. #define MTP_EVENT_ENDPOINT 11
  772. #define MTP_EVENT_SIZE 16
  773. #define MTP_EVENT_INTERVAL 10
  774. */
  775. #define KEYMEDIA_INTERFACE 8 // Keyboard Media Keys
  776. #define KEYMEDIA_ENDPOINT 12
  777. #define KEYMEDIA_SIZE 8
  778. #define KEYMEDIA_INTERVAL 4
  779. #define AUDIO_INTERFACE 9 // Audio (uses 3 consecutive interfaces)
  780. #define AUDIO_TX_ENDPOINT 13
  781. #define AUDIO_TX_SIZE 180
  782. #define AUDIO_RX_ENDPOINT 13
  783. #define AUDIO_RX_SIZE 180
  784. #define AUDIO_SYNC_ENDPOINT 14
  785. #define MULTITOUCH_INTERFACE 12 // Touchscreen
  786. #define MULTITOUCH_ENDPOINT 15
  787. #define MULTITOUCH_SIZE 8
  788. #define MULTITOUCH_FINGERS 10
  789. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  790. #define ENDPOINT2_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  791. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  792. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  793. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  794. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  795. #define ENDPOINT7_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  796. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ONLY
  797. #define ENDPOINT9_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  798. #define ENDPOINT10_CONFIG ENDPOINT_TRANSMIT_ONLY
  799. #define ENDPOINT11_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  800. #define ENDPOINT12_CONFIG ENDPOINT_TRANSMIT_ONLY
  801. #define ENDPOINT13_CONFIG (ENDPOINT_RECEIVE_ISOCHRONOUS|ENDPOINT_TRANSMIT_ISOCHRONOUS)
  802. #define ENDPOINT14_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  803. #define ENDPOINT15_CONFIG ENDPOINT_TRANSMIT_ONLY
  804. #endif
  805. #ifdef USB_DESC_LIST_DEFINE
  806. #if defined(NUM_ENDPOINTS) && NUM_ENDPOINTS > 0
  807. // NUM_ENDPOINTS = number of non-zero endpoints (0 to 7)
  808. extern const uint32_t usb_endpoint_config_table[NUM_ENDPOINTS];
  809. typedef struct {
  810. uint16_t wValue;
  811. uint16_t wIndex;
  812. const uint8_t *addr;
  813. uint16_t length;
  814. } usb_descriptor_list_t;
  815. extern const usb_descriptor_list_t usb_descriptor_list[];
  816. #endif // NUM_ENDPOINTS
  817. #endif // USB_DESC_LIST_DEFINE