]> git.donarmstrong.com Git - kiibohd-controller.git/blob - Output/pjrcUSB/arm/usb_desc.h
Adding in USB module updates from Teensyduino 1.18rc2.
[kiibohd-controller.git] / Output / pjrcUSB / arm / usb_desc.h
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
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 #include "output_com.h"
42
43 #define ENDPOINT_UNUSED                 0x00
44 #define ENDPOINT_TRANSIMIT_ONLY         0x15
45 #define ENDPOINT_RECEIVE_ONLY           0x19
46 #define ENDPOINT_TRANSMIT_AND_RECEIVE   0x1D
47
48 // Some operating systems, especially Windows, may cache USB device
49 // info.  Changes to the device name may not update on the same
50 // computer unless the vendor or product ID numbers change, or the
51 // "bcdDevice" revision code is increased.
52
53 #define DEVICE_CLASS            0xEF
54 #define DEVICE_SUBCLASS 0x02
55 #define DEVICE_PROTOCOL 0x01
56 #define EP0_SIZE                64
57 #define NUM_ENDPOINTS           15
58 #define NUM_INTERFACE           4
59 #define CDC_IAD_DESCRIPTOR      1
60 #define CDC_STATUS_INTERFACE    0
61 #define CDC_DATA_INTERFACE      1       // Serial
62 #define CDC_ACM_ENDPOINT        2
63 #define CDC_RX_ENDPOINT       3
64 #define CDC_TX_ENDPOINT       4
65 #define CDC_ACM_SIZE          16
66 #define CDC_RX_SIZE           64
67 #define CDC_TX_SIZE           64
68 #define KEYBOARD_INTERFACE    2 // Keyboard
69 #define KEYBOARD_ENDPOINT     1
70 #define KEYBOARD_SIZE         8
71 #define KEYBOARD_INTERVAL     1
72 #define MOUSE_INTERFACE       3 // Mouse
73 #define MOUSE_ENDPOINT        5
74 #define MOUSE_SIZE            8
75 #define MOUSE_INTERVAL        2
76 #define KEYBOARD_DESC_OFFSET    (9+8 + 9+5+5+4+5+7+9+7+7 + 9)
77 #define MOUSE_DESC_OFFSET       (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9)
78 #define CONFIG_DESC_SIZE        (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7)
79 #define ENDPOINT1_CONFIG        ENDPOINT_TRANSIMIT_ONLY
80 #define ENDPOINT2_CONFIG        ENDPOINT_TRANSIMIT_ONLY
81 #define ENDPOINT3_CONFIG        ENDPOINT_RECEIVE_ONLY
82 #define ENDPOINT4_CONFIG        ENDPOINT_TRANSIMIT_ONLY
83 #define ENDPOINT5_CONFIG        ENDPOINT_TRANSIMIT_ONLY
84
85
86
87 // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15)
88 extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
89
90 typedef struct {
91         uint16_t        wValue;
92         uint16_t        wIndex;
93         const uint8_t   *addr;
94         uint16_t        length;
95 } usb_descriptor_list_t;
96
97 extern const usb_descriptor_list_t usb_descriptor_list[];
98
99
100 #endif
101