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