您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

933 行
38KB

  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 MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  99. #define MANUFACTURER_NAME_LEN 11
  100. #define PRODUCT_NAME {'U','S','B',' ','S','e','r','i','a','l'}
  101. #define PRODUCT_NAME_LEN 10
  102. #define EP0_SIZE 64
  103. #define NUM_ENDPOINTS 4
  104. #define NUM_USB_BUFFERS 12
  105. #define NUM_INTERFACE 2
  106. #define CDC_IAD_DESCRIPTOR 1 // Serial
  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 EXPERIMENTAL_INTERFACE 2
  118. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  119. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_UNUSED
  120. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_BULK
  121. #elif defined(USB_DUAL_SERIAL)
  122. #define VENDOR_ID 0x16C0
  123. #define PRODUCT_ID 0x048B
  124. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  125. #define MANUFACTURER_NAME_LEN 11
  126. #define PRODUCT_NAME {'D','u','a','l',' ','S','e','r','i','a','l'}
  127. #define PRODUCT_NAME_LEN 11
  128. #define EP0_SIZE 64
  129. #define NUM_ENDPOINTS 5
  130. #define NUM_INTERFACE 4
  131. #define CDC_IAD_DESCRIPTOR 1 // Serial
  132. #define CDC_STATUS_INTERFACE 0
  133. #define CDC_DATA_INTERFACE 1
  134. #define CDC_ACM_ENDPOINT 2
  135. #define CDC_RX_ENDPOINT 3
  136. #define CDC_TX_ENDPOINT 3
  137. #define CDC_ACM_SIZE 16
  138. #define CDC_RX_SIZE_480 512
  139. #define CDC_TX_SIZE_480 512
  140. #define CDC_RX_SIZE_12 64
  141. #define CDC_TX_SIZE_12 64
  142. #define CDC2_STATUS_INTERFACE 2 // SerialUSB1
  143. #define CDC2_DATA_INTERFACE 3
  144. #define CDC2_ACM_ENDPOINT 4
  145. #define CDC2_RX_ENDPOINT 5
  146. #define CDC2_TX_ENDPOINT 5
  147. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  148. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  149. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  150. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  151. #elif defined(USB_TRIPLE_SERIAL)
  152. #define VENDOR_ID 0x16C0
  153. #define PRODUCT_ID 0x048C
  154. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  155. #define MANUFACTURER_NAME_LEN 11
  156. #define PRODUCT_NAME {'T','r','i','p','l','e',' ','S','e','r','i','a','l'}
  157. #define PRODUCT_NAME_LEN 13
  158. #define EP0_SIZE 64
  159. #define NUM_ENDPOINTS 7
  160. #define NUM_INTERFACE 6
  161. #define CDC_IAD_DESCRIPTOR 1 // Serial
  162. #define CDC_STATUS_INTERFACE 0
  163. #define CDC_DATA_INTERFACE 1
  164. #define CDC_ACM_ENDPOINT 2
  165. #define CDC_RX_ENDPOINT 3
  166. #define CDC_TX_ENDPOINT 3
  167. #define CDC_ACM_SIZE 16
  168. #define CDC_RX_SIZE_480 512
  169. #define CDC_TX_SIZE_480 512
  170. #define CDC_RX_SIZE_12 64
  171. #define CDC_TX_SIZE_12 64
  172. #define CDC2_STATUS_INTERFACE 2 // SerialUSB1
  173. #define CDC2_DATA_INTERFACE 3
  174. #define CDC2_ACM_ENDPOINT 4
  175. #define CDC2_RX_ENDPOINT 5
  176. #define CDC2_TX_ENDPOINT 5
  177. #define CDC3_STATUS_INTERFACE 4 // SerialUSB2
  178. #define CDC3_DATA_INTERFACE 5
  179. #define CDC3_ACM_ENDPOINT 6
  180. #define CDC3_RX_ENDPOINT 7
  181. #define CDC3_TX_ENDPOINT 7
  182. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  183. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  184. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  185. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  186. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  187. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  188. #elif defined(USB_KEYBOARDONLY)
  189. #define VENDOR_ID 0x16C0
  190. #define PRODUCT_ID 0x04D0
  191. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  192. #define MANUFACTURER_NAME_LEN 11
  193. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d'}
  194. #define PRODUCT_NAME_LEN 8
  195. #define EP0_SIZE 64
  196. #define NUM_ENDPOINTS 4
  197. #define NUM_USB_BUFFERS 14
  198. #define NUM_INTERFACE 3
  199. #define SEREMU_INTERFACE 1 // Serial emulation
  200. #define SEREMU_TX_ENDPOINT 2
  201. #define SEREMU_TX_SIZE 64
  202. #define SEREMU_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  203. #define SEREMU_RX_ENDPOINT 2
  204. #define SEREMU_RX_SIZE 32
  205. #define SEREMU_RX_INTERVAL 2 // TODO: is this ok for 480 Mbit speed
  206. #define KEYBOARD_INTERFACE 0 // Keyboard
  207. #define KEYBOARD_ENDPOINT 3
  208. #define KEYBOARD_SIZE 8
  209. #define KEYBOARD_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  210. #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
  211. #define KEYMEDIA_ENDPOINT 4
  212. #define KEYMEDIA_SIZE 8
  213. #define KEYMEDIA_INTERVAL 4 // TODO: is this ok for 480 Mbit speed
  214. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  215. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  216. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  217. #elif defined(USB_HID)
  218. #define VENDOR_ID 0x16C0
  219. #define PRODUCT_ID 0x0482
  220. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  221. #define MANUFACTURER_NAME_LEN 11
  222. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
  223. #define PRODUCT_NAME_LEN 23
  224. #define EP0_SIZE 64
  225. #define NUM_ENDPOINTS 6
  226. #define NUM_USB_BUFFERS 24
  227. #define NUM_INTERFACE 5
  228. #define SEREMU_INTERFACE 2 // Serial emulation
  229. #define SEREMU_TX_ENDPOINT 2
  230. #define SEREMU_TX_SIZE 64
  231. #define SEREMU_TX_INTERVAL 1
  232. #define SEREMU_RX_ENDPOINT 2
  233. #define SEREMU_RX_SIZE 32
  234. #define SEREMU_RX_INTERVAL 2
  235. #define KEYBOARD_INTERFACE 0 // Keyboard
  236. #define KEYBOARD_ENDPOINT 3
  237. #define KEYBOARD_SIZE 8
  238. #define KEYBOARD_INTERVAL 1
  239. #define KEYMEDIA_INTERFACE 4 // Keyboard Media Keys
  240. #define KEYMEDIA_ENDPOINT 4
  241. #define KEYMEDIA_SIZE 8
  242. #define KEYMEDIA_INTERVAL 4
  243. #define MOUSE_INTERFACE 1 // Mouse
  244. #define MOUSE_ENDPOINT 5
  245. #define MOUSE_SIZE 8
  246. #define MOUSE_INTERVAL 1
  247. #define JOYSTICK_INTERFACE 3 // Joystick
  248. #define JOYSTICK_ENDPOINT 6
  249. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  250. #define JOYSTICK_INTERVAL 2
  251. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  252. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  253. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  254. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  255. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  256. #elif defined(USB_SERIAL_HID)
  257. #define VENDOR_ID 0x16C0
  258. #define PRODUCT_ID 0x0487
  259. #define DEVICE_CLASS 0xEF
  260. #define DEVICE_SUBCLASS 0x02
  261. #define DEVICE_PROTOCOL 0x01
  262. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  263. #define MANUFACTURER_NAME_LEN 11
  264. #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'}
  265. #define PRODUCT_NAME_LEN 30
  266. #define EP0_SIZE 64
  267. #define NUM_ENDPOINTS 7
  268. #define NUM_INTERFACE 6
  269. #define CDC_IAD_DESCRIPTOR 1
  270. #define CDC_STATUS_INTERFACE 0
  271. #define CDC_DATA_INTERFACE 1 // Serial
  272. #define CDC_ACM_ENDPOINT 2
  273. #define CDC_RX_ENDPOINT 3
  274. #define CDC_TX_ENDPOINT 3
  275. #define CDC_ACM_SIZE 16
  276. #define CDC_RX_SIZE_480 512
  277. #define CDC_TX_SIZE_480 512
  278. #define CDC_RX_SIZE_12 64
  279. #define CDC_TX_SIZE_12 64
  280. #define KEYBOARD_INTERFACE 2 // Keyboard
  281. #define KEYBOARD_ENDPOINT 4
  282. #define KEYBOARD_SIZE 8
  283. #define KEYBOARD_INTERVAL 1
  284. #define KEYMEDIA_INTERFACE 5 // Keyboard Media Keys
  285. #define KEYMEDIA_ENDPOINT 5
  286. #define KEYMEDIA_SIZE 8
  287. #define KEYMEDIA_INTERVAL 4
  288. #define MOUSE_INTERFACE 3 // Mouse
  289. #define MOUSE_ENDPOINT 6
  290. #define MOUSE_SIZE 8
  291. #define MOUSE_INTERVAL 2
  292. #define JOYSTICK_INTERFACE 4 // Joystick
  293. #define JOYSTICK_ENDPOINT 7
  294. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  295. #define JOYSTICK_INTERVAL 1
  296. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  297. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  298. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  299. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  300. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  301. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  302. #elif defined(USB_TOUCHSCREEN)
  303. #define VENDOR_ID 0x16C0
  304. #define PRODUCT_ID 0x04D3
  305. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  306. #define MANUFACTURER_NAME_LEN 11
  307. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','T','o','u','c','h','s','c','r','e','e','n'}
  308. #define PRODUCT_NAME_LEN 20
  309. #define EP0_SIZE 64
  310. #define NUM_ENDPOINTS 5
  311. #define NUM_INTERFACE 4
  312. #define SEREMU_INTERFACE 1 // Serial emulation
  313. #define SEREMU_TX_ENDPOINT 2
  314. #define SEREMU_TX_SIZE 64
  315. #define SEREMU_TX_INTERVAL 1
  316. #define SEREMU_RX_ENDPOINT 2
  317. #define SEREMU_RX_SIZE 32
  318. #define SEREMU_RX_INTERVAL 2
  319. #define KEYBOARD_INTERFACE 0 // Keyboard
  320. #define KEYBOARD_ENDPOINT 3
  321. #define KEYBOARD_SIZE 8
  322. #define KEYBOARD_INTERVAL 1
  323. #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
  324. #define KEYMEDIA_ENDPOINT 4
  325. #define KEYMEDIA_SIZE 8
  326. #define KEYMEDIA_INTERVAL 4
  327. #define MULTITOUCH_INTERFACE 3 // Touchscreen
  328. #define MULTITOUCH_ENDPOINT 5
  329. #define MULTITOUCH_SIZE 9
  330. #define MULTITOUCH_FINGERS 10
  331. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  332. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  333. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  334. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  335. #elif defined(USB_HID_TOUCHSCREEN)
  336. #define VENDOR_ID 0x16C0
  337. #define PRODUCT_ID 0x04D4
  338. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  339. #define MANUFACTURER_NAME_LEN 11
  340. #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'}
  341. #define PRODUCT_NAME_LEN 26
  342. #define EP0_SIZE 64
  343. #define NUM_ENDPOINTS 6
  344. #define NUM_INTERFACE 5
  345. #define SEREMU_INTERFACE 2 // Serial emulation
  346. #define SEREMU_TX_ENDPOINT 2
  347. #define SEREMU_TX_SIZE 64
  348. #define SEREMU_TX_INTERVAL 1
  349. #define SEREMU_RX_ENDPOINT 2
  350. #define SEREMU_RX_SIZE 32
  351. #define SEREMU_RX_INTERVAL 2
  352. #define KEYBOARD_INTERFACE 0 // Keyboard
  353. #define KEYBOARD_ENDPOINT 3
  354. #define KEYBOARD_SIZE 8
  355. #define KEYBOARD_INTERVAL 1
  356. #define KEYMEDIA_INTERFACE 3 // Keyboard Media Keys
  357. #define KEYMEDIA_ENDPOINT 4
  358. #define KEYMEDIA_SIZE 8
  359. #define KEYMEDIA_INTERVAL 4
  360. #define MOUSE_INTERFACE 1 // Mouse
  361. #define MOUSE_ENDPOINT 6
  362. #define MOUSE_SIZE 8
  363. #define MOUSE_INTERVAL 2
  364. #define MULTITOUCH_INTERFACE 4 // Touchscreen
  365. #define MULTITOUCH_ENDPOINT 5
  366. #define MULTITOUCH_SIZE 9
  367. #define MULTITOUCH_FINGERS 10
  368. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  369. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  370. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  371. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  372. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  373. #elif defined(USB_MIDI)
  374. #define VENDOR_ID 0x16C0
  375. #define PRODUCT_ID 0x0485
  376. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  377. #define MANUFACTURER_NAME_LEN 11
  378. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  379. #define PRODUCT_NAME_LEN 11
  380. #define EP0_SIZE 64
  381. #define NUM_ENDPOINTS 4
  382. #define NUM_INTERFACE 2
  383. #define SEREMU_INTERFACE 1 // Serial emulation
  384. #define SEREMU_TX_ENDPOINT 2
  385. #define SEREMU_TX_SIZE 64
  386. #define SEREMU_TX_INTERVAL 1
  387. #define SEREMU_RX_ENDPOINT 2
  388. #define SEREMU_RX_SIZE 32
  389. #define SEREMU_RX_INTERVAL 2
  390. #define MIDI_INTERFACE 0 // MIDI
  391. #define MIDI_NUM_CABLES 1
  392. #define MIDI_TX_ENDPOINT 3
  393. #define MIDI_TX_SIZE_12 64
  394. #define MIDI_TX_SIZE_480 512
  395. #define MIDI_RX_ENDPOINT 3
  396. #define MIDI_RX_SIZE_12 64
  397. #define MIDI_RX_SIZE_480 512
  398. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  399. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  400. #elif defined(USB_MIDI4)
  401. #define VENDOR_ID 0x16C0
  402. #define PRODUCT_ID 0x0485
  403. #define BCD_DEVICE 0x0211
  404. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  405. #define MANUFACTURER_NAME_LEN 11
  406. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','4'}
  407. #define PRODUCT_NAME_LEN 13
  408. #define EP0_SIZE 64
  409. #define NUM_ENDPOINTS 3
  410. #define NUM_INTERFACE 2
  411. #define SEREMU_INTERFACE 1 // Serial emulation
  412. #define SEREMU_TX_ENDPOINT 2
  413. #define SEREMU_TX_SIZE 64
  414. #define SEREMU_TX_INTERVAL 1
  415. #define SEREMU_RX_ENDPOINT 2
  416. #define SEREMU_RX_SIZE 32
  417. #define SEREMU_RX_INTERVAL 2
  418. #define MIDI_INTERFACE 0 // MIDI
  419. #define MIDI_NUM_CABLES 4
  420. #define MIDI_TX_ENDPOINT 3
  421. #define MIDI_TX_SIZE_12 64
  422. #define MIDI_TX_SIZE_480 512
  423. #define MIDI_RX_ENDPOINT 3
  424. #define MIDI_RX_SIZE_12 64
  425. #define MIDI_RX_SIZE_480 512
  426. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  427. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  428. #elif defined(USB_MIDI16)
  429. #define VENDOR_ID 0x16C0
  430. #define PRODUCT_ID 0x0485
  431. #define BCD_DEVICE 0x0212
  432. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  433. #define MANUFACTURER_NAME_LEN 11
  434. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6'}
  435. #define PRODUCT_NAME_LEN 14
  436. #define EP0_SIZE 64
  437. #define NUM_ENDPOINTS 3
  438. #define NUM_INTERFACE 2
  439. #define SEREMU_INTERFACE 1 // Serial emulation
  440. #define SEREMU_TX_ENDPOINT 2
  441. #define SEREMU_TX_SIZE 64
  442. #define SEREMU_TX_INTERVAL 1
  443. #define SEREMU_RX_ENDPOINT 2
  444. #define SEREMU_RX_SIZE 32
  445. #define SEREMU_RX_INTERVAL 2
  446. #define MIDI_INTERFACE 0 // MIDI
  447. #define MIDI_NUM_CABLES 16
  448. #define MIDI_TX_ENDPOINT 3
  449. #define MIDI_TX_SIZE_12 64
  450. #define MIDI_TX_SIZE_480 512
  451. #define MIDI_RX_ENDPOINT 3
  452. #define MIDI_RX_SIZE_12 64
  453. #define MIDI_RX_SIZE_480 512
  454. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  455. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  456. #elif defined(USB_MIDI_SERIAL)
  457. #define VENDOR_ID 0x16C0
  458. #define PRODUCT_ID 0x0489
  459. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  460. #define MANUFACTURER_NAME_LEN 11
  461. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  462. #define PRODUCT_NAME_LEN 11
  463. #define EP0_SIZE 64
  464. #define NUM_ENDPOINTS 4
  465. #define NUM_INTERFACE 3
  466. #define CDC_IAD_DESCRIPTOR 1
  467. #define CDC_STATUS_INTERFACE 0
  468. #define CDC_DATA_INTERFACE 1 // Serial
  469. #define CDC_ACM_ENDPOINT 2
  470. #define CDC_RX_ENDPOINT 3
  471. #define CDC_TX_ENDPOINT 3
  472. #define CDC_ACM_SIZE 16
  473. #define CDC_RX_SIZE_480 512
  474. #define CDC_TX_SIZE_480 512
  475. #define CDC_RX_SIZE_12 64
  476. #define CDC_TX_SIZE_12 64
  477. #define MIDI_INTERFACE 2 // MIDI
  478. #define MIDI_NUM_CABLES 1
  479. #define MIDI_TX_ENDPOINT 4
  480. #define MIDI_TX_SIZE_12 64
  481. #define MIDI_TX_SIZE_480 512
  482. #define MIDI_RX_ENDPOINT 4
  483. #define MIDI_RX_SIZE_12 64
  484. #define MIDI_RX_SIZE_480 512
  485. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  486. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  487. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  488. #elif defined(USB_MIDI4_SERIAL)
  489. #define VENDOR_ID 0x16C0
  490. #define PRODUCT_ID 0x0489
  491. #define BCD_DEVICE 0x0211
  492. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  493. #define MANUFACTURER_NAME_LEN 11
  494. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','4'}
  495. #define PRODUCT_NAME_LEN 13
  496. #define EP0_SIZE 64
  497. #define NUM_ENDPOINTS 4
  498. #define NUM_INTERFACE 3
  499. #define CDC_IAD_DESCRIPTOR 1
  500. #define CDC_STATUS_INTERFACE 0
  501. #define CDC_DATA_INTERFACE 1 // Serial
  502. #define CDC_ACM_ENDPOINT 2
  503. #define CDC_RX_ENDPOINT 3
  504. #define CDC_TX_ENDPOINT 3
  505. #define CDC_ACM_SIZE 16
  506. #define CDC_RX_SIZE_480 512
  507. #define CDC_TX_SIZE_480 512
  508. #define CDC_RX_SIZE_12 64
  509. #define CDC_TX_SIZE_12 64
  510. #define MIDI_INTERFACE 2 // MIDI
  511. #define MIDI_NUM_CABLES 4
  512. #define MIDI_TX_ENDPOINT 4
  513. #define MIDI_TX_SIZE_12 64
  514. #define MIDI_TX_SIZE_480 512
  515. #define MIDI_RX_ENDPOINT 4
  516. #define MIDI_RX_SIZE_12 64
  517. #define MIDI_RX_SIZE_480 512
  518. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  519. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  520. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  521. #elif defined(USB_MIDI16_SERIAL)
  522. #define VENDOR_ID 0x16C0
  523. #define PRODUCT_ID 0x0489
  524. #define BCD_DEVICE 0x0212
  525. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  526. #define MANUFACTURER_NAME_LEN 11
  527. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6'}
  528. #define PRODUCT_NAME_LEN 14
  529. #define EP0_SIZE 64
  530. #define NUM_ENDPOINTS 4
  531. #define NUM_INTERFACE 3
  532. #define CDC_IAD_DESCRIPTOR 1
  533. #define CDC_STATUS_INTERFACE 0
  534. #define CDC_DATA_INTERFACE 1 // Serial
  535. #define CDC_ACM_ENDPOINT 2
  536. #define CDC_RX_ENDPOINT 3
  537. #define CDC_TX_ENDPOINT 3
  538. #define CDC_ACM_SIZE 16
  539. #define CDC_RX_SIZE_480 512
  540. #define CDC_TX_SIZE_480 512
  541. #define CDC_RX_SIZE_12 64
  542. #define CDC_TX_SIZE_12 64
  543. #define MIDI_INTERFACE 2 // MIDI
  544. #define MIDI_NUM_CABLES 16
  545. #define MIDI_TX_ENDPOINT 4
  546. #define MIDI_TX_SIZE_12 64
  547. #define MIDI_TX_SIZE_480 512
  548. #define MIDI_RX_ENDPOINT 4
  549. #define MIDI_RX_SIZE_12 64
  550. #define MIDI_RX_SIZE_480 512
  551. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  552. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  553. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  554. #elif defined(USB_RAWHID)
  555. #define VENDOR_ID 0x16C0
  556. #define PRODUCT_ID 0x0486
  557. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  558. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  559. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  560. #define MANUFACTURER_NAME_LEN 11
  561. #define PRODUCT_NAME {'T','e','e','n','s','y','d','u','i','n','o',' ','R','a','w','H','I','D'}
  562. #define PRODUCT_NAME_LEN 18
  563. #define EP0_SIZE 64
  564. #define NUM_ENDPOINTS 4
  565. #define NUM_INTERFACE 2
  566. #define RAWHID_INTERFACE 0 // RawHID
  567. #define RAWHID_TX_ENDPOINT 3
  568. #define RAWHID_TX_SIZE 64
  569. #define RAWHID_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  570. #define RAWHID_RX_ENDPOINT 4
  571. #define RAWHID_RX_SIZE 64
  572. #define RAWHID_RX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  573. #define SEREMU_INTERFACE 1 // Serial emulation
  574. #define SEREMU_TX_ENDPOINT 2
  575. #define SEREMU_TX_SIZE 64
  576. #define SEREMU_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  577. #define SEREMU_RX_ENDPOINT 2
  578. #define SEREMU_RX_SIZE 32
  579. #define SEREMU_RX_INTERVAL 2 // TODO: is this ok for 480 Mbit speed
  580. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  581. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  582. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_UNUSED
  583. #elif defined(USB_FLIGHTSIM)
  584. #define VENDOR_ID 0x16C0
  585. #define PRODUCT_ID 0x0488
  586. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  587. #define MANUFACTURER_NAME_LEN 11
  588. #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'}
  589. #define PRODUCT_NAME_LEN 26
  590. #define EP0_SIZE 64
  591. #define NUM_ENDPOINTS 3
  592. #define NUM_INTERFACE 2
  593. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  594. #define FLIGHTSIM_TX_ENDPOINT 3
  595. #define FLIGHTSIM_TX_SIZE 64
  596. #define FLIGHTSIM_TX_INTERVAL 1
  597. #define FLIGHTSIM_RX_ENDPOINT 3
  598. #define FLIGHTSIM_RX_SIZE 64
  599. #define FLIGHTSIM_RX_INTERVAL 1
  600. #define SEREMU_INTERFACE 1 // Serial emulation
  601. #define SEREMU_TX_ENDPOINT 2
  602. #define SEREMU_TX_SIZE 64
  603. #define SEREMU_TX_INTERVAL 1
  604. #define SEREMU_RX_ENDPOINT 2
  605. #define SEREMU_RX_SIZE 32
  606. #define SEREMU_RX_INTERVAL 2
  607. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  608. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  609. #elif defined(USB_FLIGHTSIM_JOYSTICK)
  610. #define VENDOR_ID 0x16C0
  611. #define PRODUCT_ID 0x0488
  612. #define BCD_DEVICE 0x0211
  613. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  614. #define MANUFACTURER_NAME_LEN 11
  615. #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'}
  616. #define PRODUCT_NAME_LEN 26
  617. #define EP0_SIZE 64
  618. #define NUM_ENDPOINTS 4
  619. #define NUM_INTERFACE 3
  620. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  621. #define FLIGHTSIM_TX_ENDPOINT 3
  622. #define FLIGHTSIM_TX_SIZE 64
  623. #define FLIGHTSIM_TX_INTERVAL 1
  624. #define FLIGHTSIM_RX_ENDPOINT 3
  625. #define FLIGHTSIM_RX_SIZE 64
  626. #define FLIGHTSIM_RX_INTERVAL 1
  627. #define SEREMU_INTERFACE 1 // Serial emulation
  628. #define SEREMU_TX_ENDPOINT 2
  629. #define SEREMU_TX_SIZE 64
  630. #define SEREMU_TX_INTERVAL 1
  631. #define SEREMU_RX_ENDPOINT 2
  632. #define SEREMU_RX_SIZE 32
  633. #define SEREMU_RX_INTERVAL 2
  634. #define JOYSTICK_INTERFACE 2 // Joystick
  635. #define JOYSTICK_ENDPOINT 4
  636. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  637. #define JOYSTICK_INTERVAL 1
  638. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  639. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  640. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  641. #elif defined(USB_MTPDISK)
  642. #define VENDOR_ID 0x16C0
  643. #define PRODUCT_ID 0x04D1
  644. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  645. #define MANUFACTURER_NAME_LEN 11
  646. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','T','P',' ','D','i','s','k'}
  647. #define PRODUCT_NAME_LEN 15
  648. #define EP0_SIZE 64
  649. #define NUM_ENDPOINTS 4
  650. #define NUM_INTERFACE 2
  651. #define MTP_INTERFACE 0 // MTP Disk
  652. #define MTP_TX_ENDPOINT 3
  653. #define MTP_TX_SIZE_12 64
  654. #define MTP_TX_SIZE_480 512
  655. #define MTP_RX_ENDPOINT 3
  656. #define MTP_RX_SIZE_12 64
  657. #define MTP_RX_SIZE_480 512
  658. #define MTP_EVENT_ENDPOINT 4
  659. #define MTP_EVENT_SIZE 32
  660. #define MTP_EVENT_INTERVAL_12 10 // 10 = 10 ms
  661. #define MTP_EVENT_INTERVAL_480 7 // 7 = 8 ms
  662. #define SEREMU_INTERFACE 1 // Serial emulation
  663. #define SEREMU_TX_ENDPOINT 2
  664. #define SEREMU_TX_SIZE 64
  665. #define SEREMU_TX_INTERVAL 1
  666. #define SEREMU_RX_ENDPOINT 2
  667. #define SEREMU_RX_SIZE 32
  668. #define SEREMU_RX_INTERVAL 2
  669. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  670. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  671. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  672. #elif defined(USB_AUDIO)
  673. #define VENDOR_ID 0x16C0
  674. #define PRODUCT_ID 0x04D2
  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',' ','A','u','d','i','o'}
  678. #define PRODUCT_NAME_LEN 12
  679. #define EP0_SIZE 64
  680. #define NUM_ENDPOINTS 4
  681. #define NUM_INTERFACE 4
  682. #define SEREMU_INTERFACE 0 // Serial emulation
  683. #define SEREMU_TX_ENDPOINT 2
  684. #define SEREMU_TX_SIZE 64
  685. #define SEREMU_TX_INTERVAL 1
  686. #define SEREMU_RX_ENDPOINT 2
  687. #define SEREMU_RX_SIZE 32
  688. #define SEREMU_RX_INTERVAL 2
  689. #define AUDIO_INTERFACE 1 // Audio (uses 3 consecutive interfaces)
  690. #define AUDIO_TX_ENDPOINT 3
  691. #define AUDIO_TX_SIZE 180
  692. #define AUDIO_RX_ENDPOINT 3
  693. #define AUDIO_RX_SIZE 180
  694. #define AUDIO_SYNC_ENDPOINT 4
  695. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  696. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS
  697. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS
  698. #elif defined(USB_MIDI_AUDIO_SERIAL)
  699. #define VENDOR_ID 0x16C0
  700. #define PRODUCT_ID 0x048A
  701. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  702. #define MANUFACTURER_NAME_LEN 11
  703. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','/','A','u','d','i','o'}
  704. #define PRODUCT_NAME_LEN 17
  705. #define EP0_SIZE 64
  706. #define NUM_ENDPOINTS 6
  707. #define NUM_INTERFACE 6
  708. #define CDC_IAD_DESCRIPTOR 1
  709. #define CDC_STATUS_INTERFACE 0
  710. #define CDC_DATA_INTERFACE 1 // Serial
  711. #define CDC_ACM_ENDPOINT 2
  712. #define CDC_RX_ENDPOINT 3
  713. #define CDC_TX_ENDPOINT 3
  714. #define CDC_ACM_SIZE 16
  715. #define CDC_RX_SIZE_480 512
  716. #define CDC_TX_SIZE_480 512
  717. #define CDC_RX_SIZE_12 64
  718. #define CDC_TX_SIZE_12 64
  719. #define MIDI_INTERFACE 2 // MIDI
  720. #define MIDI_NUM_CABLES 1
  721. #define MIDI_TX_ENDPOINT 4
  722. #define MIDI_TX_SIZE_12 64
  723. #define MIDI_TX_SIZE_480 512
  724. #define MIDI_RX_ENDPOINT 4
  725. #define MIDI_RX_SIZE_12 64
  726. #define MIDI_RX_SIZE_480 512
  727. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  728. #define AUDIO_TX_ENDPOINT 5
  729. #define AUDIO_TX_SIZE 180
  730. #define AUDIO_RX_ENDPOINT 5
  731. #define AUDIO_RX_SIZE 180
  732. #define AUDIO_SYNC_ENDPOINT 6
  733. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  734. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  735. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  736. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS
  737. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS
  738. #elif defined(USB_MIDI16_AUDIO_SERIAL)
  739. #define VENDOR_ID 0x16C0
  740. #define PRODUCT_ID 0x048A
  741. #define BCD_DEVICE 0x0212
  742. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  743. #define MANUFACTURER_NAME_LEN 11
  744. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6','/','A','u','d','i','o'}
  745. #define PRODUCT_NAME_LEN 20
  746. #define EP0_SIZE 64
  747. #define NUM_ENDPOINTS 8
  748. #define NUM_INTERFACE 6
  749. #define CDC_IAD_DESCRIPTOR 1
  750. #define CDC_STATUS_INTERFACE 0
  751. #define CDC_DATA_INTERFACE 1 // Serial
  752. #define CDC_ACM_ENDPOINT 2
  753. #define CDC_RX_ENDPOINT 3
  754. #define CDC_TX_ENDPOINT 3
  755. #define CDC_ACM_SIZE 16
  756. #define CDC_RX_SIZE_480 512
  757. #define CDC_TX_SIZE_480 512
  758. #define CDC_RX_SIZE_12 64
  759. #define CDC_TX_SIZE_12 64
  760. #define MIDI_INTERFACE 2 // MIDI
  761. #define MIDI_NUM_CABLES 16
  762. #define MIDI_TX_ENDPOINT 4
  763. #define MIDI_TX_SIZE_12 64
  764. #define MIDI_TX_SIZE_480 512
  765. #define MIDI_RX_ENDPOINT 4
  766. #define MIDI_RX_SIZE_12 64
  767. #define MIDI_RX_SIZE_480 512
  768. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  769. #define AUDIO_TX_ENDPOINT 5
  770. #define AUDIO_TX_SIZE 180
  771. #define AUDIO_RX_ENDPOINT 5
  772. #define AUDIO_RX_SIZE 180
  773. #define AUDIO_SYNC_ENDPOINT 6
  774. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  775. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  776. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  777. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS
  778. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS
  779. #elif defined(USB_EVERYTHING)
  780. #define VENDOR_ID 0x16C0
  781. #define PRODUCT_ID 0x0476
  782. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  783. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  784. #define DEVICE_CLASS 0xEF
  785. #define DEVICE_SUBCLASS 0x02
  786. #define DEVICE_PROTOCOL 0x01
  787. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  788. #define MANUFACTURER_NAME_LEN 11
  789. #define PRODUCT_NAME {'A','l','l',' ','T','h','e',' ','T','h','i','n','g','s'}
  790. #define PRODUCT_NAME_LEN 14
  791. #define EP0_SIZE 64
  792. #define NUM_ENDPOINTS 15
  793. #define NUM_INTERFACE 13
  794. #define CDC_IAD_DESCRIPTOR 1
  795. #define CDC_STATUS_INTERFACE 0
  796. #define CDC_DATA_INTERFACE 1 // Serial
  797. #define CDC_ACM_ENDPOINT 1
  798. #define CDC_RX_ENDPOINT 2
  799. #define CDC_TX_ENDPOINT 2
  800. #define CDC_ACM_SIZE 16
  801. #define CDC_RX_SIZE 64
  802. #define CDC_TX_SIZE 64
  803. #define MIDI_INTERFACE 2 // MIDI
  804. #define MIDI_NUM_CABLES 16
  805. #define MIDI_TX_ENDPOINT 3
  806. #define MIDI_TX_SIZE 64
  807. #define MIDI_RX_ENDPOINT 3
  808. #define MIDI_RX_SIZE 64
  809. #define KEYBOARD_INTERFACE 3 // Keyboard
  810. #define KEYBOARD_ENDPOINT 4
  811. #define KEYBOARD_SIZE 8
  812. #define KEYBOARD_INTERVAL 1
  813. #define MOUSE_INTERFACE 4 // Mouse
  814. #define MOUSE_ENDPOINT 5
  815. #define MOUSE_SIZE 8
  816. #define MOUSE_INTERVAL 2
  817. #define RAWHID_INTERFACE 5 // RawHID
  818. #define RAWHID_TX_ENDPOINT 6
  819. #define RAWHID_TX_SIZE 64
  820. #define RAWHID_TX_INTERVAL 1
  821. #define RAWHID_RX_ENDPOINT 6
  822. #define RAWHID_RX_SIZE 64
  823. #define RAWHID_RX_INTERVAL 1
  824. #define FLIGHTSIM_INTERFACE 6 // Flight Sim Control
  825. #define FLIGHTSIM_TX_ENDPOINT 9
  826. #define FLIGHTSIM_TX_SIZE 64
  827. #define FLIGHTSIM_TX_INTERVAL 1
  828. #define FLIGHTSIM_RX_ENDPOINT 9
  829. #define FLIGHTSIM_RX_SIZE 64
  830. #define FLIGHTSIM_RX_INTERVAL 1
  831. #define JOYSTICK_INTERFACE 7 // Joystick
  832. #define JOYSTICK_ENDPOINT 10
  833. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  834. #define JOYSTICK_INTERVAL 1
  835. /*
  836. #define MTP_INTERFACE 8 // MTP Disk
  837. #define MTP_TX_ENDPOINT 11
  838. #define MTP_TX_SIZE 64
  839. #define MTP_RX_ENDPOINT 3
  840. #define MTP_RX_SIZE 64
  841. #define MTP_EVENT_ENDPOINT 11
  842. #define MTP_EVENT_SIZE 16
  843. #define MTP_EVENT_INTERVAL 10
  844. */
  845. #define KEYMEDIA_INTERFACE 8 // Keyboard Media Keys
  846. #define KEYMEDIA_ENDPOINT 12
  847. #define KEYMEDIA_SIZE 8
  848. #define KEYMEDIA_INTERVAL 4
  849. #define AUDIO_INTERFACE 9 // Audio (uses 3 consecutive interfaces)
  850. #define AUDIO_TX_ENDPOINT 13
  851. #define AUDIO_TX_SIZE 180
  852. #define AUDIO_RX_ENDPOINT 13
  853. #define AUDIO_RX_SIZE 180
  854. #define AUDIO_SYNC_ENDPOINT 14
  855. #define MULTITOUCH_INTERFACE 12 // Touchscreen
  856. #define MULTITOUCH_ENDPOINT 15
  857. #define MULTITOUCH_SIZE 9
  858. #define MULTITOUCH_FINGERS 10
  859. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  860. #define ENDPOINT2_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  861. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  862. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  863. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  864. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  865. #define ENDPOINT7_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  866. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ONLY
  867. #define ENDPOINT9_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  868. #define ENDPOINT10_CONFIG ENDPOINT_TRANSMIT_ONLY
  869. #define ENDPOINT11_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  870. #define ENDPOINT12_CONFIG ENDPOINT_TRANSMIT_ONLY
  871. #define ENDPOINT13_CONFIG (ENDPOINT_RECEIVE_ISOCHRONOUS|ENDPOINT_TRANSMIT_ISOCHRONOUS)
  872. #define ENDPOINT14_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  873. #define ENDPOINT15_CONFIG ENDPOINT_TRANSMIT_ONLY
  874. #endif
  875. #ifdef USB_DESC_LIST_DEFINE
  876. #if defined(NUM_ENDPOINTS) && NUM_ENDPOINTS > 0
  877. // NUM_ENDPOINTS = number of non-zero endpoints (0 to 7)
  878. extern const uint32_t usb_endpoint_config_table[NUM_ENDPOINTS];
  879. typedef struct {
  880. uint16_t wValue;
  881. uint16_t wIndex;
  882. const uint8_t *addr;
  883. uint16_t length;
  884. } usb_descriptor_list_t;
  885. extern const usb_descriptor_list_t usb_descriptor_list[];
  886. #endif // NUM_ENDPOINTS
  887. #endif // USB_DESC_LIST_DEFINE