Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

usb_desc.h 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  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. #ifndef _usb_desc_h_
  31. #define _usb_desc_h_
  32. // This header is NOT meant to be included when compiling
  33. // user sketches in Arduino. The low-level functions
  34. // provided by usb_dev.c are meant to be called only by
  35. // code which provides higher-level interfaces to the user.
  36. #include <stdint.h>
  37. #include <stddef.h>
  38. #define ENDPOINT_UNUSED 0x00
  39. #define ENDPOINT_TRANSIMIT_ONLY 0x15
  40. #define ENDPOINT_RECEIVE_ONLY 0x19
  41. #define ENDPOINT_TRANSMIT_AND_RECEIVE 0x1D
  42. #define ENDPOINT_RECEIVE_ISOCHRONOUS 0x18
  43. #define ENDPOINT_TRANSMIT_ISOCHRONOUS 0x14
  44. /*
  45. Each group of #define lines below corresponds to one of the
  46. settings in the Tools > USB Type menu. This file defines what
  47. type of USB device is actually created for each of those menu
  48. options.
  49. Each "interface" is a set of functionality your PC or Mac will
  50. use and treat as if it is a unique device. Within each interface,
  51. the "endpoints" are the actual communication channels. Most
  52. interfaces use 1, 2 or 3 endpoints. By editing only this file,
  53. you can customize the USB Types to be any collection of interfaces.
  54. To modify a USB Type, delete the XYZ_INTERFACE lines for any
  55. interfaces you wish to remove, and copy them from another USB Type
  56. for any you want to add.
  57. Give each interface a unique number, and edit NUM_INTERFACE to
  58. reflect the total number of interfaces.
  59. Next, assign unique endpoint numbers to all the endpoints across
  60. all the interfaces your device has. You can reuse an endpoint
  61. number for transmit and receive, but the same endpoint number must
  62. not be used twice to transmit, or twice to receive.
  63. Most endpoints also require their maximum size, and some also
  64. need an interval specification (the number of milliseconds the
  65. PC will check for data from that endpoint). For existing
  66. interfaces, usually these other settings should not be changed.
  67. Edit NUM_ENDPOINTS to be at least the largest endpoint number used.
  68. Edit NUM_USB_BUFFERS to control how much memory the USB stack will
  69. allocate. At least 2 should be used for each endpoint. More
  70. memory will allow higher throughput for user programs that have
  71. high latency (eg, spending time doing things other than interacting
  72. with the USB).
  73. Edit the ENDPOINT*_CONFIG lines so each endpoint is configured
  74. the proper way (transmit, receive, or both).
  75. If you are using existing interfaces (making your own device with
  76. a different set of interfaces) the code in all other files should
  77. automatically adapt to the new endpoints you specify here.
  78. If you need to create a new type of interface, you'll need to write
  79. the code which sends and receives packets, and presents an API to
  80. the user. Usually, a pair of files are added for the actual code,
  81. and code is also added in usb_dev.c for any control transfers,
  82. interrupt-level code, or other very low-level stuff not possible
  83. from the packet send/receive functons. Code also is added in
  84. usb_inst.c to create an instance of your C++ object.
  85. You may edit the Vendor and Product ID numbers, and strings. If
  86. the numbers are changed, Teensyduino may not be able to automatically
  87. find and reboot your board when you click the Upload button in
  88. the Arduino IDE. You will need to press the Program button on
  89. Teensy to initiate programming.
  90. Some operating systems, especially Windows, may cache USB device
  91. info. Changes to the device name may not update on the same
  92. computer unless the vendor or product ID numbers change, or the
  93. "bcdDevice" revision code is increased.
  94. If these instructions are missing steps or could be improved, please
  95. let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
  96. */
  97. #if defined(USB_SERIAL)
  98. #define VENDOR_ID 0x16C0
  99. #define PRODUCT_ID 0x0483
  100. #define DEVICE_CLASS 2 // 2 = Communication Class
  101. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  102. #define MANUFACTURER_NAME_LEN 11
  103. #define PRODUCT_NAME {'U','S','B',' ','S','e','r','i','a','l'}
  104. #define PRODUCT_NAME_LEN 10
  105. #define EP0_SIZE 64
  106. #define NUM_ENDPOINTS 4
  107. #define NUM_USB_BUFFERS 12
  108. #define NUM_INTERFACE 2
  109. #define CDC_STATUS_INTERFACE 0
  110. #define CDC_DATA_INTERFACE 1
  111. #define CDC_ACM_ENDPOINT 2
  112. #define CDC_RX_ENDPOINT 3
  113. #define CDC_TX_ENDPOINT 4
  114. #define CDC_ACM_SIZE 16
  115. #define CDC_RX_SIZE 64
  116. #define CDC_TX_SIZE 64
  117. #define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY
  118. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
  119. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  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 1
  133. #define SEREMU_TX_SIZE 64
  134. #define SEREMU_TX_INTERVAL 1
  135. #define SEREMU_RX_ENDPOINT 2
  136. #define SEREMU_RX_SIZE 32
  137. #define SEREMU_RX_INTERVAL 2
  138. #define KEYBOARD_INTERFACE 0 // Keyboard
  139. #define KEYBOARD_ENDPOINT 3
  140. #define KEYBOARD_SIZE 8
  141. #define KEYBOARD_INTERVAL 1
  142. #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
  143. #define KEYMEDIA_ENDPOINT 4
  144. #define KEYMEDIA_SIZE 8
  145. #define KEYMEDIA_INTERVAL 4
  146. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  147. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  148. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  149. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  150. #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
  151. #define ENDPOINT6_CONFIG ENDPOINT_TRANSIMIT_ONLY
  152. #elif defined(USB_HID)
  153. #define VENDOR_ID 0x16C0
  154. #define PRODUCT_ID 0x0482
  155. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  156. #define MANUFACTURER_NAME_LEN 11
  157. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
  158. #define PRODUCT_NAME_LEN 23
  159. #define EP0_SIZE 64
  160. #define NUM_ENDPOINTS 6
  161. #define NUM_USB_BUFFERS 24
  162. #define NUM_INTERFACE 5
  163. #define SEREMU_INTERFACE 2 // Serial emulation
  164. #define SEREMU_TX_ENDPOINT 1
  165. #define SEREMU_TX_SIZE 64
  166. #define SEREMU_TX_INTERVAL 1
  167. #define SEREMU_RX_ENDPOINT 2
  168. #define SEREMU_RX_SIZE 32
  169. #define SEREMU_RX_INTERVAL 2
  170. #define KEYBOARD_INTERFACE 0 // Keyboard
  171. #define KEYBOARD_ENDPOINT 3
  172. #define KEYBOARD_SIZE 8
  173. #define KEYBOARD_INTERVAL 1
  174. #define KEYMEDIA_INTERFACE 4 // Keyboard Media Keys
  175. #define KEYMEDIA_ENDPOINT 6
  176. #define KEYMEDIA_SIZE 8
  177. #define KEYMEDIA_INTERVAL 4
  178. #define MOUSE_INTERFACE 1 // Mouse
  179. #define MOUSE_ENDPOINT 5
  180. #define MOUSE_SIZE 8
  181. #define MOUSE_INTERVAL 1
  182. #define JOYSTICK_INTERFACE 3 // Joystick
  183. #define JOYSTICK_ENDPOINT 4
  184. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  185. #define JOYSTICK_INTERVAL 2
  186. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  187. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  188. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  189. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  190. #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
  191. #define ENDPOINT6_CONFIG ENDPOINT_TRANSIMIT_ONLY
  192. #elif defined(USB_SERIAL_HID)
  193. #define VENDOR_ID 0x16C0
  194. #define PRODUCT_ID 0x0487
  195. #define DEVICE_CLASS 0xEF
  196. #define DEVICE_SUBCLASS 0x02
  197. #define DEVICE_PROTOCOL 0x01
  198. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  199. #define MANUFACTURER_NAME_LEN 11
  200. #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'}
  201. #define PRODUCT_NAME_LEN 30
  202. #define EP0_SIZE 64
  203. #define NUM_ENDPOINTS 7
  204. #define NUM_USB_BUFFERS 30
  205. #define NUM_INTERFACE 6
  206. #define CDC_IAD_DESCRIPTOR 1
  207. #define CDC_STATUS_INTERFACE 0
  208. #define CDC_DATA_INTERFACE 1 // Serial
  209. #define CDC_ACM_ENDPOINT 2
  210. #define CDC_RX_ENDPOINT 3
  211. #define CDC_TX_ENDPOINT 4
  212. #define CDC_ACM_SIZE 16
  213. #define CDC_RX_SIZE 64
  214. #define CDC_TX_SIZE 64
  215. #define KEYBOARD_INTERFACE 2 // Keyboard
  216. #define KEYBOARD_ENDPOINT 1
  217. #define KEYBOARD_SIZE 8
  218. #define KEYBOARD_INTERVAL 1
  219. #define KEYMEDIA_INTERFACE 5 // Keyboard Media Keys
  220. #define KEYMEDIA_ENDPOINT 7
  221. #define KEYMEDIA_SIZE 8
  222. #define KEYMEDIA_INTERVAL 4
  223. #define MOUSE_INTERFACE 3 // Mouse
  224. #define MOUSE_ENDPOINT 5
  225. #define MOUSE_SIZE 8
  226. #define MOUSE_INTERVAL 2
  227. #define JOYSTICK_INTERFACE 4 // Joystick
  228. #define JOYSTICK_ENDPOINT 6
  229. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  230. #define JOYSTICK_INTERVAL 1
  231. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  232. #define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY
  233. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
  234. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  235. #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
  236. #define ENDPOINT6_CONFIG ENDPOINT_TRANSIMIT_ONLY
  237. #define ENDPOINT7_CONFIG ENDPOINT_TRANSIMIT_ONLY
  238. #elif defined(USB_TOUCHSCREEN)
  239. #define VENDOR_ID 0x16C0
  240. #define PRODUCT_ID 0x04D3
  241. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  242. #define MANUFACTURER_NAME_LEN 11
  243. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','T','o','u','c','h','s','c','r','e','e','n'}
  244. #define PRODUCT_NAME_LEN 20
  245. #define EP0_SIZE 64
  246. #define NUM_ENDPOINTS 5
  247. #define NUM_USB_BUFFERS 15
  248. #define NUM_INTERFACE 4
  249. #define SEREMU_INTERFACE 1 // Serial emulation
  250. #define SEREMU_TX_ENDPOINT 1
  251. #define SEREMU_TX_SIZE 64
  252. #define SEREMU_TX_INTERVAL 1
  253. #define SEREMU_RX_ENDPOINT 2
  254. #define SEREMU_RX_SIZE 32
  255. #define SEREMU_RX_INTERVAL 2
  256. #define KEYBOARD_INTERFACE 0 // Keyboard
  257. #define KEYBOARD_ENDPOINT 3
  258. #define KEYBOARD_SIZE 8
  259. #define KEYBOARD_INTERVAL 1
  260. #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
  261. #define KEYMEDIA_ENDPOINT 4
  262. #define KEYMEDIA_SIZE 8
  263. #define KEYMEDIA_INTERVAL 4
  264. #define MULTITOUCH_INTERFACE 3 // Touchscreen
  265. #define MULTITOUCH_ENDPOINT 5
  266. #define MULTITOUCH_SIZE 9
  267. #define MULTITOUCH_FINGERS 10
  268. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  269. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  270. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  271. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  272. #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
  273. #elif defined(USB_HID_TOUCHSCREEN)
  274. #define VENDOR_ID 0x16C0
  275. #define PRODUCT_ID 0x04D4
  276. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  277. #define MANUFACTURER_NAME_LEN 11
  278. #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'}
  279. #define PRODUCT_NAME_LEN 26
  280. #define EP0_SIZE 64
  281. #define NUM_ENDPOINTS 6
  282. #define NUM_USB_BUFFERS 20
  283. #define NUM_INTERFACE 5
  284. #define SEREMU_INTERFACE 2 // Serial emulation
  285. #define SEREMU_TX_ENDPOINT 1
  286. #define SEREMU_TX_SIZE 64
  287. #define SEREMU_TX_INTERVAL 1
  288. #define SEREMU_RX_ENDPOINT 2
  289. #define SEREMU_RX_SIZE 32
  290. #define SEREMU_RX_INTERVAL 2
  291. #define KEYBOARD_INTERFACE 0 // Keyboard
  292. #define KEYBOARD_ENDPOINT 3
  293. #define KEYBOARD_SIZE 8
  294. #define KEYBOARD_INTERVAL 1
  295. #define KEYMEDIA_INTERFACE 3 // Keyboard Media Keys
  296. #define KEYMEDIA_ENDPOINT 4
  297. #define KEYMEDIA_SIZE 8
  298. #define KEYMEDIA_INTERVAL 4
  299. #define MOUSE_INTERFACE 1 // Mouse
  300. #define MOUSE_ENDPOINT 6
  301. #define MOUSE_SIZE 8
  302. #define MOUSE_INTERVAL 2
  303. #define MULTITOUCH_INTERFACE 4 // Touchscreen
  304. #define MULTITOUCH_ENDPOINT 5
  305. #define MULTITOUCH_SIZE 9
  306. #define MULTITOUCH_FINGERS 10
  307. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  308. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  309. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  310. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  311. #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
  312. #define ENDPOINT6_CONFIG ENDPOINT_TRANSIMIT_ONLY
  313. #elif defined(USB_MIDI)
  314. #define VENDOR_ID 0x16C0
  315. #define PRODUCT_ID 0x0485
  316. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  317. #define MANUFACTURER_NAME_LEN 11
  318. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  319. #define PRODUCT_NAME_LEN 11
  320. #define EP0_SIZE 64
  321. #define NUM_ENDPOINTS 4
  322. #define NUM_USB_BUFFERS 16
  323. #define NUM_INTERFACE 2
  324. #define SEREMU_INTERFACE 1 // Serial emulation
  325. #define SEREMU_TX_ENDPOINT 1
  326. #define SEREMU_TX_SIZE 64
  327. #define SEREMU_TX_INTERVAL 1
  328. #define SEREMU_RX_ENDPOINT 2
  329. #define SEREMU_RX_SIZE 32
  330. #define SEREMU_RX_INTERVAL 2
  331. #define MIDI_INTERFACE 0 // MIDI
  332. #define MIDI_TX_ENDPOINT 3
  333. #define MIDI_TX_SIZE 64
  334. #define MIDI_RX_ENDPOINT 4
  335. #define MIDI_RX_SIZE 64
  336. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  337. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  338. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  339. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  340. #elif defined(USB_MIDI_SERIAL)
  341. #define VENDOR_ID 0x16C0
  342. #define PRODUCT_ID 0x0489
  343. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  344. #define MANUFACTURER_NAME_LEN 11
  345. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  346. #define PRODUCT_NAME_LEN 11
  347. #define EP0_SIZE 64
  348. #define NUM_ENDPOINTS 5
  349. #define NUM_USB_BUFFERS 30
  350. #define NUM_INTERFACE 3
  351. #define CDC_IAD_DESCRIPTOR 1
  352. #define CDC_STATUS_INTERFACE 0
  353. #define CDC_DATA_INTERFACE 1 // Serial
  354. #define CDC_ACM_ENDPOINT 1
  355. #define CDC_RX_ENDPOINT 2
  356. #define CDC_TX_ENDPOINT 3
  357. #define CDC_ACM_SIZE 16
  358. #define CDC_RX_SIZE 64
  359. #define CDC_TX_SIZE 64
  360. #define MIDI_INTERFACE 2 // MIDI
  361. #define MIDI_TX_ENDPOINT 4
  362. #define MIDI_TX_SIZE 64
  363. #define MIDI_RX_ENDPOINT 5
  364. #define MIDI_RX_SIZE 64
  365. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  366. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  367. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  368. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  369. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  370. #elif defined(USB_RAWHID)
  371. #define VENDOR_ID 0x16C0
  372. #define PRODUCT_ID 0x0486
  373. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  374. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  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','d','u','i','n','o',' ','R','a','w','H','I','D'}
  378. #define PRODUCT_NAME_LEN 18
  379. #define EP0_SIZE 64
  380. #define NUM_ENDPOINTS 4
  381. #define NUM_USB_BUFFERS 12
  382. #define NUM_INTERFACE 2
  383. #define RAWHID_INTERFACE 0 // RawHID
  384. #define RAWHID_TX_ENDPOINT 3
  385. #define RAWHID_TX_SIZE 64
  386. #define RAWHID_TX_INTERVAL 1
  387. #define RAWHID_RX_ENDPOINT 4
  388. #define RAWHID_RX_SIZE 64
  389. #define RAWHID_RX_INTERVAL 1
  390. #define SEREMU_INTERFACE 1 // Serial emulation
  391. #define SEREMU_TX_ENDPOINT 1
  392. #define SEREMU_TX_SIZE 64
  393. #define SEREMU_TX_INTERVAL 1
  394. #define SEREMU_RX_ENDPOINT 2
  395. #define SEREMU_RX_SIZE 32
  396. #define SEREMU_RX_INTERVAL 2
  397. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  398. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  399. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  400. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  401. #elif defined(USB_FLIGHTSIM)
  402. #define VENDOR_ID 0x16C0
  403. #define PRODUCT_ID 0x0488
  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',' ','F','l','i','g','h','t',' ','S','i','m',' ','C','o','n','t','r','o','l','s'}
  407. #define PRODUCT_NAME_LEN 26
  408. #define EP0_SIZE 64
  409. #define NUM_ENDPOINTS 4
  410. #define NUM_USB_BUFFERS 20
  411. #define NUM_INTERFACE 2
  412. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  413. #define FLIGHTSIM_TX_ENDPOINT 3
  414. #define FLIGHTSIM_TX_SIZE 64
  415. #define FLIGHTSIM_TX_INTERVAL 1
  416. #define FLIGHTSIM_RX_ENDPOINT 4
  417. #define FLIGHTSIM_RX_SIZE 64
  418. #define FLIGHTSIM_RX_INTERVAL 1
  419. #define SEREMU_INTERFACE 1 // Serial emulation
  420. #define SEREMU_TX_ENDPOINT 1
  421. #define SEREMU_TX_SIZE 64
  422. #define SEREMU_TX_INTERVAL 1
  423. #define SEREMU_RX_ENDPOINT 2
  424. #define SEREMU_RX_SIZE 32
  425. #define SEREMU_RX_INTERVAL 2
  426. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  427. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  428. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  429. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  430. #elif defined(USB_FLIGHTSIM_JOYSTICK)
  431. #define VENDOR_ID 0x16C0
  432. #define PRODUCT_ID 0x04D9
  433. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  434. #define MANUFACTURER_NAME_LEN 11
  435. #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'}
  436. #define PRODUCT_NAME_LEN 26
  437. #define EP0_SIZE 64
  438. #define NUM_ENDPOINTS 5
  439. #define NUM_USB_BUFFERS 20
  440. #define NUM_INTERFACE 3
  441. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  442. #define FLIGHTSIM_TX_ENDPOINT 3
  443. #define FLIGHTSIM_TX_SIZE 64
  444. #define FLIGHTSIM_TX_INTERVAL 1
  445. #define FLIGHTSIM_RX_ENDPOINT 4
  446. #define FLIGHTSIM_RX_SIZE 64
  447. #define FLIGHTSIM_RX_INTERVAL 1
  448. #define SEREMU_INTERFACE 1 // Serial emulation
  449. #define SEREMU_TX_ENDPOINT 1
  450. #define SEREMU_TX_SIZE 64
  451. #define SEREMU_TX_INTERVAL 1
  452. #define SEREMU_RX_ENDPOINT 2
  453. #define SEREMU_RX_SIZE 32
  454. #define SEREMU_RX_INTERVAL 2
  455. #define JOYSTICK_INTERFACE 2 // Joystick
  456. #define JOYSTICK_ENDPOINT 5
  457. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  458. #define JOYSTICK_INTERVAL 1
  459. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  460. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  461. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  462. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  463. #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
  464. #elif defined(USB_MTPDISK)
  465. #define VENDOR_ID 0x16C0
  466. #define PRODUCT_ID 0x04D1
  467. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  468. #define MANUFACTURER_NAME_LEN 11
  469. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','T','P',' ','D','i','s','k'}
  470. #define PRODUCT_NAME_LEN 15
  471. #define EP0_SIZE 64
  472. #define NUM_ENDPOINTS 4
  473. #define NUM_USB_BUFFERS 20
  474. #define NUM_INTERFACE 2
  475. #define MTP_INTERFACE 0 // MTP Disk
  476. #define MTP_TX_ENDPOINT 3
  477. #define MTP_TX_SIZE 64
  478. #define MTP_RX_ENDPOINT 3
  479. #define MTP_RX_SIZE 64
  480. #define MTP_EVENT_ENDPOINT 4
  481. #define MTP_EVENT_SIZE 16
  482. #define MTP_EVENT_INTERVAL 10
  483. #define SEREMU_INTERFACE 1 // Serial emulation
  484. #define SEREMU_TX_ENDPOINT 1
  485. #define SEREMU_TX_SIZE 64
  486. #define SEREMU_TX_INTERVAL 1
  487. #define SEREMU_RX_ENDPOINT 2
  488. #define SEREMU_RX_SIZE 32
  489. #define SEREMU_RX_INTERVAL 2
  490. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  491. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  492. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  493. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  494. #elif defined(USB_AUDIO)
  495. #define VENDOR_ID 0x16C0
  496. #define PRODUCT_ID 0x04D2
  497. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  498. #define MANUFACTURER_NAME_LEN 11
  499. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','A','u','d','i','o'}
  500. #define PRODUCT_NAME_LEN 12
  501. #define EP0_SIZE 64
  502. #define NUM_ENDPOINTS 5
  503. #define NUM_USB_BUFFERS 16
  504. #define NUM_INTERFACE 4
  505. #define SEREMU_INTERFACE 0 // Serial emulation
  506. #define SEREMU_TX_ENDPOINT 1
  507. #define SEREMU_TX_SIZE 64
  508. #define SEREMU_TX_INTERVAL 1
  509. #define SEREMU_RX_ENDPOINT 2
  510. #define SEREMU_RX_SIZE 32
  511. #define SEREMU_RX_INTERVAL 2
  512. #define AUDIO_INTERFACE 1 // Audio (uses 3 consecutive interfaces)
  513. #define AUDIO_TX_ENDPOINT 3
  514. #define AUDIO_TX_SIZE 180
  515. #define AUDIO_RX_ENDPOINT 4
  516. #define AUDIO_RX_SIZE 180
  517. #define AUDIO_SYNC_ENDPOINT 5
  518. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  519. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  520. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  521. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  522. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  523. #elif defined(USB_MIDI_AUDIO_SERIAL)
  524. #define VENDOR_ID 0x16C0
  525. #define PRODUCT_ID 0x048A
  526. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  527. #define MANUFACTURER_NAME_LEN 11
  528. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','/','A','u','d','i','o'}
  529. #define PRODUCT_NAME_LEN 17
  530. #define EP0_SIZE 64
  531. #define NUM_ENDPOINTS 8
  532. #define NUM_USB_BUFFERS 30
  533. #define NUM_INTERFACE 6
  534. #define CDC_IAD_DESCRIPTOR 1
  535. #define CDC_STATUS_INTERFACE 0
  536. #define CDC_DATA_INTERFACE 1 // Serial
  537. #define CDC_ACM_ENDPOINT 1
  538. #define CDC_RX_ENDPOINT 2
  539. #define CDC_TX_ENDPOINT 3
  540. #define CDC_ACM_SIZE 16
  541. #define CDC_RX_SIZE 64
  542. #define CDC_TX_SIZE 64
  543. #define MIDI_INTERFACE 2 // MIDI
  544. #define MIDI_TX_ENDPOINT 4
  545. #define MIDI_TX_SIZE 64
  546. #define MIDI_RX_ENDPOINT 5
  547. #define MIDI_RX_SIZE 64
  548. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  549. #define AUDIO_TX_ENDPOINT 6
  550. #define AUDIO_TX_SIZE 180
  551. #define AUDIO_RX_ENDPOINT 7
  552. #define AUDIO_RX_SIZE 180
  553. #define AUDIO_SYNC_ENDPOINT 8
  554. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  555. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  556. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  557. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  558. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  559. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  560. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  561. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  562. #elif defined(USB_EVERYTHING)
  563. #define VENDOR_ID 0x16C0
  564. #define PRODUCT_ID 0x0476
  565. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  566. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  567. #define DEVICE_CLASS 0xEF
  568. #define DEVICE_SUBCLASS 0x02
  569. #define DEVICE_PROTOCOL 0x01
  570. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  571. #define MANUFACTURER_NAME_LEN 11
  572. #define PRODUCT_NAME {'A','l','l',' ','T','h','e',' ','T','h','i','n','g','s'}
  573. #define PRODUCT_NAME_LEN 14
  574. #define EP0_SIZE 64
  575. #define NUM_ENDPOINTS 15
  576. #define NUM_USB_BUFFERS 31
  577. #define NUM_INTERFACE 13
  578. #define CDC_IAD_DESCRIPTOR 1
  579. #define CDC_STATUS_INTERFACE 0
  580. #define CDC_DATA_INTERFACE 1 // Serial
  581. #define CDC_ACM_ENDPOINT 1
  582. #define CDC_RX_ENDPOINT 2
  583. #define CDC_TX_ENDPOINT 2
  584. #define CDC_ACM_SIZE 16
  585. #define CDC_RX_SIZE 64
  586. #define CDC_TX_SIZE 64
  587. #define MIDI_INTERFACE 2 // MIDI
  588. #define MIDI_TX_ENDPOINT 3
  589. #define MIDI_TX_SIZE 64
  590. #define MIDI_RX_ENDPOINT 3
  591. #define MIDI_RX_SIZE 64
  592. #define KEYBOARD_INTERFACE 3 // Keyboard
  593. #define KEYBOARD_ENDPOINT 4
  594. #define KEYBOARD_SIZE 8
  595. #define KEYBOARD_INTERVAL 1
  596. #define MOUSE_INTERFACE 4 // Mouse
  597. #define MOUSE_ENDPOINT 5
  598. #define MOUSE_SIZE 8
  599. #define MOUSE_INTERVAL 2
  600. #define RAWHID_INTERFACE 5 // RawHID
  601. #define RAWHID_TX_ENDPOINT 6
  602. #define RAWHID_TX_SIZE 64
  603. #define RAWHID_TX_INTERVAL 1
  604. #define RAWHID_RX_ENDPOINT 6
  605. #define RAWHID_RX_SIZE 64
  606. #define RAWHID_RX_INTERVAL 1
  607. #define FLIGHTSIM_INTERFACE 6 // Flight Sim Control
  608. #define FLIGHTSIM_TX_ENDPOINT 9
  609. #define FLIGHTSIM_TX_SIZE 64
  610. #define FLIGHTSIM_TX_INTERVAL 1
  611. #define FLIGHTSIM_RX_ENDPOINT 9
  612. #define FLIGHTSIM_RX_SIZE 64
  613. #define FLIGHTSIM_RX_INTERVAL 1
  614. #define JOYSTICK_INTERFACE 7 // Joystick
  615. #define JOYSTICK_ENDPOINT 10
  616. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  617. #define JOYSTICK_INTERVAL 1
  618. /*
  619. #define MTP_INTERFACE 8 // MTP Disk
  620. #define MTP_TX_ENDPOINT 11
  621. #define MTP_TX_SIZE 64
  622. #define MTP_RX_ENDPOINT 3
  623. #define MTP_RX_SIZE 64
  624. #define MTP_EVENT_ENDPOINT 11
  625. #define MTP_EVENT_SIZE 16
  626. #define MTP_EVENT_INTERVAL 10
  627. */
  628. #define KEYMEDIA_INTERFACE 8 // Keyboard Media Keys
  629. #define KEYMEDIA_ENDPOINT 12
  630. #define KEYMEDIA_SIZE 8
  631. #define KEYMEDIA_INTERVAL 4
  632. #define AUDIO_INTERFACE 9 // Audio (uses 3 consecutive interfaces)
  633. #define AUDIO_TX_ENDPOINT 13
  634. #define AUDIO_TX_SIZE 180
  635. #define AUDIO_RX_ENDPOINT 13
  636. #define AUDIO_RX_SIZE 180
  637. #define AUDIO_SYNC_ENDPOINT 14
  638. #define MULTITOUCH_INTERFACE 12 // Touchscreen
  639. #define MULTITOUCH_ENDPOINT 15
  640. #define MULTITOUCH_SIZE 9
  641. #define MULTITOUCH_FINGERS 10
  642. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  643. #define ENDPOINT2_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  644. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  645. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  646. #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
  647. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  648. #define ENDPOINT7_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  649. #define ENDPOINT8_CONFIG ENDPOINT_TRANSIMIT_ONLY
  650. #define ENDPOINT9_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  651. #define ENDPOINT10_CONFIG ENDPOINT_TRANSIMIT_ONLY
  652. #define ENDPOINT11_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  653. #define ENDPOINT12_CONFIG ENDPOINT_TRANSIMIT_ONLY
  654. #define ENDPOINT13_CONFIG (ENDPOINT_RECEIVE_ISOCHRONOUS|ENDPOINT_TRANSMIT_ISOCHRONOUS)
  655. #define ENDPOINT14_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  656. #define ENDPOINT15_CONFIG ENDPOINT_TRANSIMIT_ONLY
  657. #endif
  658. #ifdef USB_DESC_LIST_DEFINE
  659. #if defined(NUM_ENDPOINTS) && NUM_ENDPOINTS > 0
  660. // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15)
  661. extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
  662. typedef struct {
  663. uint16_t wValue;
  664. uint16_t wIndex;
  665. const uint8_t *addr;
  666. uint16_t length;
  667. } usb_descriptor_list_t;
  668. extern const usb_descriptor_list_t usb_descriptor_list[];
  669. #endif // NUM_ENDPOINTS
  670. #endif // USB_DESC_LIST_DEFINE
  671. #endif