altos/altosui: Log averaged baro sensor data in Tm/Tn
[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 PRODUCT_DEFS
20
21 /* Defines which mark this particular AltOS product */
22
23 const char ao_version[] = AO_iVersion_STRING;
24 const char ao_manufacturer[] = AO_iManufacturer_STRING;
25 const char ao_product[] = AO_iProduct_STRING;
26
27 #define LE_WORD(x)    ((x)&0xFF),((uint8_t) (((uint16_t) (x))>>8))
28
29 #if HAS_USB
30 #include "ao_usb.h"
31 /* USB descriptors in one giant block of bytes */
32 __code __at(0x00aa) uint8_t ao_usb_descriptors [] =
33 {
34         /* Device descriptor */
35         0x12,
36         AO_USB_DESC_DEVICE,
37         LE_WORD(0x0110),        /*  bcdUSB */
38         0x02,                   /*  bDeviceClass */
39         0x00,                   /*  bDeviceSubClass */
40         0x00,                   /*  bDeviceProtocol */
41         AO_USB_CONTROL_SIZE,    /*  bMaxPacketSize */
42         LE_WORD(0xFFFE),        /*  idVendor */
43         LE_WORD(AO_idProduct_NUMBER),   /*  idProduct */
44         LE_WORD(0x0100),        /*  bcdDevice */
45         0x01,                   /*  iManufacturer */
46         0x02,                   /*  iProduct */
47         0x03,                   /*  iSerialNumber */
48         0x01,                   /*  bNumConfigurations */
49
50         /* Configuration descriptor */
51         0x09,
52         AO_USB_DESC_CONFIGURATION,
53         LE_WORD(67),            /*  wTotalLength */
54         0x02,                   /*  bNumInterfaces */
55         0x01,                   /*  bConfigurationValue */
56         0x00,                   /*  iConfiguration */
57         0xC0,                   /*  bmAttributes */
58         0x32,                   /*  bMaxPower */
59
60         /* Control class interface */
61         0x09,
62         AO_USB_DESC_INTERFACE,
63         0x00,                   /*  bInterfaceNumber */
64         0x00,                   /*  bAlternateSetting */
65         0x01,                   /*  bNumEndPoints */
66         0x02,                   /*  bInterfaceClass */
67         0x02,                   /*  bInterfaceSubClass */
68         0x01,                   /*  bInterfaceProtocol, linux requires value of 1 for the cdc_acm module */
69         0x00,                   /*  iInterface */
70
71         /* Header functional descriptor */
72         0x05,
73         CS_INTERFACE,
74         0x00,                   /*  bDescriptor SubType Header */
75         LE_WORD(0x0110),        /*  CDC version 1.1 */
76
77         /* Call management functional descriptor */
78         0x05,
79         CS_INTERFACE,
80         0x01,                   /* bDescriptor SubType Call Management */
81         0x01,                   /* bmCapabilities = device handles call management */
82         0x01,                   /* bDataInterface call management interface number */
83
84         /* ACM functional descriptor */
85         0x04,
86         CS_INTERFACE,
87         0x02,                   /* bDescriptor SubType Abstract Control Management */
88         0x02,                   /* bmCapabilities = D1 (Set_line_Coding, Set_Control_Line_State, Get_Line_Coding and Serial_State) */
89
90         /* Union functional descriptor */
91         0x05,
92         CS_INTERFACE,
93         0x06,                   /* bDescriptor SubType Union Functional descriptor */
94         0x00,                   /* bMasterInterface */
95         0x01,                   /* bSlaveInterface0 */
96
97         /* Notification EP */
98         0x07,
99         AO_USB_DESC_ENDPOINT,
100         AO_USB_INT_EP|0x80,     /* bEndpointAddress */
101         0x03,                   /* bmAttributes = intr */
102         LE_WORD(8),             /* wMaxPacketSize */
103         0x0A,                   /* bInterval */
104
105         /* Data class interface descriptor */
106         0x09,
107         AO_USB_DESC_INTERFACE,
108         0x01,                   /* bInterfaceNumber */
109         0x00,                   /* bAlternateSetting */
110         0x02,                   /* bNumEndPoints */
111         0x0A,                   /* bInterfaceClass = data */
112         0x00,                   /* bInterfaceSubClass */
113         0x00,                   /* bInterfaceProtocol */
114         0x00,                   /* iInterface */
115
116         /* Data EP OUT */
117         0x07,
118         AO_USB_DESC_ENDPOINT,
119         AO_USB_OUT_EP,          /* bEndpointAddress */
120         0x02,                   /* bmAttributes = bulk */
121         LE_WORD(AO_USB_OUT_SIZE),/* wMaxPacketSize */
122         0x00,                   /* bInterval */
123
124         /* Data EP in */
125         0x07,
126         AO_USB_DESC_ENDPOINT,
127         AO_USB_IN_EP|0x80,      /* bEndpointAddress */
128         0x02,                   /* bmAttributes = bulk */
129         LE_WORD(AO_USB_IN_SIZE),/* wMaxPacketSize */
130         0x00,                   /* bInterval */
131
132         /* String descriptors */
133         0x04,
134         AO_USB_DESC_STRING,
135         LE_WORD(0x0409),
136
137         /* iManufacturer */
138         AO_iManufacturer_LEN,
139         AO_USB_DESC_STRING,
140         AO_iManufacturer_UCS2,
141
142         /* iProduct */
143         AO_iProduct_LEN,
144         AO_USB_DESC_STRING,
145         AO_iProduct_UCS2,
146
147         /* iSerial */
148         AO_iSerial_LEN,
149         AO_USB_DESC_STRING,
150         AO_iSerial_UCS2,
151
152         /* Terminating zero */
153         0
154 };
155 #endif