sanguino/cores/arduino/USBCore.h

Fri, 17 Nov 2017 10:13:31 +0100

author
mdd
date
Fri, 17 Nov 2017 10:13:31 +0100
changeset 3
770b218a4931
parent 2
b373b0288715
permissions
-rw-r--r--

proper configuration, homing and planner optimization

2
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
1
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
2 // Copyright (c) 2010, Peter Barrett
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
3 /*
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
4 ** Permission to use, copy, modify, and/or distribute this software for
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
5 ** any purpose with or without fee is hereby granted, provided that the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
6 ** above copyright notice and this permission notice appear in all copies.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
7 **
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
8 ** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
9 ** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
10 ** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
11 ** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
12 ** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
13 ** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
14 ** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
15 ** SOFTWARE.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
16 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
17
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
18 #ifndef __USBCORE_H__
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
19 #define __USBCORE_H__
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
20
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
21 // Standard requests
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
22 #define GET_STATUS 0
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
23 #define CLEAR_FEATURE 1
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
24 #define SET_FEATURE 3
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
25 #define SET_ADDRESS 5
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
26 #define GET_DESCRIPTOR 6
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
27 #define SET_DESCRIPTOR 7
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
28 #define GET_CONFIGURATION 8
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
29 #define SET_CONFIGURATION 9
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
30 #define GET_INTERFACE 10
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
31 #define SET_INTERFACE 11
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
32
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
33
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
34 // bmRequestType
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
35 #define REQUEST_HOSTTODEVICE 0x00
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
36 #define REQUEST_DEVICETOHOST 0x80
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
37 #define REQUEST_DIRECTION 0x80
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
38
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
39 #define REQUEST_STANDARD 0x00
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
40 #define REQUEST_CLASS 0x20
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
41 #define REQUEST_VENDOR 0x40
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
42 #define REQUEST_TYPE 0x60
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
43
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
44 #define REQUEST_DEVICE 0x00
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
45 #define REQUEST_INTERFACE 0x01
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
46 #define REQUEST_ENDPOINT 0x02
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
47 #define REQUEST_OTHER 0x03
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
48 #define REQUEST_RECIPIENT 0x03
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
49
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
50 #define REQUEST_DEVICETOHOST_CLASS_INTERFACE (REQUEST_DEVICETOHOST + REQUEST_CLASS + REQUEST_INTERFACE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
51 #define REQUEST_HOSTTODEVICE_CLASS_INTERFACE (REQUEST_HOSTTODEVICE + REQUEST_CLASS + REQUEST_INTERFACE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
52
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
53 // Class requests
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
54
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
55 #define CDC_SET_LINE_CODING 0x20
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
56 #define CDC_GET_LINE_CODING 0x21
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
57 #define CDC_SET_CONTROL_LINE_STATE 0x22
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
58
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
59 #define MSC_RESET 0xFF
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
60 #define MSC_GET_MAX_LUN 0xFE
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
61
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
62 #define HID_GET_REPORT 0x01
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
63 #define HID_GET_IDLE 0x02
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
64 #define HID_GET_PROTOCOL 0x03
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
65 #define HID_SET_REPORT 0x09
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
66 #define HID_SET_IDLE 0x0A
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
67 #define HID_SET_PROTOCOL 0x0B
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
68
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
69 // Descriptors
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
70
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
71 #define USB_DEVICE_DESC_SIZE 18
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
72 #define USB_CONFIGUARTION_DESC_SIZE 9
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
73 #define USB_INTERFACE_DESC_SIZE 9
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
74 #define USB_ENDPOINT_DESC_SIZE 7
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
75
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
76 #define USB_DEVICE_DESCRIPTOR_TYPE 1
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
77 #define USB_CONFIGURATION_DESCRIPTOR_TYPE 2
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
78 #define USB_STRING_DESCRIPTOR_TYPE 3
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
79 #define USB_INTERFACE_DESCRIPTOR_TYPE 4
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
80 #define USB_ENDPOINT_DESCRIPTOR_TYPE 5
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
81
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
82 #define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
83 #define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
84 #define USB_DEVICE_CLASS_STORAGE 0x08
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
85 #define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
86
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
87 #define USB_CONFIG_POWERED_MASK 0x40
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
88 #define USB_CONFIG_BUS_POWERED 0x80
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
89 #define USB_CONFIG_SELF_POWERED 0xC0
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
90 #define USB_CONFIG_REMOTE_WAKEUP 0x20
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
91
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
92 // bMaxPower in Configuration Descriptor
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
93 #define USB_CONFIG_POWER_MA(mA) ((mA)/2)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
94
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
95 // bEndpointAddress in Endpoint Descriptor
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
96 #define USB_ENDPOINT_DIRECTION_MASK 0x80
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
97 #define USB_ENDPOINT_OUT(addr) ((addr) | 0x00)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
98 #define USB_ENDPOINT_IN(addr) ((addr) | 0x80)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
99
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
100 #define USB_ENDPOINT_TYPE_MASK 0x03
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
101 #define USB_ENDPOINT_TYPE_CONTROL 0x00
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
102 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
103 #define USB_ENDPOINT_TYPE_BULK 0x02
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
104 #define USB_ENDPOINT_TYPE_INTERRUPT 0x03
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
105
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
106 #define TOBYTES(x) ((x) & 0xFF),(((x) >> 8) & 0xFF)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
107
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
108 #define CDC_V1_10 0x0110
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
109 #define CDC_COMMUNICATION_INTERFACE_CLASS 0x02
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
110
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
111 #define CDC_CALL_MANAGEMENT 0x01
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
112 #define CDC_ABSTRACT_CONTROL_MODEL 0x02
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
113 #define CDC_HEADER 0x00
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
114 #define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
115 #define CDC_UNION 0x06
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
116 #define CDC_CS_INTERFACE 0x24
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
117 #define CDC_CS_ENDPOINT 0x25
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
118 #define CDC_DATA_INTERFACE_CLASS 0x0A
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
119
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
120 #define MSC_SUBCLASS_SCSI 0x06
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
121 #define MSC_PROTOCOL_BULK_ONLY 0x50
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
122
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
123 #define HID_HID_DESCRIPTOR_TYPE 0x21
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
124 #define HID_REPORT_DESCRIPTOR_TYPE 0x22
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
125 #define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
126
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
127
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
128 // Device
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
129 typedef struct {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
130 u8 len; // 18
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
131 u8 dtype; // 1 USB_DEVICE_DESCRIPTOR_TYPE
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
132 u16 usbVersion; // 0x200
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
133 u8 deviceClass;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
134 u8 deviceSubClass;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
135 u8 deviceProtocol;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
136 u8 packetSize0; // Packet 0
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
137 u16 idVendor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
138 u16 idProduct;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
139 u16 deviceVersion; // 0x100
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
140 u8 iManufacturer;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
141 u8 iProduct;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
142 u8 iSerialNumber;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
143 u8 bNumConfigurations;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
144 } DeviceDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
145
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
146 // Config
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
147 typedef struct {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
148 u8 len; // 9
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
149 u8 dtype; // 2
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
150 u16 clen; // total length
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
151 u8 numInterfaces;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
152 u8 config;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
153 u8 iconfig;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
154 u8 attributes;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
155 u8 maxPower;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
156 } ConfigDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
157
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
158 // String
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
159
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
160 // Interface
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
161 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
162 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
163 u8 len; // 9
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
164 u8 dtype; // 4
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
165 u8 number;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
166 u8 alternate;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
167 u8 numEndpoints;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
168 u8 interfaceClass;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
169 u8 interfaceSubClass;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
170 u8 protocol;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
171 u8 iInterface;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
172 } InterfaceDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
173
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
174 // Endpoint
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
175 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
176 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
177 u8 len; // 7
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
178 u8 dtype; // 5
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
179 u8 addr;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
180 u8 attr;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
181 u16 packetSize;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
182 u8 interval;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
183 } EndpointDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
184
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
185 // Interface Association Descriptor
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
186 // Used to bind 2 interfaces together in CDC compostite device
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
187 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
188 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
189 u8 len; // 8
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
190 u8 dtype; // 11
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
191 u8 firstInterface;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
192 u8 interfaceCount;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
193 u8 functionClass;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
194 u8 funtionSubClass;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
195 u8 functionProtocol;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
196 u8 iInterface;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
197 } IADDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
198
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
199 // CDC CS interface descriptor
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
200 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
201 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
202 u8 len; // 5
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
203 u8 dtype; // 0x24
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
204 u8 subtype;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
205 u8 d0;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
206 u8 d1;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
207 } CDCCSInterfaceDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
208
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
209 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
210 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
211 u8 len; // 4
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
212 u8 dtype; // 0x24
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
213 u8 subtype;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
214 u8 d0;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
215 } CDCCSInterfaceDescriptor4;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
216
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
217 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
218 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
219 u8 len;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
220 u8 dtype; // 0x24
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
221 u8 subtype; // 1
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
222 u8 bmCapabilities;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
223 u8 bDataInterface;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
224 } CMFunctionalDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
225
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
226 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
227 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
228 u8 len;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
229 u8 dtype; // 0x24
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
230 u8 subtype; // 1
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
231 u8 bmCapabilities;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
232 } ACMFunctionalDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
233
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
234 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
235 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
236 // IAD
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
237 IADDescriptor iad; // Only needed on compound device
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
238
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
239 // Control
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
240 InterfaceDescriptor cif; //
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
241 CDCCSInterfaceDescriptor header;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
242 CMFunctionalDescriptor callManagement; // Call Management
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
243 ACMFunctionalDescriptor controlManagement; // ACM
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
244 CDCCSInterfaceDescriptor functionalDescriptor; // CDC_UNION
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
245 EndpointDescriptor cifin;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
246
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
247 // Data
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
248 InterfaceDescriptor dif;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
249 EndpointDescriptor in;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
250 EndpointDescriptor out;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
251 } CDCDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
252
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
253 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
254 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
255 InterfaceDescriptor msc;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
256 EndpointDescriptor in;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
257 EndpointDescriptor out;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
258 } MSCDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
259
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
260 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
261 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
262 u8 len; // 9
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
263 u8 dtype; // 0x21
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
264 u8 addr;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
265 u8 versionL; // 0x101
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
266 u8 versionH; // 0x101
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
267 u8 country;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
268 u8 desctype; // 0x22 report
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
269 u8 descLenL;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
270 u8 descLenH;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
271 } HIDDescDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
272
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
273 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
274 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
275 InterfaceDescriptor hid;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
276 HIDDescDescriptor desc;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
277 EndpointDescriptor in;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
278 } HIDDescriptor;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
279
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
280
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
281 #define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
282 { 18, 1, 0x200, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs }
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
283
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
284 #define D_CONFIG(_totalLength,_interfaces) \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
285 { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED, USB_CONFIG_POWER_MA(500) }
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
286
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
287 #define D_INTERFACE(_n,_numEndpoints,_class,_subClass,_protocol) \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
288 { 9, 4, _n, 0, _numEndpoints, _class,_subClass, _protocol, 0 }
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
289
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
290 #define D_ENDPOINT(_addr,_attr,_packetSize, _interval) \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
291 { 7, 5, _addr,_attr,_packetSize, _interval }
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
292
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
293 #define D_IAD(_firstInterface, _count, _class, _subClass, _protocol) \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
294 { 8, 11, _firstInterface, _count, _class, _subClass, _protocol, 0 }
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
295
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
296 #define D_HIDREPORT(_descriptorLength) \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
297 { 9, 0x21, 0x1, 0x1, 0, 1, 0x22, _descriptorLength, 0 }
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
298
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
299 #define D_CDCCS(_subtype,_d0,_d1) { 5, 0x24, _subtype, _d0, _d1 }
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
300 #define D_CDCCS4(_subtype,_d0) { 4, 0x24, _subtype, _d0 }
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
301
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
302
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
303 #endif

mercurial