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

888 行
34KB

  1. /* Teensyduino Core Library
  2. * http://www.pjrc.com/teensy/
  3. * Copyright (c) 2017 PJRC.COM, LLC.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * 1. The above copyright notice and this permission notice shall be
  14. * included in all copies or substantial portions of the Software.
  15. *
  16. * 2. If the Software is incorporated into a build system that allows
  17. * selection among a list of target devices, then similar target
  18. * devices manufactured by PJRC.COM must be included in the list of
  19. * target devices and selectable in the same manner.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  25. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  26. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  28. * SOFTWARE.
  29. */
  30. #pragma once
  31. // This header is NOT meant to be included when compiling
  32. // user sketches in Arduino. The low-level functions
  33. // provided by usb_dev.c are meant to be called only by
  34. // code which provides higher-level interfaces to the user.
  35. #include <stdint.h>
  36. #include <stddef.h>
  37. #define ENDPOINT_TRANSMIT_UNUSED 0x00020000
  38. #define ENDPOINT_TRANSMIT_ISOCHRONOUS 0x00C40000
  39. #define ENDPOINT_TRANSMIT_BULK 0x00C80000
  40. #define ENDPOINT_TRANSMIT_INTERRUPT 0x00CC0000
  41. #define ENDPOINT_RECEIVE_UNUSED 0x00000002
  42. #define ENDPOINT_RECEIVE_ISOCHRONOUS 0x000000C4
  43. #define ENDPOINT_RECEIVE_BULK 0x000000C8
  44. #define ENDPOINT_RECEIVE_INTERRUPT 0x000000CC
  45. /*
  46. Each group of #define lines below corresponds to one of the
  47. settings in the Tools > USB Type menu. This file defines what
  48. type of USB device is actually created for each of those menu
  49. options.
  50. Each "interface" is a set of functionality your PC or Mac will
  51. use and treat as if it is a unique device. Within each interface,
  52. the "endpoints" are the actual communication channels. Most
  53. interfaces use 1, 2 or 3 endpoints. By editing only this file,
  54. you can customize the USB Types to be any collection of interfaces.
  55. To modify a USB Type, delete the XYZ_INTERFACE lines for any
  56. interfaces you wish to remove, and copy them from another USB Type
  57. for any you want to add.
  58. Give each interface a unique number, and edit NUM_INTERFACE to
  59. reflect the total number of interfaces.
  60. Next, assign unique endpoint numbers to all the endpoints across
  61. all the interfaces your device has. You can reuse an endpoint
  62. number for transmit and receive, but the same endpoint number must
  63. not be used twice to transmit, or twice to receive.
  64. Most endpoints also require their maximum size, and some also
  65. need an interval specification (the number of milliseconds the
  66. PC will check for data from that endpoint). For existing
  67. interfaces, usually these other settings should not be changed.
  68. Edit NUM_ENDPOINTS to be at least the largest endpoint number used.
  69. Edit NUM_USB_BUFFERS to control how much memory the USB stack will
  70. allocate. At least 2 should be used for each endpoint. More
  71. memory will allow higher throughput for user programs that have
  72. high latency (eg, spending time doing things other than interacting
  73. with the USB).
  74. Edit the ENDPOINT*_CONFIG lines so each endpoint is configured
  75. the proper way (transmit, receive, or both).
  76. If you are using existing interfaces (making your own device with
  77. a different set of interfaces) the code in all other files should
  78. automatically adapt to the new endpoints you specify here.
  79. If you need to create a new type of interface, you'll need to write
  80. the code which sends and receives packets, and presents an API to
  81. the user. Usually, a pair of files are added for the actual code,
  82. and code is also added in usb_dev.c for any control transfers,
  83. interrupt-level code, or other very low-level stuff not possible
  84. from the packet send/receive functons. Code also is added in
  85. usb_inst.c to create an instance of your C++ object. This message
  86. gives a quick summary of things you will need to know:
  87. https://forum.pjrc.com/threads/49045?p=164512&viewfull=1#post164512
  88. You may edit the Vendor and Product ID numbers, and strings. If
  89. the numbers are changed, Teensyduino may not be able to automatically
  90. find and reboot your board when you click the Upload button in
  91. the Arduino IDE. You will need to press the Program button on
  92. Teensy to initiate programming.
  93. Some operating systems, especially Windows, may cache USB device
  94. info. Changes to the device name may not update on the same
  95. computer unless the vendor or product ID numbers change, or the
  96. "bcdDevice" revision code is increased.
  97. If these instructions are missing steps or could be improved, please
  98. let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
  99. */
  100. #if defined(USB_SERIAL)
  101. #define VENDOR_ID 0x16C0
  102. #define PRODUCT_ID 0x0483
  103. #define DEVICE_CLASS 2 // 2 = Communication Class
  104. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  105. #define MANUFACTURER_NAME_LEN 11
  106. #define PRODUCT_NAME {'U','S','B',' ','S','e','r','i','a','l'}
  107. #define PRODUCT_NAME_LEN 10
  108. #define EP0_SIZE 64
  109. #define NUM_ENDPOINTS 4
  110. #define NUM_USB_BUFFERS 12
  111. #define NUM_INTERFACE 2
  112. #define CDC_STATUS_INTERFACE 0
  113. #define CDC_DATA_INTERFACE 1
  114. #define CDC_ACM_ENDPOINT 2
  115. #define CDC_RX_ENDPOINT 3
  116. #define CDC_TX_ENDPOINT 4
  117. #define CDC_ACM_SIZE 16
  118. #define CDC_RX_SIZE_480 512
  119. #define CDC_TX_SIZE_480 512
  120. #define CDC_RX_SIZE_12 64
  121. #define CDC_TX_SIZE_12 64
  122. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  123. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_UNUSED
  124. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_BULK
  125. #elif defined(USB_KEYBOARDONLY)
  126. #define VENDOR_ID 0x16C0
  127. #define PRODUCT_ID 0x04D0
  128. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  129. #define MANUFACTURER_NAME_LEN 11
  130. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d'}
  131. #define PRODUCT_NAME_LEN 8
  132. #define EP0_SIZE 64
  133. #define NUM_ENDPOINTS 4
  134. #define NUM_USB_BUFFERS 14
  135. #define NUM_INTERFACE 3
  136. #define SEREMU_INTERFACE 1 // Serial emulation
  137. #define SEREMU_TX_ENDPOINT 1
  138. #define SEREMU_TX_SIZE 64
  139. #define SEREMU_TX_INTERVAL 1
  140. #define SEREMU_RX_ENDPOINT 2
  141. #define SEREMU_RX_SIZE 32
  142. #define SEREMU_RX_INTERVAL 2
  143. #define KEYBOARD_INTERFACE 0 // Keyboard
  144. #define KEYBOARD_ENDPOINT 3
  145. #define KEYBOARD_SIZE 8
  146. #define KEYBOARD_INTERVAL 1
  147. #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
  148. #define KEYMEDIA_ENDPOINT 4
  149. #define KEYMEDIA_SIZE 8
  150. #define KEYMEDIA_INTERVAL 4
  151. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  152. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  153. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  154. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  155. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  156. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ONLY
  157. #elif defined(USB_HID)
  158. #define VENDOR_ID 0x16C0
  159. #define PRODUCT_ID 0x0482
  160. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  161. #define MANUFACTURER_NAME_LEN 11
  162. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
  163. #define PRODUCT_NAME_LEN 23
  164. #define EP0_SIZE 64
  165. #define NUM_ENDPOINTS 6
  166. #define NUM_USB_BUFFERS 24
  167. #define NUM_INTERFACE 5
  168. #define SEREMU_INTERFACE 2 // Serial emulation
  169. #define SEREMU_TX_ENDPOINT 1
  170. #define SEREMU_TX_SIZE 64
  171. #define SEREMU_TX_INTERVAL 1
  172. #define SEREMU_RX_ENDPOINT 2
  173. #define SEREMU_RX_SIZE 32
  174. #define SEREMU_RX_INTERVAL 2
  175. #define KEYBOARD_INTERFACE 0 // Keyboard
  176. #define KEYBOARD_ENDPOINT 3
  177. #define KEYBOARD_SIZE 8
  178. #define KEYBOARD_INTERVAL 1
  179. #define KEYMEDIA_INTERFACE 4 // Keyboard Media Keys
  180. #define KEYMEDIA_ENDPOINT 6
  181. #define KEYMEDIA_SIZE 8
  182. #define KEYMEDIA_INTERVAL 4
  183. #define MOUSE_INTERFACE 1 // Mouse
  184. #define MOUSE_ENDPOINT 5
  185. #define MOUSE_SIZE 8
  186. #define MOUSE_INTERVAL 1
  187. #define JOYSTICK_INTERFACE 3 // Joystick
  188. #define JOYSTICK_ENDPOINT 4
  189. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  190. #define JOYSTICK_INTERVAL 2
  191. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  192. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  193. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  194. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  195. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  196. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ONLY
  197. #elif defined(USB_SERIAL_HID)
  198. #define VENDOR_ID 0x16C0
  199. #define PRODUCT_ID 0x0487
  200. #define DEVICE_CLASS 0xEF
  201. #define DEVICE_SUBCLASS 0x02
  202. #define DEVICE_PROTOCOL 0x01
  203. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  204. #define MANUFACTURER_NAME_LEN 11
  205. #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'}
  206. #define PRODUCT_NAME_LEN 30
  207. #define EP0_SIZE 64
  208. #define NUM_ENDPOINTS 7
  209. #define NUM_USB_BUFFERS 30
  210. #define NUM_INTERFACE 6
  211. #define CDC_IAD_DESCRIPTOR 1
  212. #define CDC_STATUS_INTERFACE 0
  213. #define CDC_DATA_INTERFACE 1 // Serial
  214. #define CDC_ACM_ENDPOINT 2
  215. #define CDC_RX_ENDPOINT 3
  216. #define CDC_TX_ENDPOINT 4
  217. #define CDC_ACM_SIZE 16
  218. #define CDC_RX_SIZE 64
  219. #define CDC_TX_SIZE 64
  220. #define KEYBOARD_INTERFACE 2 // Keyboard
  221. #define KEYBOARD_ENDPOINT 1
  222. #define KEYBOARD_SIZE 8
  223. #define KEYBOARD_INTERVAL 1
  224. #define KEYMEDIA_INTERFACE 5 // Keyboard Media Keys
  225. #define KEYMEDIA_ENDPOINT 7
  226. #define KEYMEDIA_SIZE 8
  227. #define KEYMEDIA_INTERVAL 4
  228. #define MOUSE_INTERFACE 3 // Mouse
  229. #define MOUSE_ENDPOINT 5
  230. #define MOUSE_SIZE 8
  231. #define MOUSE_INTERVAL 2
  232. #define JOYSTICK_INTERFACE 4 // Joystick
  233. #define JOYSTICK_ENDPOINT 6
  234. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  235. #define JOYSTICK_INTERVAL 1
  236. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  237. #define ENDPOINT2_CONFIG ENDPOINT_TRANSMIT_ONLY
  238. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
  239. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  240. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  241. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ONLY
  242. #define ENDPOINT7_CONFIG ENDPOINT_TRANSMIT_ONLY
  243. #elif defined(USB_TOUCHSCREEN)
  244. #define VENDOR_ID 0x16C0
  245. #define PRODUCT_ID 0x04D3
  246. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  247. #define MANUFACTURER_NAME_LEN 11
  248. #define PRODUCT_NAME {'K','e','y','b','o','a','r','d','/','T','o','u','c','h','s','c','r','e','e','n'}
  249. #define PRODUCT_NAME_LEN 20
  250. #define EP0_SIZE 64
  251. #define NUM_ENDPOINTS 5
  252. #define NUM_USB_BUFFERS 15
  253. #define NUM_INTERFACE 4
  254. #define SEREMU_INTERFACE 1 // Serial emulation
  255. #define SEREMU_TX_ENDPOINT 1
  256. #define SEREMU_TX_SIZE 64
  257. #define SEREMU_TX_INTERVAL 1
  258. #define SEREMU_RX_ENDPOINT 2
  259. #define SEREMU_RX_SIZE 32
  260. #define SEREMU_RX_INTERVAL 2
  261. #define KEYBOARD_INTERFACE 0 // Keyboard
  262. #define KEYBOARD_ENDPOINT 3
  263. #define KEYBOARD_SIZE 8
  264. #define KEYBOARD_INTERVAL 1
  265. #define KEYMEDIA_INTERFACE 2 // Keyboard Media Keys
  266. #define KEYMEDIA_ENDPOINT 4
  267. #define KEYMEDIA_SIZE 8
  268. #define KEYMEDIA_INTERVAL 4
  269. #define MULTITOUCH_INTERFACE 3 // Touchscreen
  270. #define MULTITOUCH_ENDPOINT 5
  271. #define MULTITOUCH_SIZE 8
  272. #define MULTITOUCH_FINGERS 10
  273. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  274. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  275. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  276. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  277. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  278. #elif defined(USB_HID_TOUCHSCREEN)
  279. #define VENDOR_ID 0x16C0
  280. #define PRODUCT_ID 0x04D4
  281. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  282. #define MANUFACTURER_NAME_LEN 11
  283. #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'}
  284. #define PRODUCT_NAME_LEN 26
  285. #define EP0_SIZE 64
  286. #define NUM_ENDPOINTS 6
  287. #define NUM_USB_BUFFERS 20
  288. #define NUM_INTERFACE 5
  289. #define SEREMU_INTERFACE 2 // Serial emulation
  290. #define SEREMU_TX_ENDPOINT 1
  291. #define SEREMU_TX_SIZE 64
  292. #define SEREMU_TX_INTERVAL 1
  293. #define SEREMU_RX_ENDPOINT 2
  294. #define SEREMU_RX_SIZE 32
  295. #define SEREMU_RX_INTERVAL 2
  296. #define KEYBOARD_INTERFACE 0 // Keyboard
  297. #define KEYBOARD_ENDPOINT 3
  298. #define KEYBOARD_SIZE 8
  299. #define KEYBOARD_INTERVAL 1
  300. #define KEYMEDIA_INTERFACE 3 // Keyboard Media Keys
  301. #define KEYMEDIA_ENDPOINT 4
  302. #define KEYMEDIA_SIZE 8
  303. #define KEYMEDIA_INTERVAL 4
  304. #define MOUSE_INTERFACE 1 // Mouse
  305. #define MOUSE_ENDPOINT 6
  306. #define MOUSE_SIZE 8
  307. #define MOUSE_INTERVAL 2
  308. #define MULTITOUCH_INTERFACE 4 // Touchscreen
  309. #define MULTITOUCH_ENDPOINT 5
  310. #define MULTITOUCH_SIZE 8
  311. #define MULTITOUCH_FINGERS 10
  312. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  313. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  314. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  315. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  316. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  317. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ONLY
  318. #elif defined(USB_MIDI)
  319. #define VENDOR_ID 0x16C0
  320. #define PRODUCT_ID 0x0485
  321. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  322. #define MANUFACTURER_NAME_LEN 11
  323. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  324. #define PRODUCT_NAME_LEN 11
  325. #define EP0_SIZE 64
  326. #define NUM_ENDPOINTS 4
  327. #define NUM_USB_BUFFERS 16
  328. #define NUM_INTERFACE 2
  329. #define SEREMU_INTERFACE 1 // Serial emulation
  330. #define SEREMU_TX_ENDPOINT 1
  331. #define SEREMU_TX_SIZE 64
  332. #define SEREMU_TX_INTERVAL 1
  333. #define SEREMU_RX_ENDPOINT 2
  334. #define SEREMU_RX_SIZE 32
  335. #define SEREMU_RX_INTERVAL 2
  336. #define MIDI_INTERFACE 0 // MIDI
  337. #define MIDI_NUM_CABLES 1
  338. #define MIDI_TX_ENDPOINT 3
  339. #define MIDI_TX_SIZE 64
  340. #define MIDI_RX_ENDPOINT 4
  341. #define MIDI_RX_SIZE 64
  342. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  343. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  344. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  345. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  346. #elif defined(USB_MIDI4)
  347. #define VENDOR_ID 0x16C0
  348. #define PRODUCT_ID 0x0485
  349. #define BCD_DEVICE 0x0211
  350. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  351. #define MANUFACTURER_NAME_LEN 11
  352. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','4'}
  353. #define PRODUCT_NAME_LEN 13
  354. #define EP0_SIZE 64
  355. #define NUM_ENDPOINTS 4
  356. #define NUM_USB_BUFFERS 16
  357. #define NUM_INTERFACE 2
  358. #define SEREMU_INTERFACE 1 // Serial emulation
  359. #define SEREMU_TX_ENDPOINT 1
  360. #define SEREMU_TX_SIZE 64
  361. #define SEREMU_TX_INTERVAL 1
  362. #define SEREMU_RX_ENDPOINT 2
  363. #define SEREMU_RX_SIZE 32
  364. #define SEREMU_RX_INTERVAL 2
  365. #define MIDI_INTERFACE 0 // MIDI
  366. #define MIDI_NUM_CABLES 4
  367. #define MIDI_TX_ENDPOINT 3
  368. #define MIDI_TX_SIZE 64
  369. #define MIDI_RX_ENDPOINT 4
  370. #define MIDI_RX_SIZE 64
  371. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  372. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  373. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  374. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  375. #elif defined(USB_MIDI16)
  376. #define VENDOR_ID 0x16C0
  377. #define PRODUCT_ID 0x0485
  378. #define BCD_DEVICE 0x0212
  379. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  380. #define MANUFACTURER_NAME_LEN 11
  381. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6'}
  382. #define PRODUCT_NAME_LEN 14
  383. #define EP0_SIZE 64
  384. #define NUM_ENDPOINTS 4
  385. #define NUM_USB_BUFFERS 16
  386. #define NUM_INTERFACE 2
  387. #define SEREMU_INTERFACE 1 // Serial emulation
  388. #define SEREMU_TX_ENDPOINT 1
  389. #define SEREMU_TX_SIZE 64
  390. #define SEREMU_TX_INTERVAL 1
  391. #define SEREMU_RX_ENDPOINT 2
  392. #define SEREMU_RX_SIZE 32
  393. #define SEREMU_RX_INTERVAL 2
  394. #define MIDI_INTERFACE 0 // MIDI
  395. #define MIDI_NUM_CABLES 16
  396. #define MIDI_TX_ENDPOINT 3
  397. #define MIDI_TX_SIZE 64
  398. #define MIDI_RX_ENDPOINT 4
  399. #define MIDI_RX_SIZE 64
  400. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  401. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  402. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  403. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  404. #elif defined(USB_MIDI_SERIAL)
  405. #define VENDOR_ID 0x16C0
  406. #define PRODUCT_ID 0x0489
  407. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  408. #define MANUFACTURER_NAME_LEN 11
  409. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  410. #define PRODUCT_NAME_LEN 11
  411. #define EP0_SIZE 64
  412. #define NUM_ENDPOINTS 5
  413. #define NUM_USB_BUFFERS 30
  414. #define NUM_INTERFACE 3
  415. #define CDC_IAD_DESCRIPTOR 1
  416. #define CDC_STATUS_INTERFACE 0
  417. #define CDC_DATA_INTERFACE 1 // Serial
  418. #define CDC_ACM_ENDPOINT 1
  419. #define CDC_RX_ENDPOINT 2
  420. #define CDC_TX_ENDPOINT 3
  421. #define CDC_ACM_SIZE 16
  422. #define CDC_RX_SIZE 64
  423. #define CDC_TX_SIZE 64
  424. #define MIDI_INTERFACE 2 // MIDI
  425. #define MIDI_NUM_CABLES 1
  426. #define MIDI_TX_ENDPOINT 4
  427. #define MIDI_TX_SIZE 64
  428. #define MIDI_RX_ENDPOINT 5
  429. #define MIDI_RX_SIZE 64
  430. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  431. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  432. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  433. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  434. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  435. #elif defined(USB_MIDI4_SERIAL)
  436. #define VENDOR_ID 0x16C0
  437. #define PRODUCT_ID 0x0489
  438. #define BCD_DEVICE 0x0211
  439. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  440. #define MANUFACTURER_NAME_LEN 11
  441. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','4'}
  442. #define PRODUCT_NAME_LEN 13
  443. #define EP0_SIZE 64
  444. #define NUM_ENDPOINTS 5
  445. #define NUM_USB_BUFFERS 30
  446. #define NUM_INTERFACE 3
  447. #define CDC_IAD_DESCRIPTOR 1
  448. #define CDC_STATUS_INTERFACE 0
  449. #define CDC_DATA_INTERFACE 1 // Serial
  450. #define CDC_ACM_ENDPOINT 1
  451. #define CDC_RX_ENDPOINT 2
  452. #define CDC_TX_ENDPOINT 3
  453. #define CDC_ACM_SIZE 16
  454. #define CDC_RX_SIZE 64
  455. #define CDC_TX_SIZE 64
  456. #define MIDI_INTERFACE 2 // MIDI
  457. #define MIDI_NUM_CABLES 4
  458. #define MIDI_TX_ENDPOINT 4
  459. #define MIDI_TX_SIZE 64
  460. #define MIDI_RX_ENDPOINT 5
  461. #define MIDI_RX_SIZE 64
  462. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  463. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  464. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  465. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  466. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  467. #elif defined(USB_MIDI16_SERIAL)
  468. #define VENDOR_ID 0x16C0
  469. #define PRODUCT_ID 0x0489
  470. #define BCD_DEVICE 0x0212
  471. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  472. #define MANUFACTURER_NAME_LEN 11
  473. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6'}
  474. #define PRODUCT_NAME_LEN 14
  475. #define EP0_SIZE 64
  476. #define NUM_ENDPOINTS 5
  477. #define NUM_USB_BUFFERS 30
  478. #define NUM_INTERFACE 3
  479. #define CDC_IAD_DESCRIPTOR 1
  480. #define CDC_STATUS_INTERFACE 0
  481. #define CDC_DATA_INTERFACE 1 // Serial
  482. #define CDC_ACM_ENDPOINT 1
  483. #define CDC_RX_ENDPOINT 2
  484. #define CDC_TX_ENDPOINT 3
  485. #define CDC_ACM_SIZE 16
  486. #define CDC_RX_SIZE 64
  487. #define CDC_TX_SIZE 64
  488. #define MIDI_INTERFACE 2 // MIDI
  489. #define MIDI_NUM_CABLES 16
  490. #define MIDI_TX_ENDPOINT 4
  491. #define MIDI_TX_SIZE 64
  492. #define MIDI_RX_ENDPOINT 5
  493. #define MIDI_RX_SIZE 64
  494. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  495. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  496. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  497. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  498. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  499. #elif defined(USB_RAWHID)
  500. #define VENDOR_ID 0x16C0
  501. #define PRODUCT_ID 0x0486
  502. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  503. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  504. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  505. #define MANUFACTURER_NAME_LEN 11
  506. #define PRODUCT_NAME {'T','e','e','n','s','y','d','u','i','n','o',' ','R','a','w','H','I','D'}
  507. #define PRODUCT_NAME_LEN 18
  508. #define EP0_SIZE 64
  509. #define NUM_ENDPOINTS 4
  510. #define NUM_USB_BUFFERS 12
  511. #define NUM_INTERFACE 2
  512. #define RAWHID_INTERFACE 0 // RawHID
  513. #define RAWHID_TX_ENDPOINT 3
  514. #define RAWHID_TX_SIZE 64
  515. #define RAWHID_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  516. #define RAWHID_RX_ENDPOINT 4
  517. #define RAWHID_RX_SIZE 64
  518. #define RAWHID_RX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  519. #define SEREMU_INTERFACE 1 // Serial emulation
  520. #define SEREMU_TX_ENDPOINT 2
  521. #define SEREMU_TX_SIZE 64
  522. #define SEREMU_TX_INTERVAL 1 // TODO: is this ok for 480 Mbit speed
  523. #define SEREMU_RX_ENDPOINT 2
  524. #define SEREMU_RX_SIZE 32
  525. #define SEREMU_RX_INTERVAL 2 // TODO: is this ok for 480 Mbit speed
  526. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  527. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  528. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_UNUSED
  529. #elif defined(USB_FLIGHTSIM)
  530. #define VENDOR_ID 0x16C0
  531. #define PRODUCT_ID 0x0488
  532. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  533. #define MANUFACTURER_NAME_LEN 11
  534. #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'}
  535. #define PRODUCT_NAME_LEN 26
  536. #define EP0_SIZE 64
  537. #define NUM_ENDPOINTS 4
  538. #define NUM_USB_BUFFERS 20
  539. #define NUM_INTERFACE 2
  540. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  541. #define FLIGHTSIM_TX_ENDPOINT 3
  542. #define FLIGHTSIM_TX_SIZE 64
  543. #define FLIGHTSIM_TX_INTERVAL 1
  544. #define FLIGHTSIM_RX_ENDPOINT 4
  545. #define FLIGHTSIM_RX_SIZE 64
  546. #define FLIGHTSIM_RX_INTERVAL 1
  547. #define SEREMU_INTERFACE 1 // Serial emulation
  548. #define SEREMU_TX_ENDPOINT 1
  549. #define SEREMU_TX_SIZE 64
  550. #define SEREMU_TX_INTERVAL 1
  551. #define SEREMU_RX_ENDPOINT 2
  552. #define SEREMU_RX_SIZE 32
  553. #define SEREMU_RX_INTERVAL 2
  554. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  555. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  556. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  557. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  558. #elif defined(USB_FLIGHTSIM_JOYSTICK)
  559. #define VENDOR_ID 0x16C0
  560. #define PRODUCT_ID 0x0488
  561. #define BCD_DEVICE 0x0211
  562. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  563. #define MANUFACTURER_NAME_LEN 11
  564. #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'}
  565. #define PRODUCT_NAME_LEN 26
  566. #define EP0_SIZE 64
  567. #define NUM_ENDPOINTS 5
  568. #define NUM_USB_BUFFERS 20
  569. #define NUM_INTERFACE 3
  570. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  571. #define FLIGHTSIM_TX_ENDPOINT 3
  572. #define FLIGHTSIM_TX_SIZE 64
  573. #define FLIGHTSIM_TX_INTERVAL 1
  574. #define FLIGHTSIM_RX_ENDPOINT 4
  575. #define FLIGHTSIM_RX_SIZE 64
  576. #define FLIGHTSIM_RX_INTERVAL 1
  577. #define SEREMU_INTERFACE 1 // Serial emulation
  578. #define SEREMU_TX_ENDPOINT 1
  579. #define SEREMU_TX_SIZE 64
  580. #define SEREMU_TX_INTERVAL 1
  581. #define SEREMU_RX_ENDPOINT 2
  582. #define SEREMU_RX_SIZE 32
  583. #define SEREMU_RX_INTERVAL 2
  584. #define JOYSTICK_INTERFACE 2 // Joystick
  585. #define JOYSTICK_ENDPOINT 5
  586. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  587. #define JOYSTICK_INTERVAL 1
  588. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  589. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  590. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  591. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  592. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  593. #elif defined(USB_MTPDISK)
  594. #define VENDOR_ID 0x16C0
  595. #define PRODUCT_ID 0x04D1
  596. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  597. #define MANUFACTURER_NAME_LEN 11
  598. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','T','P',' ','D','i','s','k'}
  599. #define PRODUCT_NAME_LEN 15
  600. #define EP0_SIZE 64
  601. #define NUM_ENDPOINTS 4
  602. #define NUM_USB_BUFFERS 20
  603. #define NUM_INTERFACE 2
  604. #define MTP_INTERFACE 0 // MTP Disk
  605. #define MTP_TX_ENDPOINT 3
  606. #define MTP_TX_SIZE 64
  607. #define MTP_RX_ENDPOINT 3
  608. #define MTP_RX_SIZE 64
  609. #define MTP_EVENT_ENDPOINT 4
  610. #define MTP_EVENT_SIZE 16
  611. #define MTP_EVENT_INTERVAL 10
  612. #define SEREMU_INTERFACE 1 // Serial emulation
  613. #define SEREMU_TX_ENDPOINT 1
  614. #define SEREMU_TX_SIZE 64
  615. #define SEREMU_TX_INTERVAL 1
  616. #define SEREMU_RX_ENDPOINT 2
  617. #define SEREMU_RX_SIZE 32
  618. #define SEREMU_RX_INTERVAL 2
  619. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  620. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  621. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  622. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  623. #elif defined(USB_AUDIO)
  624. #define VENDOR_ID 0x16C0
  625. #define PRODUCT_ID 0x04D2
  626. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  627. #define MANUFACTURER_NAME_LEN 11
  628. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','A','u','d','i','o'}
  629. #define PRODUCT_NAME_LEN 12
  630. #define EP0_SIZE 64
  631. #define NUM_ENDPOINTS 5
  632. #define NUM_USB_BUFFERS 16
  633. #define NUM_INTERFACE 4
  634. #define SEREMU_INTERFACE 0 // Serial emulation
  635. #define SEREMU_TX_ENDPOINT 1
  636. #define SEREMU_TX_SIZE 64
  637. #define SEREMU_TX_INTERVAL 1
  638. #define SEREMU_RX_ENDPOINT 2
  639. #define SEREMU_RX_SIZE 32
  640. #define SEREMU_RX_INTERVAL 2
  641. #define AUDIO_INTERFACE 1 // Audio (uses 3 consecutive interfaces)
  642. #define AUDIO_TX_ENDPOINT 3
  643. #define AUDIO_TX_SIZE 180
  644. #define AUDIO_RX_ENDPOINT 4
  645. #define AUDIO_RX_SIZE 180
  646. #define AUDIO_SYNC_ENDPOINT 5
  647. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  648. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  649. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  650. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  651. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  652. #elif defined(USB_MIDI_AUDIO_SERIAL)
  653. #define VENDOR_ID 0x16C0
  654. #define PRODUCT_ID 0x048A
  655. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  656. #define MANUFACTURER_NAME_LEN 11
  657. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','/','A','u','d','i','o'}
  658. #define PRODUCT_NAME_LEN 17
  659. #define EP0_SIZE 64
  660. #define NUM_ENDPOINTS 8
  661. #define NUM_USB_BUFFERS 30
  662. #define NUM_INTERFACE 6
  663. #define CDC_IAD_DESCRIPTOR 1
  664. #define CDC_STATUS_INTERFACE 0
  665. #define CDC_DATA_INTERFACE 1 // Serial
  666. #define CDC_ACM_ENDPOINT 1
  667. #define CDC_RX_ENDPOINT 2
  668. #define CDC_TX_ENDPOINT 3
  669. #define CDC_ACM_SIZE 16
  670. #define CDC_RX_SIZE 64
  671. #define CDC_TX_SIZE 64
  672. #define MIDI_INTERFACE 2 // MIDI
  673. #define MIDI_NUM_CABLES 1
  674. #define MIDI_TX_ENDPOINT 4
  675. #define MIDI_TX_SIZE 64
  676. #define MIDI_RX_ENDPOINT 5
  677. #define MIDI_RX_SIZE 64
  678. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  679. #define AUDIO_TX_ENDPOINT 6
  680. #define AUDIO_TX_SIZE 180
  681. #define AUDIO_RX_ENDPOINT 7
  682. #define AUDIO_RX_SIZE 180
  683. #define AUDIO_SYNC_ENDPOINT 8
  684. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  685. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  686. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  687. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  688. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  689. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  690. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  691. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  692. #elif defined(USB_MIDI16_AUDIO_SERIAL)
  693. #define VENDOR_ID 0x16C0
  694. #define PRODUCT_ID 0x048A
  695. #define BCD_DEVICE 0x0212
  696. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  697. #define MANUFACTURER_NAME_LEN 11
  698. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','x','1','6','/','A','u','d','i','o'}
  699. #define PRODUCT_NAME_LEN 20
  700. #define EP0_SIZE 64
  701. #define NUM_ENDPOINTS 8
  702. #define NUM_USB_BUFFERS 30
  703. #define NUM_INTERFACE 6
  704. #define CDC_IAD_DESCRIPTOR 1
  705. #define CDC_STATUS_INTERFACE 0
  706. #define CDC_DATA_INTERFACE 1 // Serial
  707. #define CDC_ACM_ENDPOINT 1
  708. #define CDC_RX_ENDPOINT 2
  709. #define CDC_TX_ENDPOINT 3
  710. #define CDC_ACM_SIZE 16
  711. #define CDC_RX_SIZE 64
  712. #define CDC_TX_SIZE 64
  713. #define MIDI_INTERFACE 2 // MIDI
  714. #define MIDI_NUM_CABLES 16
  715. #define MIDI_TX_ENDPOINT 4
  716. #define MIDI_TX_SIZE 64
  717. #define MIDI_RX_ENDPOINT 5
  718. #define MIDI_RX_SIZE 64
  719. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  720. #define AUDIO_TX_ENDPOINT 6
  721. #define AUDIO_TX_SIZE 180
  722. #define AUDIO_RX_ENDPOINT 7
  723. #define AUDIO_RX_SIZE 180
  724. #define AUDIO_SYNC_ENDPOINT 8
  725. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  726. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  727. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ONLY
  728. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  729. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  730. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  731. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  732. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  733. #elif defined(USB_EVERYTHING)
  734. #define VENDOR_ID 0x16C0
  735. #define PRODUCT_ID 0x0476
  736. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  737. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  738. #define DEVICE_CLASS 0xEF
  739. #define DEVICE_SUBCLASS 0x02
  740. #define DEVICE_PROTOCOL 0x01
  741. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  742. #define MANUFACTURER_NAME_LEN 11
  743. #define PRODUCT_NAME {'A','l','l',' ','T','h','e',' ','T','h','i','n','g','s'}
  744. #define PRODUCT_NAME_LEN 14
  745. #define EP0_SIZE 64
  746. #define NUM_ENDPOINTS 15
  747. #define NUM_USB_BUFFERS 31
  748. #define NUM_INTERFACE 13
  749. #define CDC_IAD_DESCRIPTOR 1
  750. #define CDC_STATUS_INTERFACE 0
  751. #define CDC_DATA_INTERFACE 1 // Serial
  752. #define CDC_ACM_ENDPOINT 1
  753. #define CDC_RX_ENDPOINT 2
  754. #define CDC_TX_ENDPOINT 2
  755. #define CDC_ACM_SIZE 16
  756. #define CDC_RX_SIZE 64
  757. #define CDC_TX_SIZE 64
  758. #define MIDI_INTERFACE 2 // MIDI
  759. #define MIDI_NUM_CABLES 16
  760. #define MIDI_TX_ENDPOINT 3
  761. #define MIDI_TX_SIZE 64
  762. #define MIDI_RX_ENDPOINT 3
  763. #define MIDI_RX_SIZE 64
  764. #define KEYBOARD_INTERFACE 3 // Keyboard
  765. #define KEYBOARD_ENDPOINT 4
  766. #define KEYBOARD_SIZE 8
  767. #define KEYBOARD_INTERVAL 1
  768. #define MOUSE_INTERFACE 4 // Mouse
  769. #define MOUSE_ENDPOINT 5
  770. #define MOUSE_SIZE 8
  771. #define MOUSE_INTERVAL 2
  772. #define RAWHID_INTERFACE 5 // RawHID
  773. #define RAWHID_TX_ENDPOINT 6
  774. #define RAWHID_TX_SIZE 64
  775. #define RAWHID_TX_INTERVAL 1
  776. #define RAWHID_RX_ENDPOINT 6
  777. #define RAWHID_RX_SIZE 64
  778. #define RAWHID_RX_INTERVAL 1
  779. #define FLIGHTSIM_INTERFACE 6 // Flight Sim Control
  780. #define FLIGHTSIM_TX_ENDPOINT 9
  781. #define FLIGHTSIM_TX_SIZE 64
  782. #define FLIGHTSIM_TX_INTERVAL 1
  783. #define FLIGHTSIM_RX_ENDPOINT 9
  784. #define FLIGHTSIM_RX_SIZE 64
  785. #define FLIGHTSIM_RX_INTERVAL 1
  786. #define JOYSTICK_INTERFACE 7 // Joystick
  787. #define JOYSTICK_ENDPOINT 10
  788. #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
  789. #define JOYSTICK_INTERVAL 1
  790. /*
  791. #define MTP_INTERFACE 8 // MTP Disk
  792. #define MTP_TX_ENDPOINT 11
  793. #define MTP_TX_SIZE 64
  794. #define MTP_RX_ENDPOINT 3
  795. #define MTP_RX_SIZE 64
  796. #define MTP_EVENT_ENDPOINT 11
  797. #define MTP_EVENT_SIZE 16
  798. #define MTP_EVENT_INTERVAL 10
  799. */
  800. #define KEYMEDIA_INTERFACE 8 // Keyboard Media Keys
  801. #define KEYMEDIA_ENDPOINT 12
  802. #define KEYMEDIA_SIZE 8
  803. #define KEYMEDIA_INTERVAL 4
  804. #define AUDIO_INTERFACE 9 // Audio (uses 3 consecutive interfaces)
  805. #define AUDIO_TX_ENDPOINT 13
  806. #define AUDIO_TX_SIZE 180
  807. #define AUDIO_RX_ENDPOINT 13
  808. #define AUDIO_RX_SIZE 180
  809. #define AUDIO_SYNC_ENDPOINT 14
  810. #define MULTITOUCH_INTERFACE 12 // Touchscreen
  811. #define MULTITOUCH_ENDPOINT 15
  812. #define MULTITOUCH_SIZE 8
  813. #define MULTITOUCH_FINGERS 10
  814. #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
  815. #define ENDPOINT2_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  816. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  817. #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
  818. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ONLY
  819. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  820. #define ENDPOINT7_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  821. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ONLY
  822. #define ENDPOINT9_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  823. #define ENDPOINT10_CONFIG ENDPOINT_TRANSMIT_ONLY
  824. #define ENDPOINT11_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  825. #define ENDPOINT12_CONFIG ENDPOINT_TRANSMIT_ONLY
  826. #define ENDPOINT13_CONFIG (ENDPOINT_RECEIVE_ISOCHRONOUS|ENDPOINT_TRANSMIT_ISOCHRONOUS)
  827. #define ENDPOINT14_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  828. #define ENDPOINT15_CONFIG ENDPOINT_TRANSMIT_ONLY
  829. #endif
  830. #ifdef USB_DESC_LIST_DEFINE
  831. #if defined(NUM_ENDPOINTS) && NUM_ENDPOINTS > 0
  832. // NUM_ENDPOINTS = number of non-zero endpoints (0 to 7)
  833. extern const uint32_t usb_endpoint_config_table[NUM_ENDPOINTS];
  834. typedef struct {
  835. uint16_t wValue;
  836. uint16_t wIndex;
  837. const uint8_t *addr;
  838. uint16_t length;
  839. } usb_descriptor_list_t;
  840. extern const usb_descriptor_list_t usb_descriptor_list[];
  841. #endif // NUM_ENDPOINTS
  842. #endif // USB_DESC_LIST_DEFINE