blob: 1bfce4cc60a24176a62627667307fdf2c3f0ce2b [file] [log] [blame]
Travis Geiselbrecht0e713152008-10-10 03:19:03 -07001/*
2 * Copyright (c) 2008 Travis Geiselbrecht
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files
6 * (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge,
8 * publish, distribute, sublicense, and/or sell copies of the Software,
9 * and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23#ifndef __USB_DESCRIPTORS_H
24#define __USB_DESCRIPTORS_H
25
26#include <sys/types.h>
27#include <compiler.h>
28
29#define W(w) (w & 0xff), (w >> 8)
30
31/* top level device descriptor */
32static uint8_t __ALIGNED(2) dev_descr[] = {
33 0x12, /* descriptor length */
34 0x01, /* Device Descriptor type */
35 W(0x0200), /* USB Version */
36 0x00, /* class */
37 0x00, /* subclass */
38 0x00, /* protocol */
39 0x40, /* max packet size, ept0 */
40 W(0x1234), /* vendor */
41 W(0x5678), /* product */
42 W(0x1000), /* release */
43 0x01, /* manufacturer string */
44 0x02, /* product string */
45 0x00, /* serialno string */
46 0x01, /* num configs */
47};
48
49/* high/low speed device qualifier */
50static uint8_t devqual_descr[] = {
51 0x0a, /* len */
52 0x06, /* Device Qualifier type */
53 W(0x0200), /* USB version */
54 0x00, /* class */
55 0x00, /* subclass */
56 0x00, /* protocol */
57 0x40, /* max packet size, ept0 */
58 0x01, /* num configs */
59 0x00 /* reserved */
60};
61
62static uint8_t cfg_descr_lowspeed[] = {
63 0x09, /* Length of Cfg Descr */
64 0x02, /* Type of Cfg Descr */
65 W(0x09), /* Total Length (incl ifc, ept) */
66 0x00, /* # Interfaces */
67 0x01, /* Cfg Value */
68 0x00, /* Cfg String */
69 0xc0, /* Attributes -- self powered */
70 0, /* Power Consumption - none */
71};
72
73static uint8_t cfg_descr_highspeed[] = {
74 0x09, /* Length of Cfg Descr */
75 0x02, /* Type of Cfg Descr */
76 W(0x09), /* Total Length (incl ifc, ept) */
77 0x00, /* # Interfaces */
78 0x01, /* Cfg Value */
79 0x00, /* Cfg String */
80 0xc0, /* Attributes -- self powered */
81 0, /* Power Consumption - none */
82};
83
84static ushort dstring[] = {
85 0x0306, /* numchars * 2 + 2 */
86 'l', 'k'
87};
88
89static ushort mstring[] = {
90 0x0310, /* numchars * 2 + 2 */
91 'l', 'k', ',', 'i', 'n', 'c', '.'
92};
93
94static uchar langid[] __ALIGNED(2) = { 0x04, 0x03, 0x09, 0x04 };
95
96#endif
97