PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

usb_desc.h 38KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932
  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_DUAL_SERIAL)
  121. #define VENDOR_ID 0x16C0
  122. #define PRODUCT_ID 0x048B
  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 {'D','u','a','l',' ','S','e','r','i','a','l'}
  126. #define PRODUCT_NAME_LEN 11
  127. #define EP0_SIZE 64
  128. #define NUM_ENDPOINTS 5
  129. #define NUM_INTERFACE 4
  130. #define CDC_IAD_DESCRIPTOR 1 // Serial
  131. #define CDC_STATUS_INTERFACE 0
  132. #define CDC_DATA_INTERFACE 1
  133. #define CDC_ACM_ENDPOINT 2
  134. #define CDC_RX_ENDPOINT 3
  135. #define CDC_TX_ENDPOINT 3
  136. #define CDC_ACM_SIZE 16
  137. #define CDC_RX_SIZE_480 512
  138. #define CDC_TX_SIZE_480 512
  139. #define CDC_RX_SIZE_12 64
  140. #define CDC_TX_SIZE_12 64
  141. #define CDC2_STATUS_INTERFACE 2 // SerialUSB1
  142. #define CDC2_DATA_INTERFACE 3
  143. #define CDC2_ACM_ENDPOINT 4
  144. #define CDC2_RX_ENDPOINT 5
  145. #define CDC2_TX_ENDPOINT 5
  146. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  147. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  148. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  149. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  150. #elif defined(USB_TRIPLE_SERIAL)
  151. #define VENDOR_ID 0x16C0
  152. #define PRODUCT_ID 0x048C
  153. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  154. #define MANUFACTURER_NAME_LEN 11
  155. #define PRODUCT_NAME {'T','r','i','p','l','e',' ','S','e','r','i','a','l'}
  156. #define PRODUCT_NAME_LEN 13
  157. #define EP0_SIZE 64
  158. #define NUM_ENDPOINTS 7
  159. #define NUM_INTERFACE 6
  160. #define CDC_IAD_DESCRIPTOR 1 // Serial
  161. #define CDC_STATUS_INTERFACE 0
  162. #define CDC_DATA_INTERFACE 1
  163. #define CDC_ACM_ENDPOINT 2
  164. #define CDC_RX_ENDPOINT 3
  165. #define CDC_TX_ENDPOINT 3
  166. #define CDC_ACM_SIZE 16
  167. #define CDC_RX_SIZE_480 512
  168. #define CDC_TX_SIZE_480 512
  169. #define CDC_RX_SIZE_12 64
  170. #define CDC_TX_SIZE_12 64
  171. #define CDC2_STATUS_INTERFACE 2 // SerialUSB1
  172. #define CDC2_DATA_INTERFACE 3
  173. #define CDC2_ACM_ENDPOINT 4
  174. #define CDC2_RX_ENDPOINT 5
  175. #define CDC2_TX_ENDPOINT 5
  176. #define CDC3_STATUS_INTERFACE 4 // SerialUSB2
  177. #define CDC3_DATA_INTERFACE 5
  178. #define CDC3_ACM_ENDPOINT 6
  179. #define CDC3_RX_ENDPOINT 7
  180. #define CDC3_TX_ENDPOINT 7
  181. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  182. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  183. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  184. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  185. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  186. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  187. #elif defined(USB_KEYBOARDONLY)
  188. #define VENDOR_ID 0x16C0
  189. #define PRODUCT_ID 0x04D0
  190. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  191. #define MANUFACTURER_NAME_LEN 11
  192. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d'}
  193. #define PRODUCT_NAME_LEN 8
  194. #define EP0_SIZE 64
  195. #define NUM_ENDPOINTS 4
  196. #define NUM_USB_BUFFERS 14
  197. #define NUM_INTERFACE 3
  198. #define SEREMU_INTERFACE 1 // Serial emulation
  199. #define SEREMU_TX_ENDPOINT 2
  200. #define SEREMU_TX_SIZE 64
  201. #define SEREMU_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  202. #define SEREMU_RX_ENDPOINT 2
  203. #define SEREMU_RX_SIZE 32
  204. #define SEREMU_RX_INTERVAL 2 // TODO: is this ok for 480 Mbit speed
  205. #define KEYBOARD_INTERFACE 0 // Keyboard
  206. #define KEYBOARD_ENDPOINT 3
  207. #define KEYBOARD_SIZE 8
  208. #define KEYBOARD_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  209. #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
  210. #define KEYMEDIA_ENDPOINT 4
  211. #define KEYMEDIA_SIZE 8
  212. #define KEYMEDIA_INTERVAL 4 // TODO: is this ok for 480 Mbit speed
  213. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  214. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  215. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  216. #elif defined(USB_HID)
  217. #define VENDOR_ID 0x16C0
  218. #define PRODUCT_ID 0x0482
  219. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  220. #define MANUFACTURER_NAME_LEN 11
  221. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
  222. #define PRODUCT_NAME_LEN 23
  223. #define EP0_SIZE 64
  224. #define NUM_ENDPOINTS 6
  225. #define NUM_USB_BUFFERS 24
  226. #define NUM_INTERFACE 5
  227. #define SEREMU_INTERFACE 2 // Serial emulation
  228. #define SEREMU_TX_ENDPOINT 2
  229. #define SEREMU_TX_SIZE 64
  230. #define SEREMU_TX_INTERVAL 1
  231. #define SEREMU_RX_ENDPOINT 2
  232. #define SEREMU_RX_SIZE 32
  233. #define SEREMU_RX_INTERVAL 2
  234. #define KEYBOARD_INTERFACE 0 // Keyboard
  235. #define KEYBOARD_ENDPOINT 3
  236. #define KEYBOARD_SIZE 8
  237. #define KEYBOARD_INTERVAL 1
  238. #define KEYMEDIA_INTERFACE 4 // Keyboard Media Keys
  239. #define KEYMEDIA_ENDPOINT 4
  240. #define KEYMEDIA_SIZE 8
  241. #define KEYMEDIA_INTERVAL 4
  242. #define MOUSE_INTERFACE 1 // Mouse
  243. #define MOUSE_ENDPOINT 5
  244. #define MOUSE_SIZE 8
  245. #define MOUSE_INTERVAL 1
  246. #define JOYSTICK_INTERFACE 3 // Joystick
  247. #define JOYSTICK_ENDPOINT 6
  248. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  249. #define JOYSTICK_INTERVAL 2
  250. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  251. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  252. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  253. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  254. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  255. #elif defined(USB_SERIAL_HID)
  256. #define VENDOR_ID 0x16C0
  257. #define PRODUCT_ID 0x0487
  258. #define DEVICE_CLASS 0xEF
  259. #define DEVICE_SUBCLASS 0x02
  260. #define DEVICE_PROTOCOL 0x01
  261. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  262. #define MANUFACTURER_NAME_LEN 11
  263. #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'}
  264. #define PRODUCT_NAME_LEN 30
  265. #define EP0_SIZE 64
  266. #define NUM_ENDPOINTS 7
  267. #define NUM_INTERFACE 6
  268. #define CDC_IAD_DESCRIPTOR 1
  269. #define CDC_STATUS_INTERFACE 0
  270. #define CDC_DATA_INTERFACE 1 // Serial
  271. #define CDC_ACM_ENDPOINT 2
  272. #define CDC_RX_ENDPOINT 3
  273. #define CDC_TX_ENDPOINT 3
  274. #define CDC_ACM_SIZE 16
  275. #define CDC_RX_SIZE_480 512
  276. #define CDC_TX_SIZE_480 512
  277. #define CDC_RX_SIZE_12 64
  278. #define CDC_TX_SIZE_12 64
  279. #define KEYBOARD_INTERFACE 2 // Keyboard
  280. #define KEYBOARD_ENDPOINT 4
  281. #define KEYBOARD_SIZE 8
  282. #define KEYBOARD_INTERVAL 1
  283. #define KEYMEDIA_INTERFACE 5 // Keyboard Media Keys
  284. #define KEYMEDIA_ENDPOINT 5
  285. #define KEYMEDIA_SIZE 8
  286. #define KEYMEDIA_INTERVAL 4
  287. #define MOUSE_INTERFACE 3 // Mouse
  288. #define MOUSE_ENDPOINT 6
  289. #define MOUSE_SIZE 8
  290. #define MOUSE_INTERVAL 2
  291. #define JOYSTICK_INTERFACE 4 // Joystick
  292. #define JOYSTICK_ENDPOINT 7
  293. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  294. #define JOYSTICK_INTERVAL 1
  295. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  296. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  297. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  298. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  299. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  300. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  301. #elif defined(USB_TOUCHSCREEN)
  302. #define VENDOR_ID 0x16C0
  303. #define PRODUCT_ID 0x04D3
  304. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  305. #define MANUFACTURER_NAME_LEN 11
  306. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','T','o','u','c','h','s','c','r','e','e','n'}
  307. #define PRODUCT_NAME_LEN 20
  308. #define EP0_SIZE 64
  309. #define NUM_ENDPOINTS 5
  310. #define NUM_INTERFACE 4
  311. #define SEREMU_INTERFACE 1 // Serial emulation
  312. #define SEREMU_TX_ENDPOINT 2
  313. #define SEREMU_TX_SIZE 64
  314. #define SEREMU_TX_INTERVAL 1
  315. #define SEREMU_RX_ENDPOINT 2
  316. #define SEREMU_RX_SIZE 32
  317. #define SEREMU_RX_INTERVAL 2
  318. #define KEYBOARD_INTERFACE 0 // Keyboard
  319. #define KEYBOARD_ENDPOINT 3
  320. #define KEYBOARD_SIZE 8
  321. #define KEYBOARD_INTERVAL 1
  322. #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
  323. #define KEYMEDIA_ENDPOINT 4
  324. #define KEYMEDIA_SIZE 8
  325. #define KEYMEDIA_INTERVAL 4
  326. #define MULTITOUCH_INTERFACE 3 // Touchscreen
  327. #define MULTITOUCH_ENDPOINT 5
  328. #define MULTITOUCH_SIZE 9
  329. #define MULTITOUCH_FINGERS 10
  330. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  331. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  332. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  333. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  334. #elif defined(USB_HID_TOUCHSCREEN)
  335. #define VENDOR_ID 0x16C0
  336. #define PRODUCT_ID 0x04D4
  337. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  338. #define MANUFACTURER_NAME_LEN 11
  339. #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'}
  340. #define PRODUCT_NAME_LEN 26
  341. #define EP0_SIZE 64
  342. #define NUM_ENDPOINTS 6
  343. #define NUM_INTERFACE 5
  344. #define SEREMU_INTERFACE 2 // Serial emulation
  345. #define SEREMU_TX_ENDPOINT 2
  346. #define SEREMU_TX_SIZE 64
  347. #define SEREMU_TX_INTERVAL 1
  348. #define SEREMU_RX_ENDPOINT 2
  349. #define SEREMU_RX_SIZE 32
  350. #define SEREMU_RX_INTERVAL 2
  351. #define KEYBOARD_INTERFACE 0 // Keyboard
  352. #define KEYBOARD_ENDPOINT 3
  353. #define KEYBOARD_SIZE 8
  354. #define KEYBOARD_INTERVAL 1
  355. #define KEYMEDIA_INTERFACE 3 // Keyboard Media Keys
  356. #define KEYMEDIA_ENDPOINT 4
  357. #define KEYMEDIA_SIZE 8
  358. #define KEYMEDIA_INTERVAL 4
  359. #define MOUSE_INTERFACE 1 // Mouse
  360. #define MOUSE_ENDPOINT 6
  361. #define MOUSE_SIZE 8
  362. #define MOUSE_INTERVAL 2
  363. #define MULTITOUCH_INTERFACE 4 // Touchscreen
  364. #define MULTITOUCH_ENDPOINT 5
  365. #define MULTITOUCH_SIZE 9
  366. #define MULTITOUCH_FINGERS 10
  367. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  368. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  369. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  370. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  371. #define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  372. #elif defined(USB_MIDI)
  373. #define VENDOR_ID 0x16C0
  374. #define PRODUCT_ID 0x0485
  375. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  376. #define MANUFACTURER_NAME_LEN 11
  377. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  378. #define PRODUCT_NAME_LEN 11
  379. #define EP0_SIZE 64
  380. #define NUM_ENDPOINTS 4
  381. #define NUM_INTERFACE 2
  382. #define SEREMU_INTERFACE 1 // Serial emulation
  383. #define SEREMU_TX_ENDPOINT 2
  384. #define SEREMU_TX_SIZE 64
  385. #define SEREMU_TX_INTERVAL 1
  386. #define SEREMU_RX_ENDPOINT 2
  387. #define SEREMU_RX_SIZE 32
  388. #define SEREMU_RX_INTERVAL 2
  389. #define MIDI_INTERFACE 0 // MIDI
  390. #define MIDI_NUM_CABLES 1
  391. #define MIDI_TX_ENDPOINT 3
  392. #define MIDI_TX_SIZE_12 64
  393. #define MIDI_TX_SIZE_480 512
  394. #define MIDI_RX_ENDPOINT 3
  395. #define MIDI_RX_SIZE_12 64
  396. #define MIDI_RX_SIZE_480 512
  397. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  398. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  399. #elif defined(USB_MIDI4)
  400. #define VENDOR_ID 0x16C0
  401. #define PRODUCT_ID 0x0485
  402. #define BCD_DEVICE 0x0211
  403. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  404. #define MANUFACTURER_NAME_LEN 11
  405. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','4'}
  406. #define PRODUCT_NAME_LEN 13
  407. #define EP0_SIZE 64
  408. #define NUM_ENDPOINTS 3
  409. #define NUM_INTERFACE 2
  410. #define SEREMU_INTERFACE 1 // Serial emulation
  411. #define SEREMU_TX_ENDPOINT 2
  412. #define SEREMU_TX_SIZE 64
  413. #define SEREMU_TX_INTERVAL 1
  414. #define SEREMU_RX_ENDPOINT 2
  415. #define SEREMU_RX_SIZE 32
  416. #define SEREMU_RX_INTERVAL 2
  417. #define MIDI_INTERFACE 0 // MIDI
  418. #define MIDI_NUM_CABLES 4
  419. #define MIDI_TX_ENDPOINT 3
  420. #define MIDI_TX_SIZE_12 64
  421. #define MIDI_TX_SIZE_480 512
  422. #define MIDI_RX_ENDPOINT 3
  423. #define MIDI_RX_SIZE_12 64
  424. #define MIDI_RX_SIZE_480 512
  425. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  426. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  427. #elif defined(USB_MIDI16)
  428. #define VENDOR_ID 0x16C0
  429. #define PRODUCT_ID 0x0485
  430. #define BCD_DEVICE 0x0212
  431. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  432. #define MANUFACTURER_NAME_LEN 11
  433. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6'}
  434. #define PRODUCT_NAME_LEN 14
  435. #define EP0_SIZE 64
  436. #define NUM_ENDPOINTS 3
  437. #define NUM_INTERFACE 2
  438. #define SEREMU_INTERFACE 1 // Serial emulation
  439. #define SEREMU_TX_ENDPOINT 2
  440. #define SEREMU_TX_SIZE 64
  441. #define SEREMU_TX_INTERVAL 1
  442. #define SEREMU_RX_ENDPOINT 2
  443. #define SEREMU_RX_SIZE 32
  444. #define SEREMU_RX_INTERVAL 2
  445. #define MIDI_INTERFACE 0 // MIDI
  446. #define MIDI_NUM_CABLES 16
  447. #define MIDI_TX_ENDPOINT 3
  448. #define MIDI_TX_SIZE_12 64
  449. #define MIDI_TX_SIZE_480 512
  450. #define MIDI_RX_ENDPOINT 3
  451. #define MIDI_RX_SIZE_12 64
  452. #define MIDI_RX_SIZE_480 512
  453. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  454. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  455. #elif defined(USB_MIDI_SERIAL)
  456. #define VENDOR_ID 0x16C0
  457. #define PRODUCT_ID 0x0489
  458. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  459. #define MANUFACTURER_NAME_LEN 11
  460. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  461. #define PRODUCT_NAME_LEN 11
  462. #define EP0_SIZE 64
  463. #define NUM_ENDPOINTS 4
  464. #define NUM_INTERFACE 3
  465. #define CDC_IAD_DESCRIPTOR 1
  466. #define CDC_STATUS_INTERFACE 0
  467. #define CDC_DATA_INTERFACE 1 // Serial
  468. #define CDC_ACM_ENDPOINT 2
  469. #define CDC_RX_ENDPOINT 3
  470. #define CDC_TX_ENDPOINT 3
  471. #define CDC_ACM_SIZE 16
  472. #define CDC_RX_SIZE_480 512
  473. #define CDC_TX_SIZE_480 512
  474. #define CDC_RX_SIZE_12 64
  475. #define CDC_TX_SIZE_12 64
  476. #define MIDI_INTERFACE 2 // MIDI
  477. #define MIDI_NUM_CABLES 1
  478. #define MIDI_TX_ENDPOINT 4
  479. #define MIDI_TX_SIZE_12 64
  480. #define MIDI_TX_SIZE_480 512
  481. #define MIDI_RX_ENDPOINT 4
  482. #define MIDI_RX_SIZE_12 64
  483. #define MIDI_RX_SIZE_480 512
  484. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  485. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  486. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  487. #elif defined(USB_MIDI4_SERIAL)
  488. #define VENDOR_ID 0x16C0
  489. #define PRODUCT_ID 0x0489
  490. #define BCD_DEVICE 0x0211
  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',' ','M','I','D','I','x','4'}
  494. #define PRODUCT_NAME_LEN 13
  495. #define EP0_SIZE 64
  496. #define NUM_ENDPOINTS 4
  497. #define NUM_INTERFACE 3
  498. #define CDC_IAD_DESCRIPTOR 1
  499. #define CDC_STATUS_INTERFACE 0
  500. #define CDC_DATA_INTERFACE 1 // Serial
  501. #define CDC_ACM_ENDPOINT 2
  502. #define CDC_RX_ENDPOINT 3
  503. #define CDC_TX_ENDPOINT 3
  504. #define CDC_ACM_SIZE 16
  505. #define CDC_RX_SIZE_480 512
  506. #define CDC_TX_SIZE_480 512
  507. #define CDC_RX_SIZE_12 64
  508. #define CDC_TX_SIZE_12 64
  509. #define MIDI_INTERFACE 2 // MIDI
  510. #define MIDI_NUM_CABLES 4
  511. #define MIDI_TX_ENDPOINT 4
  512. #define MIDI_TX_SIZE_12 64
  513. #define MIDI_TX_SIZE_480 512
  514. #define MIDI_RX_ENDPOINT 4
  515. #define MIDI_RX_SIZE_12 64
  516. #define MIDI_RX_SIZE_480 512
  517. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  518. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  519. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  520. #elif defined(USB_MIDI16_SERIAL)
  521. #define VENDOR_ID 0x16C0
  522. #define PRODUCT_ID 0x0489
  523. #define BCD_DEVICE 0x0212
  524. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  525. #define MANUFACTURER_NAME_LEN 11
  526. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6'}
  527. #define PRODUCT_NAME_LEN 14
  528. #define EP0_SIZE 64
  529. #define NUM_ENDPOINTS 4
  530. #define NUM_INTERFACE 3
  531. #define CDC_IAD_DESCRIPTOR 1
  532. #define CDC_STATUS_INTERFACE 0
  533. #define CDC_DATA_INTERFACE 1 // Serial
  534. #define CDC_ACM_ENDPOINT 2
  535. #define CDC_RX_ENDPOINT 3
  536. #define CDC_TX_ENDPOINT 3
  537. #define CDC_ACM_SIZE 16
  538. #define CDC_RX_SIZE_480 512
  539. #define CDC_TX_SIZE_480 512
  540. #define CDC_RX_SIZE_12 64
  541. #define CDC_TX_SIZE_12 64
  542. #define MIDI_INTERFACE 2 // MIDI
  543. #define MIDI_NUM_CABLES 16
  544. #define MIDI_TX_ENDPOINT 4
  545. #define MIDI_TX_SIZE_12 64
  546. #define MIDI_TX_SIZE_480 512
  547. #define MIDI_RX_ENDPOINT 4
  548. #define MIDI_RX_SIZE_12 64
  549. #define MIDI_RX_SIZE_480 512
  550. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  551. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  552. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  553. #elif defined(USB_RAWHID)
  554. #define VENDOR_ID 0x16C0
  555. #define PRODUCT_ID 0x0486
  556. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  557. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  558. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  559. #define MANUFACTURER_NAME_LEN 11
  560. #define PRODUCT_NAME {'T','e','e','n','s','y','d','u','i','n','o',' ','R','a','w','H','I','D'}
  561. #define PRODUCT_NAME_LEN 18
  562. #define EP0_SIZE 64
  563. #define NUM_ENDPOINTS 4
  564. #define NUM_INTERFACE 2
  565. #define RAWHID_INTERFACE 0 // RawHID
  566. #define RAWHID_TX_ENDPOINT 3
  567. #define RAWHID_TX_SIZE 64
  568. #define RAWHID_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  569. #define RAWHID_RX_ENDPOINT 4
  570. #define RAWHID_RX_SIZE 64
  571. #define RAWHID_RX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  572. #define SEREMU_INTERFACE 1 // Serial emulation
  573. #define SEREMU_TX_ENDPOINT 2
  574. #define SEREMU_TX_SIZE 64
  575. #define SEREMU_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  576. #define SEREMU_RX_ENDPOINT 2
  577. #define SEREMU_RX_SIZE 32
  578. #define SEREMU_RX_INTERVAL 2 // TODO: is this ok for 480 Mbit speed
  579. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  580. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  581. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_UNUSED
  582. #elif defined(USB_FLIGHTSIM)
  583. #define VENDOR_ID 0x16C0
  584. #define PRODUCT_ID 0x0488
  585. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  586. #define MANUFACTURER_NAME_LEN 11
  587. #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'}
  588. #define PRODUCT_NAME_LEN 26
  589. #define EP0_SIZE 64
  590. #define NUM_ENDPOINTS 3
  591. #define NUM_INTERFACE 2
  592. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  593. #define FLIGHTSIM_TX_ENDPOINT 3
  594. #define FLIGHTSIM_TX_SIZE 64
  595. #define FLIGHTSIM_TX_INTERVAL 1
  596. #define FLIGHTSIM_RX_ENDPOINT 3
  597. #define FLIGHTSIM_RX_SIZE 64
  598. #define FLIGHTSIM_RX_INTERVAL 1
  599. #define SEREMU_INTERFACE 1 // Serial emulation
  600. #define SEREMU_TX_ENDPOINT 2
  601. #define SEREMU_TX_SIZE 64
  602. #define SEREMU_TX_INTERVAL 1
  603. #define SEREMU_RX_ENDPOINT 2
  604. #define SEREMU_RX_SIZE 32
  605. #define SEREMU_RX_INTERVAL 2
  606. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  607. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  608. #elif defined(USB_FLIGHTSIM_JOYSTICK)
  609. #define VENDOR_ID 0x16C0
  610. #define PRODUCT_ID 0x0488
  611. #define BCD_DEVICE 0x0211
  612. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  613. #define MANUFACTURER_NAME_LEN 11
  614. #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'}
  615. #define PRODUCT_NAME_LEN 26
  616. #define EP0_SIZE 64
  617. #define NUM_ENDPOINTS 4
  618. #define NUM_INTERFACE 3
  619. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  620. #define FLIGHTSIM_TX_ENDPOINT 3
  621. #define FLIGHTSIM_TX_SIZE 64
  622. #define FLIGHTSIM_TX_INTERVAL 1
  623. #define FLIGHTSIM_RX_ENDPOINT 3
  624. #define FLIGHTSIM_RX_SIZE 64
  625. #define FLIGHTSIM_RX_INTERVAL 1
  626. #define SEREMU_INTERFACE 1 // Serial emulation
  627. #define SEREMU_TX_ENDPOINT 2
  628. #define SEREMU_TX_SIZE 64
  629. #define SEREMU_TX_INTERVAL 1
  630. #define SEREMU_RX_ENDPOINT 2
  631. #define SEREMU_RX_SIZE 32
  632. #define SEREMU_RX_INTERVAL 2
  633. #define JOYSTICK_INTERFACE 2 // Joystick
  634. #define JOYSTICK_ENDPOINT 4
  635. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  636. #define JOYSTICK_INTERVAL 1
  637. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  638. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  639. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  640. #elif defined(USB_MTPDISK)
  641. #define VENDOR_ID 0x16C0
  642. #define PRODUCT_ID 0x04D1
  643. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  644. #define MANUFACTURER_NAME_LEN 11
  645. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','T','P',' ','D','i','s','k'}
  646. #define PRODUCT_NAME_LEN 15
  647. #define EP0_SIZE 64
  648. #define NUM_ENDPOINTS 4
  649. #define NUM_INTERFACE 2
  650. #define MTP_INTERFACE 0 // MTP Disk
  651. #define MTP_TX_ENDPOINT 3
  652. #define MTP_TX_SIZE_12 64
  653. #define MTP_TX_SIZE_480 512
  654. #define MTP_RX_ENDPOINT 3
  655. #define MTP_RX_SIZE_12 64
  656. #define MTP_RX_SIZE_480 512
  657. #define MTP_EVENT_ENDPOINT 4
  658. #define MTP_EVENT_SIZE 16
  659. #define MTP_EVENT_INTERVAL_12 10 // 10 = 10 ms
  660. #define MTP_EVENT_INTERVAL_480 7 // 7 = 8 ms
  661. #define SEREMU_INTERFACE 1 // Serial emulation
  662. #define SEREMU_TX_ENDPOINT 2
  663. #define SEREMU_TX_SIZE 64
  664. #define SEREMU_TX_INTERVAL 1
  665. #define SEREMU_RX_ENDPOINT 2
  666. #define SEREMU_RX_SIZE 32
  667. #define SEREMU_RX_INTERVAL 2
  668. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  669. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  670. // TODO: Should ENDPOINT4_CONFIG be ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT ???
  671. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_UNUSED
  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