]> git.donarmstrong.com Git - kiibohd-controller.git/blob - Output/pjrcUSB/arm/usb_desc.h
FIxing Media Keys and general USB compatibilty
[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  * Modified by Jacob Alexander (2013-2015)
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * 1. The above copyright notice and this permission notice shall be
15  * included in all copies or substantial portions of the Software.
16  *
17  * 2. If the Software is incorporated into a build system that allows
18  * selection among a list of target devices, then similar target
19  * devices manufactured by PJRC.COM must be included in the list of
20  * target devices and selectable in the same manner.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29  * SOFTWARE.
30  */
31
32 #pragma once
33
34 // ----- Includes -----
35
36 // Compiler Includes
37 #include <stdint.h>
38 #include <stddef.h>
39
40 // Local Includes
41 #include <output_com.h>
42
43
44
45 // ----- Defines -----
46
47 #define ENDPOINT_UNUSED                 0x00
48 #define ENDPOINT_TRANSIMIT_ONLY         0x15
49 #define ENDPOINT_RECEIVE_ONLY           0x19
50 #define ENDPOINT_TRANSMIT_AND_RECEIVE   0x1D
51
52
53 #define DEVICE_CLASS            0x00 // Keep 0x00 to indicate each sub device will indicate what it is
54 #define DEVICE_SUBCLASS         0x00
55 #define DEVICE_PROTOCOL         0x00
56 #define EP0_SIZE                64
57 #define NUM_ENDPOINTS           8
58 #define NUM_USB_BUFFERS         30
59 #define NUM_INTERFACE           7
60
61 #define KEYBOARD_INTERFACE      0 // Keyboard
62 #define KEYBOARD_ENDPOINT       1
63 #define KEYBOARD_SIZE           8
64 #define KEYBOARD_INTERVAL       1
65 #define KEYBOARD_NAME           L"Boot Keyboard"
66
67 #define NKRO_KEYBOARD_INTERFACE 1 // NKRO Keyboard
68 #define NKRO_KEYBOARD_ENDPOINT  2
69 #define NKRO_KEYBOARD_SIZE      64
70 #define NKRO_KEYBOARD_INTERVAL  1
71 #define NKRO_KEYBOARD_NAME      L"NKRO Keyboard"
72
73 #define CDC_IAD_DESCRIPTOR      1
74 #define CDC_STATUS_INTERFACE    2
75 #define CDC_DATA_INTERFACE      3 // Serial
76 #define CDC_ACM_ENDPOINT        3
77 #define CDC_RX_ENDPOINT         4
78 #define CDC_TX_ENDPOINT         5
79 #define CDC_ACM_SIZE            16
80 #define CDC_RX_SIZE             64
81 #define CDC_TX_SIZE             64
82 #define CDC_STATUS_NAME         L"Virtual Serial Port - Status"
83 #define CDC_DATA_NAME           L"Virtual Serial Port - Data"
84
85 #define MOUSE_INTERFACE         4 // Mouse
86 #define MOUSE_ENDPOINT          6
87 #define MOUSE_SIZE              8
88 #define MOUSE_INTERVAL          2
89 #define MOUSE_NAME              L"Mouse"
90
91 #define JOYSTICK_INTERFACE      5 // Joystick
92 #define JOYSTICK_ENDPOINT       7
93 #define JOYSTICK_SIZE           16
94 #define JOYSTICK_INTERVAL       1
95 #define JOYSTICK_NAME           L"Joystick"
96
97 #define SYS_CTRL_INTERFACE      6 // Media Keys
98 #define SYS_CTRL_ENDPOINT       8
99 #define SYS_CTRL_SIZE           8
100 #define SYS_CTRL_INTERVAL       1
101 #define SYS_CTRL_NAME           L"Media Keys"
102
103 #define KEYBOARD_DESC_OFFSET      (9 + 9)
104 #define NKRO_KEYBOARD_DESC_OFFSET (9 + 9+9+7 + 9)
105 #define SERIAL_CDC_DESC_OFFSET    (9 + 9+9+7 + 9+9+7 + 8)
106 #define MOUSE_DESC_OFFSET         (9 + 9+9+7 + 9+9+7 + 8+9+5+5+4+5+7+9+7+7 + 9)
107 #define JOYSTICK_DESC_OFFSET      (9 + 9+9+7 + 9+9+7 + 8+9+5+5+4+5+7+9+7+7 + 9+9+7 + 9)
108 #define SYS_CTRL_DESC_OFFSET      (9 + 9+9+7 + 9+9+7 + 8+9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7 + 9)
109 #define CONFIG_DESC_SIZE          (9 + 9+9+7 + 9+9+7 + 8+9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7 + 9+9+7)
110
111 #define ENDPOINT1_CONFIG        ENDPOINT_TRANSIMIT_ONLY
112 #define ENDPOINT2_CONFIG        ENDPOINT_TRANSIMIT_ONLY
113 #define ENDPOINT3_CONFIG        ENDPOINT_TRANSIMIT_ONLY
114 #define ENDPOINT4_CONFIG        ENDPOINT_RECEIVE_ONLY
115 #define ENDPOINT5_CONFIG        ENDPOINT_TRANSIMIT_ONLY
116 #define ENDPOINT6_CONFIG        ENDPOINT_TRANSIMIT_ONLY
117 #define ENDPOINT7_CONFIG        ENDPOINT_TRANSIMIT_ONLY
118 #define ENDPOINT8_CONFIG        ENDPOINT_TRANSIMIT_ONLY
119
120
121
122 // ----- Enumerations -----
123
124 typedef struct {
125         uint16_t        wValue;
126         uint16_t        wIndex;
127         const uint8_t   *addr;
128         uint16_t        length;
129 } usb_descriptor_list_t;
130
131
132
133 // ----- Variables -----
134
135 // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15)
136 extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
137
138 extern const usb_descriptor_list_t usb_descriptor_list[];
139