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.

539 lines
21KB

  1. /* Teensyduino Core Library
  2. * http://www.pjrc.com/teensy/
  3. * Copyright (c) 2013 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 0x0482 // TODO: unique
  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 16
  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 16
  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 0x048B
  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_MIDI)
  274. #define VENDOR_ID 0x16C0
  275. #define PRODUCT_ID 0x0485
  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 {'T','e','e','n','s','y',' ','M','I','D','I'}
  279. #define PRODUCT_NAME_LEN 11
  280. #define EP0_SIZE 64
  281. #define NUM_ENDPOINTS 4
  282. #define NUM_USB_BUFFERS 16
  283. #define NUM_INTERFACE 2
  284. #define SEREMU_INTERFACE 1 // 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 MIDI_INTERFACE 0 // MIDI
  292. #define MIDI_TX_ENDPOINT 3
  293. #define MIDI_TX_SIZE 64
  294. #define MIDI_RX_ENDPOINT 4
  295. #define MIDI_RX_SIZE 64
  296. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  297. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  298. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  299. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  300. #elif defined(USB_MIDI_SERIAL)
  301. #define VENDOR_ID 0x16C0
  302. #define PRODUCT_ID 0x0485 // TODO: unique
  303. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  304. #define MANUFACTURER_NAME_LEN 11
  305. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I'}
  306. #define PRODUCT_NAME_LEN 11
  307. #define EP0_SIZE 64
  308. #define NUM_ENDPOINTS 5
  309. #define NUM_USB_BUFFERS 30
  310. #define NUM_INTERFACE 3
  311. #define CDC_IAD_DESCRIPTOR 1
  312. #define CDC_STATUS_INTERFACE 0
  313. #define CDC_DATA_INTERFACE 1 // Serial
  314. #define CDC_ACM_ENDPOINT 1
  315. #define CDC_RX_ENDPOINT 2
  316. #define CDC_TX_ENDPOINT 3
  317. #define CDC_ACM_SIZE 16
  318. #define CDC_RX_SIZE 64
  319. #define CDC_TX_SIZE 64
  320. #define MIDI_INTERFACE 2 // MIDI
  321. #define MIDI_TX_ENDPOINT 4
  322. #define MIDI_TX_SIZE 64
  323. #define MIDI_RX_ENDPOINT 5
  324. #define MIDI_RX_SIZE 64
  325. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  326. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  327. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  328. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  329. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  330. #elif defined(USB_RAWHID)
  331. #define VENDOR_ID 0x16C0
  332. #define PRODUCT_ID 0x0486
  333. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  334. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  335. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  336. #define MANUFACTURER_NAME_LEN 11
  337. #define PRODUCT_NAME {'T','e','e','n','s','y','d','u','i','n','o',' ','R','a','w','H','I','D'}
  338. #define PRODUCT_NAME_LEN 18
  339. #define EP0_SIZE 64
  340. #define NUM_ENDPOINTS 4
  341. #define NUM_USB_BUFFERS 12
  342. #define NUM_INTERFACE 2
  343. #define RAWHID_INTERFACE 0 // RawHID
  344. #define RAWHID_TX_ENDPOINT 3
  345. #define RAWHID_TX_SIZE 64
  346. #define RAWHID_TX_INTERVAL 1
  347. #define RAWHID_RX_ENDPOINT 4
  348. #define RAWHID_RX_SIZE 64
  349. #define RAWHID_RX_INTERVAL 1
  350. #define SEREMU_INTERFACE 1 // Serial emulation
  351. #define SEREMU_TX_ENDPOINT 1
  352. #define SEREMU_TX_SIZE 64
  353. #define SEREMU_TX_INTERVAL 1
  354. #define SEREMU_RX_ENDPOINT 2
  355. #define SEREMU_RX_SIZE 32
  356. #define SEREMU_RX_INTERVAL 2
  357. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  358. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  359. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  360. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  361. #elif defined(USB_FLIGHTSIM)
  362. #define VENDOR_ID 0x16C0
  363. #define PRODUCT_ID 0x0488
  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',' ','F','l','i','g','h','t',' ','S','i','m',' ','C','o','n','t','r','o','l','s'}
  367. #define PRODUCT_NAME_LEN 26
  368. #define EP0_SIZE 64
  369. #define NUM_ENDPOINTS 4
  370. #define NUM_USB_BUFFERS 20
  371. #define NUM_INTERFACE 2
  372. #define FLIGHTSIM_INTERFACE 0 // Flight Sim Control
  373. #define FLIGHTSIM_TX_ENDPOINT 3
  374. #define FLIGHTSIM_TX_SIZE 64
  375. #define FLIGHTSIM_TX_INTERVAL 1
  376. #define FLIGHTSIM_RX_ENDPOINT 4
  377. #define FLIGHTSIM_RX_SIZE 64
  378. #define FLIGHTSIM_RX_INTERVAL 1
  379. #define SEREMU_INTERFACE 1 // Serial emulation
  380. #define SEREMU_TX_ENDPOINT 1
  381. #define SEREMU_TX_SIZE 64
  382. #define SEREMU_TX_INTERVAL 1
  383. #define SEREMU_RX_ENDPOINT 2
  384. #define SEREMU_RX_SIZE 32
  385. #define SEREMU_RX_INTERVAL 2
  386. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  387. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  388. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  389. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  390. #elif defined(USB_MTPDISK)
  391. #define VENDOR_ID 0x16C0
  392. #define PRODUCT_ID 0x0489
  393. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  394. #define MANUFACTURER_NAME_LEN 11
  395. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','T','P',' ','D','i','s','k'}
  396. #define PRODUCT_NAME_LEN 15
  397. #define EP0_SIZE 64
  398. #define NUM_ENDPOINTS 4
  399. #define NUM_USB_BUFFERS 20
  400. #define NUM_INTERFACE 2
  401. #define MTP_INTERFACE 0 // MTP Disk
  402. #define MTP_TX_ENDPOINT 3
  403. #define MTP_TX_SIZE 64
  404. #define MTP_RX_ENDPOINT 3
  405. #define MTP_RX_SIZE 64
  406. #define MTP_EVENT_ENDPOINT 4
  407. #define MTP_EVENT_SIZE 16
  408. #define MTP_EVENT_INTERVAL 10
  409. #define SEREMU_INTERFACE 1 // Serial emulation
  410. #define SEREMU_TX_ENDPOINT 1
  411. #define SEREMU_TX_SIZE 64
  412. #define SEREMU_TX_INTERVAL 1
  413. #define SEREMU_RX_ENDPOINT 2
  414. #define SEREMU_RX_SIZE 32
  415. #define SEREMU_RX_INTERVAL 2
  416. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  417. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  418. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
  419. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ONLY
  420. #elif defined(USB_AUDIO)
  421. #define VENDOR_ID 0x16C0
  422. #define PRODUCT_ID 0x048A
  423. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  424. #define MANUFACTURER_NAME_LEN 11
  425. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','A','u','d','i','o'}
  426. #define PRODUCT_NAME_LEN 12
  427. #define EP0_SIZE 64
  428. #define NUM_ENDPOINTS 5
  429. #define NUM_USB_BUFFERS 16
  430. #define NUM_INTERFACE 4
  431. #define SEREMU_INTERFACE 0 // Serial emulation
  432. #define SEREMU_TX_ENDPOINT 1
  433. #define SEREMU_TX_SIZE 64
  434. #define SEREMU_TX_INTERVAL 1
  435. #define SEREMU_RX_ENDPOINT 2
  436. #define SEREMU_RX_SIZE 32
  437. #define SEREMU_RX_INTERVAL 2
  438. #define AUDIO_INTERFACE 1 // Audio (uses 3 consecutive interfaces)
  439. #define AUDIO_TX_ENDPOINT 3
  440. #define AUDIO_TX_SIZE 180
  441. #define AUDIO_RX_ENDPOINT 4
  442. #define AUDIO_RX_SIZE 180
  443. #define AUDIO_SYNC_ENDPOINT 5
  444. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  445. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  446. #define ENDPOINT3_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  447. #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  448. #define ENDPOINT5_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  449. #elif defined(USB_MIDI_AUDIO_SERIAL)
  450. #define VENDOR_ID 0x16C0
  451. #define PRODUCT_ID 0x0485 // TODO: unique
  452. #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
  453. #define MANUFACTURER_NAME_LEN 11
  454. #define PRODUCT_NAME {'T','e','e','n','s','y',' ','M','I','D','I','/','A','u','d','i','o'}
  455. #define PRODUCT_NAME_LEN 17
  456. #define EP0_SIZE 64
  457. #define NUM_ENDPOINTS 8
  458. #define NUM_USB_BUFFERS 30
  459. #define NUM_INTERFACE 6
  460. #define CDC_IAD_DESCRIPTOR 1
  461. #define CDC_STATUS_INTERFACE 0
  462. #define CDC_DATA_INTERFACE 1 // Serial
  463. #define CDC_ACM_ENDPOINT 1
  464. #define CDC_RX_ENDPOINT 2
  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_TX_ENDPOINT 4
  471. #define MIDI_TX_SIZE 64
  472. #define MIDI_RX_ENDPOINT 5
  473. #define MIDI_RX_SIZE 64
  474. #define AUDIO_INTERFACE 3 // Audio (uses 3 consecutive interfaces)
  475. #define AUDIO_TX_ENDPOINT 6
  476. #define AUDIO_TX_SIZE 180
  477. #define AUDIO_RX_ENDPOINT 7
  478. #define AUDIO_RX_SIZE 180
  479. #define AUDIO_SYNC_ENDPOINT 8
  480. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  481. #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
  482. #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
  483. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  484. #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
  485. #define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  486. #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS
  487. #define ENDPOINT8_CONFIG ENDPOINT_TRANSMIT_ISOCHRONOUS
  488. #endif
  489. #ifdef USB_DESC_LIST_DEFINE
  490. #if defined(NUM_ENDPOINTS) && NUM_ENDPOINTS > 0
  491. // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15)
  492. extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
  493. typedef struct {
  494. uint16_t wValue;
  495. uint16_t wIndex;
  496. const uint8_t *addr;
  497. uint16_t length;
  498. } usb_descriptor_list_t;
  499. extern const usb_descriptor_list_t usb_descriptor_list[];
  500. #endif // NUM_ENDPOINTS
  501. #endif // USB_DESC_LIST_DEFINE
  502. #endif