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