Teensy 4.1 core updated for 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.

860 lines
34KB

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