qload: enabled autoquit
[trut64.git] / avr / usbdescriptors.c
bloba575459a64f2e049e222716f6fe8967a3dc812e8
1 /*
2 * Copyright (C) 2007 Anton Blad
3 * Copyright (C) 2007 Fredrik Kuivinen
4 * Copyright (C) 2007 Jakob Rosén
6 * This file is licensed under GPL v2.
7 */
9 #include "usbdescriptors.h"
11 #include "avrusb.h"
13 uint8_t ep_sizes[NUM_EPS] =
14 { EP_CONTROL_SIZE, TRUT_EP_MSG_SIZE, TRUT_EP_CMD_SIZE, TRUT_EP_DATA_SIZE };
16 usb_device_descriptor PROGMEM device_descriptor =
18 sizeof(usb_device_descriptor), // Length of descriptor.
19 USB_DESCRIPTOR_DEVICE, // Descriptor type.
20 0x200, // USB specification version.
21 0, // Device class.
22 0, // Device subclass.
23 0, // Device protocol.
24 EP_CONTROL_SIZE, // Maximum packet size for EP0.
25 0x03eb, // Vendor ID.
26 0, // Product ID.
27 0x1000, // Release number.
28 1, // ID of manufacturer string.
29 2, // ID of product string.
30 3, // ID of serial number string.
31 1 // Number of configurations.
34 configuration_descriptor_1 PROGMEM configuration_1 =
37 sizeof(usb_configuration_descriptor), // Length of configuration descriptor.
38 USB_DESCRIPTOR_CONFIGURATION, // Descriptor type.
39 sizeof(configuration_descriptor_1), // Total length of configuration data.
40 2, // Number of interfaces.
41 1, // Configuration value.
42 4, // ID of configuration string.
43 0x80, // Attributes (0x40: self-powered, 0x20: remote wakeup).
44 50 // Maximum power used (in 2mA steps)
47 sizeof(usb_interface_descriptor), // Length of interface descriptor.
48 USB_DESCRIPTOR_INTERFACE, // Descriptor type.
49 0, // Number of this interface.
50 0, // Number of this alternate setting.
51 2, // Number of endpoints (excluding zero).
52 0, // Interface class.
53 0, // Interface subclass.
54 0, // Interface protocol.
55 5 // ID of interface string.
58 sizeof(usb_endpoint_descriptor), // Length of endpoint descriptor.
59 USB_DESCRIPTOR_ENDPOINT, // Descriptor type.
60 0x80 | TRUT_EP_MSG, // Lower nibble: endpoint number.
61 // Higher nibble: 0x80 for IN endpoint, 0x00 for OUT endpoint
62 0x2, // Endpoint attributes:
63 // Bits 1..0: Endpoint type
64 // 00: Control, 01: Isochronous, 10: Bulk, 11: Interrupt
65 // Bits 5..4: Only used for isochronous endpoints.
66 // Bits 7..6: Reserved.
67 16, // Endpoint maximum packet size.
68 0 // Polling interval in ms for interrupt endpoints.
71 sizeof(usb_endpoint_descriptor), // Length of endpoint descriptor.
72 USB_DESCRIPTOR_ENDPOINT, // Descriptor type.
73 TRUT_EP_CMD, // Lower nibble: endpoint number.
74 // Higher nibble: 0x80 for IN endpoint, 0x00 for OUT endpoint
75 0x2, // Endpoint attributes:
76 // Bits 1..0: Endpoint type
77 // 00: Control, 01: Isochronous, 10: Bulk, 11: Interrupt
78 // Bits 5..4: Only used for isochronous endpoints.
79 // Bits 7..6: Reserved.
80 16, // Endpoint maximum packet size.
81 0 // Polling interval in ms for interrupt endpoints.
84 sizeof(usb_interface_descriptor), // Length of interface descriptor.
85 USB_DESCRIPTOR_INTERFACE, // Descriptor type.
86 1, // Number of this interface.
87 0, // Number of this alternate setting.
88 1, // Number of endpoints (excluding zero).
89 0, // Interface class.
90 0, // Interface subclass.
91 0, // Interface protocol.
92 6 // ID of interface string.
95 sizeof(usb_endpoint_descriptor), // Length of endpoint descriptor.
96 USB_DESCRIPTOR_ENDPOINT, // Descriptor type.
97 TRUT_EP_DATA, // Lower nibble: endpoint number.
98 // Higher nibble: 0x80 for IN endpoint, 0x00 for OUT endpoint
99 0x2, // Endpoint attributes:
100 // Bits 1..0: Endpoint type
101 // 00: Control, 01: Isochronous, 10: Bulk, 11: Interrupt
102 // Bits 5..4: Only used for isochronous endpoints.
103 // Bits 7..6: Reserved.
104 64, // Endpoint maximum packet size.
105 0 // Polling interval in ms for interrupt endpoints.
108 sizeof(usb_interface_descriptor), // Length of interface descriptor.
109 USB_DESCRIPTOR_INTERFACE, // Descriptor type.
110 1, // Number of this interface.
111 1, // Number of this alternate setting.
112 1, // Number of endpoints (excluding zero).
113 0, // Interface class.
114 0, // Interface subclass.
115 0, // Interface protocol.
116 7 // ID of interface string.
119 sizeof(usb_endpoint_descriptor), // Length of endpoint descriptor.
120 USB_DESCRIPTOR_ENDPOINT, // Descriptor type.
121 0x80 | TRUT_EP_DATA, // Lower nibble: endpoint number.
122 // Higher nibble: 0x80 for IN endpoint, 0x00 for OUT endpoint
123 0x2, // Endpoint attributes:
124 // Bits 1..0: Endpoint type
125 // 00: Control, 01: Isochronous, 10: Bulk, 11: Interrupt
126 // Bits 5..4: Only used for isochronous endpoints.
127 // Bits 7..6: Reserved.
128 64, // Endpoint maximum packet size.
129 0 // Polling interval in ms for interrupt endpoints.
132 sizeof(usb_interface_descriptor), // Length of interface descriptor.
133 USB_DESCRIPTOR_INTERFACE, // Descriptor type.
134 1, // Number of this interface.
135 2, // Number of this alternate setting.
136 1, // Number of endpoints (excluding zero).
137 0, // Interface class.
138 0, // Interface subclass.
139 0, // Interface protocol.
140 8 // ID of interface string.
143 sizeof(usb_endpoint_descriptor), // Length of endpoint descriptor.
144 USB_DESCRIPTOR_ENDPOINT, // Descriptor type.
145 TRUT_EP_DATA, // Lower nibble: endpoint number.
146 // Higher nibble: 0x80 for IN endpoint, 0x00 for OUT endpoint
147 0x3, // Endpoint attributes:
148 // Bits 1..0: Endpoint type
149 // 00: Control, 01: Isochronous, 10: Bulk, 11: Interrupt
150 // Bits 5..4: Only used for isochronous endpoints.
151 // Bits 7..6: Reserved.
152 64, // Endpoint maximum packet size.
153 1 // Polling interval in ms for interrupt endpoints.
156 sizeof(usb_interface_descriptor), // Length of interface descriptor.
157 USB_DESCRIPTOR_INTERFACE, // Descriptor type.
158 1, // Number of this interface.
159 3, // Number of this alternate setting.
160 1, // Number of endpoints (excluding zero).
161 0, // Interface class.
162 0, // Interface subclass.
163 0, // Interface protocol.
164 9 // ID of interface string.
167 sizeof(usb_endpoint_descriptor), // Length of endpoint descriptor.
168 USB_DESCRIPTOR_ENDPOINT, // Descriptor type.
169 0x80 | TRUT_EP_DATA, // Lower nibble: endpoint number.
170 // Higher nibble: 0x80 for IN endpoint, 0x00 for OUT endpoint
171 0x3, // Endpoint attributes:
172 // Bits 1..0: Endpoint type
173 // 00: Control, 01: Isochronous, 10: Bulk, 11: Interrupt
174 // Bits 5..4: Only used for isochronous endpoints.
175 // Bits 7..6: Reserved.
176 64, // Endpoint maximum packet size.
177 1 // Polling interval in ms for interrupt endpoints.
181 string_descriptor_0 PROGMEM string_languages =
183 sizeof(string_descriptor_0),
184 USB_DESCRIPTOR_STRING,
185 USB_LANGID
188 typedef
189 struct
191 uint8_t length;
192 uint8_t descriptorType;
193 uint16_t str[4];
194 } manufacturer_string_t;
195 manufacturer_string_t PROGMEM manufacturer_string =
197 sizeof(manufacturer_string_t),
198 USB_DESCRIPTOR_STRING,
199 {'H', 'E', 'A', 'D'}
202 typedef
203 struct
205 uint8_t length;
206 uint8_t descriptorType;
207 uint16_t str[4];
208 } product_string_t;
209 product_string_t PROGMEM product_string =
211 sizeof(product_string_t),
212 USB_DESCRIPTOR_STRING,
213 {'T', 'R', 'U', 'T'}
216 typedef
217 struct
219 uint8_t length;
220 uint8_t descriptorType;
221 uint16_t str[4];
222 } serial_string_t;
223 serial_string_t PROGMEM serial_string =
225 sizeof(serial_string_t),
226 USB_DESCRIPTOR_STRING,
227 {'6', '5', '1', '0'}
230 typedef
231 struct
233 uint8_t length;
234 uint8_t descriptorType;
235 uint16_t str[3];
236 } configuration_string_t;
237 configuration_string_t PROGMEM configuration_string =
239 sizeof(configuration_string_t),
240 USB_DESCRIPTOR_STRING,
241 {'C', 'F', 'G'}
244 typedef
245 struct
247 uint8_t length;
248 uint8_t descriptorType;
249 uint16_t str[7];
250 } commif_string_t;
251 commif_string_t PROGMEM commif_string =
253 sizeof(commif_string_t),
254 USB_DESCRIPTOR_STRING,
255 {'C', 'o', 'm', 'm', ' ', 'I', 'F'}
258 typedef
259 struct
261 uint8_t length;
262 uint8_t descriptorType;
263 uint16_t str[12];
264 } loadifbulk_string_t;
265 loadifbulk_string_t PROGMEM loadifbulk_string =
267 sizeof(loadifbulk_string_t),
268 USB_DESCRIPTOR_STRING,
269 {'L', 'o', 'a', 'd', ' ', 'I', 'F', ' ', 'B', 'u', 'l', 'k'}
272 typedef
273 struct
275 uint8_t length;
276 uint8_t descriptorType;
277 uint16_t str[12];
278 } dumpifbulk_string_t;
279 dumpifbulk_string_t PROGMEM dumpifbulk_string =
281 sizeof(dumpifbulk_string_t),
282 USB_DESCRIPTOR_STRING,
283 {'D', 'u', 'm', 'p', ' ', 'I', 'F', ' ', 'B', 'u', 'l', 'k'}
286 typedef
287 struct
289 uint8_t length;
290 uint8_t descriptorType;
291 uint16_t str[12];
292 } loadifintr_string_t;
293 loadifintr_string_t PROGMEM loadifintr_string =
295 sizeof(loadifintr_string_t),
296 USB_DESCRIPTOR_STRING,
297 {'L', 'o', 'a', 'd', ' ', 'I', 'F', ' ', 'I', 'n', 't', 'r'}
300 typedef
301 struct
303 uint8_t length;
304 uint8_t descriptorType;
305 uint16_t str[12];
306 } dumpifintr_string_t;
307 dumpifintr_string_t PROGMEM dumpifintr_string =
309 sizeof(dumpifintr_string_t),
310 USB_DESCRIPTOR_STRING,
311 {'D', 'u', 'm', 'p', ' ', 'I', 'F', ' ', 'I', 'n', 't', 'r'}
314 PGM_P PROGMEM string_descriptors[] =
316 (PGM_P)&manufacturer_string,
317 (PGM_P)&product_string,
318 (PGM_P)&serial_string,
319 (PGM_P)&configuration_string,
320 (PGM_P)&commif_string,
321 (PGM_P)&loadifbulk_string,
322 (PGM_P)&dumpifbulk_string,
323 (PGM_P)&loadifintr_string,
324 (PGM_P)&dumpifintr_string