altosui: Remove some debug printfs from AltosRomconfig class
[fw/altos] / src / ao_product.c
1 /*
2  * Copyright © 2009 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 #include "ao.h"
19 #include "ao_usb.h"
20 #include PRODUCT_DEFS
21
22 /* Defines which mark this particular AltOS product */
23
24 const char ao_version[] = AO_iVersion_STRING;
25 const char ao_manufacturer[] = AO_iManufacturer_STRING;
26 const char ao_product[] = AO_iProduct_STRING;
27
28 #define LE_WORD(x)    ((x)&0xFF),((uint8_t) (((uint16_t) (x))>>8))
29
30 /* USB descriptors in one giant block of bytes */
31 __code __at(0x00aa) uint8_t ao_usb_descriptors [] =
32 {
33         /* Device descriptor */
34         0x12,
35         AO_USB_DESC_DEVICE,
36         LE_WORD(0x0110),        /*  bcdUSB */
37         0x02,                   /*  bDeviceClass */
38         0x00,                   /*  bDeviceSubClass */
39         0x00,                   /*  bDeviceProtocol */
40         AO_USB_CONTROL_SIZE,    /*  bMaxPacketSize */
41         LE_WORD(0xFFFE),        /*  idVendor */
42         LE_WORD(AO_idProduct_NUMBER),   /*  idProduct */
43         LE_WORD(0x0100),        /*  bcdDevice */
44         0x01,                   /*  iManufacturer */
45         0x02,                   /*  iProduct */
46         0x03,                   /*  iSerialNumber */
47         0x01,                   /*  bNumConfigurations */
48
49         /* Configuration descriptor */
50         0x09,
51         AO_USB_DESC_CONFIGURATION,
52         LE_WORD(67),            /*  wTotalLength */
53         0x02,                   /*  bNumInterfaces */
54         0x01,                   /*  bConfigurationValue */
55         0x00,                   /*  iConfiguration */
56         0xC0,                   /*  bmAttributes */
57         0x32,                   /*  bMaxPower */
58
59         /* Control class interface */
60         0x09,
61         AO_USB_DESC_INTERFACE,
62         0x00,                   /*  bInterfaceNumber */
63         0x00,                   /*  bAlternateSetting */
64         0x01,                   /*  bNumEndPoints */
65         0x02,                   /*  bInterfaceClass */
66         0x02,                   /*  bInterfaceSubClass */
67         0x01,                   /*  bInterfaceProtocol, linux requires value of 1 for the cdc_acm module */
68         0x00,                   /*  iInterface */
69
70         /* Header functional descriptor */
71         0x05,
72         CS_INTERFACE,
73         0x00,                   /*  bDescriptor SubType Header */
74         LE_WORD(0x0110),        /*  CDC version 1.1 */
75
76         /* Call management functional descriptor */
77         0x05,
78         CS_INTERFACE,
79         0x01,                   /* bDescriptor SubType Call Management */
80         0x01,                   /* bmCapabilities = device handles call management */
81         0x01,                   /* bDataInterface call management interface number */
82
83         /* ACM functional descriptor */
84         0x04,
85         CS_INTERFACE,
86         0x02,                   /* bDescriptor SubType Abstract Control Management */
87         0x02,                   /* bmCapabilities = D1 (Set_line_Coding, Set_Control_Line_State, Get_Line_Coding and Serial_State) */
88
89         /* Union functional descriptor */
90         0x05,
91         CS_INTERFACE,
92         0x06,                   /* bDescriptor SubType Union Functional descriptor */
93         0x00,                   /* bMasterInterface */
94         0x01,                   /* bSlaveInterface0 */
95
96         /* Notification EP */
97         0x07,
98         AO_USB_DESC_ENDPOINT,
99         AO_USB_INT_EP|0x80,     /* bEndpointAddress */
100         0x03,                   /* bmAttributes = intr */
101         LE_WORD(8),             /* wMaxPacketSize */
102         0x0A,                   /* bInterval */
103
104         /* Data class interface descriptor */
105         0x09,
106         AO_USB_DESC_INTERFACE,
107         0x01,                   /* bInterfaceNumber */
108         0x00,                   /* bAlternateSetting */
109         0x02,                   /* bNumEndPoints */
110         0x0A,                   /* bInterfaceClass = data */
111         0x00,                   /* bInterfaceSubClass */
112         0x00,                   /* bInterfaceProtocol */
113         0x00,                   /* iInterface */
114
115         /* Data EP OUT */
116         0x07,
117         AO_USB_DESC_ENDPOINT,
118         AO_USB_OUT_EP,          /* bEndpointAddress */
119         0x02,                   /* bmAttributes = bulk */
120         LE_WORD(AO_USB_OUT_SIZE),/* wMaxPacketSize */
121         0x00,                   /* bInterval */
122
123         /* Data EP in */
124         0x07,
125         AO_USB_DESC_ENDPOINT,
126         AO_USB_IN_EP|0x80,      /* bEndpointAddress */
127         0x02,                   /* bmAttributes = bulk */
128         LE_WORD(AO_USB_IN_SIZE),/* wMaxPacketSize */
129         0x00,                   /* bInterval */
130
131         /* String descriptors */
132         0x04,
133         AO_USB_DESC_STRING,
134         LE_WORD(0x0409),
135
136         /* iManufacturer */
137         AO_iManufacturer_LEN,
138         AO_USB_DESC_STRING,
139         AO_iManufacturer_UCS2,
140
141         /* iProduct */
142         AO_iProduct_LEN,
143         AO_USB_DESC_STRING,
144         AO_iProduct_UCS2,
145
146         /* iSerial */
147         AO_iSerial_LEN,
148         AO_USB_DESC_STRING,
149         AO_iSerial_UCS2,
150
151         /* Terminating zero */
152         0
153 };