]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/descriptors.h
Roll up the minor changes checked into svn since V10.0.0 into new V10.0.1 ready for...
[freertos] / FreeRTOS / Demo / lwIP_Demo_Rowley_ARM7 / USB / descriptors.h
1 /*\r
2  * FreeRTOS Kernel V10.0.1\r
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  *\r
22  * http://www.FreeRTOS.org\r
23  * http://aws.amazon.com/freertos\r
24  *\r
25  * 1 tab == 4 spaces!\r
26  */\r
27 \r
28 /*\r
29         - DESCRIPTOR DEFINITIONS -\r
30 */\r
31 \r
32 /* String descriptors used during the enumeration process.\r
33 These take the form:\r
34 \r
35 {\r
36         Length of descriptor,\r
37         Descriptor type,\r
38         Data\r
39 }\r
40 */\r
41 \r
42 const char pxLanguageStringDescriptor[] =\r
43 {\r
44         4,\r
45         usbDESCRIPTOR_TYPE_STRING,\r
46         0x09, 0x04\r
47 };\r
48 \r
49 const char pxManufacturerStringDescriptor[] = \r
50 {\r
51         18,\r
52         usbDESCRIPTOR_TYPE_STRING,\r
53 \r
54         'F', 0x00, 'r', 0x00, 'e', 0x00, 'e', 0x00, 'R', 0x00, 'T', 0x00, 'O', 0x00, 'S', 0x00\r
55 };\r
56 \r
57 const char pxProductStringDescriptor[] = \r
58 {\r
59         36,\r
60         usbDESCRIPTOR_TYPE_STRING,\r
61 \r
62         'F', 0x00, 'r', 0x00, 'e', 0x00, 'e', 0x00, 'R', 0x00, 'T', 0x00, 'O', 0x00, 'S', 0x00, ' ', 0x00, 'C', 0x00, 'D', 0x00,\r
63         'C', 0x00, ' ', 0x00, 'D', 0x00, 'E', 0x00, 'M', 0x00, 'O', 0x00\r
64 };\r
65 \r
66 const char pxConfigurationStringDescriptor[] = \r
67 {\r
68         38,\r
69         usbDESCRIPTOR_TYPE_STRING,\r
70 \r
71         'C', 0x00, 'o', 0x00, 'n', 0x00, 'f', 0x00, 'i', 0x00, 'g', 0x00, 'u', 0x00, 'r', 0x00, 'a', 0x00, 't', 0x00, 'i', 0x00,\r
72         'o', 0x00, 'n', 0x00, ' ', 0x00, 'N', 0x00, 'a', 0x00, 'm', 0x00, 'e', 0x00\r
73 };\r
74 \r
75 const char pxInterfaceStringDescriptor[] = \r
76 {\r
77         30,\r
78         usbDESCRIPTOR_TYPE_STRING,\r
79 \r
80         'I', 0x00, 'n', 0x00, 't', 0x00, 'e', 0x00, 'r', 0x00, 'f', 0x00, 'a', 0x00, 'c', 0x00, 'e', 0x00, ' ', 0x00, 'N', 0x00,\r
81         'a', 0x00, 'm', 0x00, 'e', 0x00\r
82 };\r
83 \r
84 /* Device should properly be 0x134A:0x9001, using 0x05F9:0xFFFF for Linux testing */\r
85 const char pxDeviceDescriptor[] = \r
86 {\r
87         /* Device descriptor */\r
88         0x12,                                                           /* bLength                              */\r
89         0x01,                                                           /* bDescriptorType              */\r
90         0x10, 0x01,                                                     /* bcdUSBL                              */\r
91         0x02,                                                           /* bDeviceClass:                */\r
92         0x00,                                                           /* bDeviceSubclass:             */\r
93         0x00,                                                           /* bDeviceProtocol:             */\r
94         0x08,                                                           /* bMaxPacketSize0              */\r
95         0x03, 0xEB,                                                     /* idVendorL                    */\r
96         0x20, 0x09,                                                     /* idProductL                   */\r
97         0x10, 0x01,                                                     /* bcdDeviceL                   */\r
98         usbMANUFACTURER_STRING,                         /* iManufacturer                */\r
99         usbPRODUCT_STRING,                                      /* iProduct                             */\r
100         0x00,                                                           /* SerialNumber                 */\r
101         0x01                                                            /* bNumConfigs                  */\r
102 };\r
103 \r
104 const char pxConfigDescriptor[] = {\r
105 \r
106         /* Configuration 1 descriptor\r
107         Here we define two interfaces (0 and 1) and a total of 3 endpoints.\r
108         Interface 0 is a CDC Abstract Control Model interface with one interrupt-in endpoint.\r
109         Interface 1 is a CDC Data Interface class, with a bulk-in and bulk-out endpoint.\r
110         Endpoint 0 gets used as the CDC management element.\r
111         */\r
112         0x09,                           /* CbLength                                                             */\r
113         0x02,                           /* CbDescriptorType                                             */\r
114         0x43, 0x00,                     /* CwTotalLength 2 EP + Control         ?       */\r
115         0x02,                           /* CbNumInterfaces                                              */\r
116         0x01,                           /* CbConfigurationValue                                 */\r
117         usbCONFIGURATION_STRING,/* CiConfiguration                                      */\r
118         usbBUS_POWERED,         /* CbmAttributes Bus powered + Remote Wakeup*/\r
119         0x32,                           /* CMaxPower: 100mA                                             */\r
120 \r
121         /* Communication Class Interface Descriptor Requirement         */\r
122         0x09,                           /* bLength                                                              */\r
123         0x04,                           /* bDescriptorType                                              */\r
124         0x00,                           /* bInterfaceNumber                                             */\r
125         0x00,                           /* bAlternateSetting                                    */\r
126         0x01,                           /* bNumEndpoints                                                */\r
127         0x02,                           /* bInterfaceClass: Comm Interface Class */\r
128         0x02,                           /* bInterfaceSubclass: Abstract Control Model*/\r
129         0x00,                           /* bInterfaceProtocol                                   */\r
130         usbINTERFACE_STRING,/* iInterface                                                       */\r
131 \r
132         /* Header Functional Descriptor                                                         */\r
133         0x05,                           /* bLength                                                              */\r
134         0x24,                           /* bDescriptor type: CS_INTERFACE               */\r
135         0x00,                           /* bDescriptor subtype: Header Func Desc*/\r
136         0x10, 0x01,                     /* bcdCDC:1.1                                                   */\r
137 \r
138         /* ACM Functional Descriptor                                                            */\r
139         0x04,                           /* bFunctionLength                                              */\r
140         0x24,                           /* bDescriptor type: CS_INTERFACE               */\r
141         0x02,                           /* bDescriptor subtype: ACM Func Desc   */\r
142         0x00,                           /* bmCapabilities: We don't support squat*/\r
143 \r
144         /* Union Functional Descriptor                                                          */\r
145         0x05,                           /* bFunctionLength                                              */\r
146         0x24,                           /* bDescriptor type: CS_INTERFACE               */\r
147         0x06,                           /* bDescriptor subtype: Union Func Desc */\r
148         0x00,                           /* bMasterInterface: CDC Interface              */\r
149         0x01,                           /* bSlaveInterface0: Data Class Interface*/\r
150 \r
151         /* Call Management Functional Descriptor\r
152         0 in D1 and D0 indicates that device does not handle call management*/\r
153         0x05,                           /* bFunctionLength                                              */\r
154         0x24,                           /* bDescriptor type: CS_INTERFACE               */\r
155         0x01,                           /* bDescriptor subtype: Call Management Func*/\r
156         0x01,                           /* bmCapabilities: D1 + D0                              */\r
157         0x01,                           /* bDataInterface: Data Class Interface 1*/\r
158 \r
159         /* CDC Control - Endpoint 3 descriptor\r
160         This endpoint serves as a notification element.                         */\r
161 \r
162         0x07,                           /* bLength                                                              */\r
163         0x05,                           /* bDescriptorType                                              */\r
164         0x83,                           /* bEndpointAddress, Endpoint 03 - IN   */\r
165         0x03,                           /* bmAttributes   INT                                   */\r
166         0x08, 0x00,                     /* wMaxPacketSize: 8 bytes                              */\r
167         0xFF,                           /* bInterval                                                    */\r
168 \r
169         /* Data Class Interface Descriptor Requirement                          */\r
170         0x09,                           /* bLength                                                              */\r
171         0x04,                           /* bDescriptorType                                              */\r
172         0x01,                           /* bInterfaceNumber                                             */\r
173         0x00,                           /* bAlternateSetting                                    */\r
174         0x02,                           /* bNumEndPoints                                                */\r
175         0x0A,                           /* bInterfaceClass                                              */\r
176         0x00,                           /* bInterfaceSubclass                                   */\r
177         0x00,                           /* bInterfaceProtocol                                   */\r
178         0x00,                           /* iInterface                                                   */\r
179 \r
180         /* CDC Data - Endpoint 1 descriptor */\r
181         0x07,                           /* bLenght                                                              */\r
182         0x05,                           /* bDescriptorType                                              */\r
183         0x01,                           /* bEndPointAddress, Endpoint 01 - OUT  */\r
184         0x02,                           /* bmAttributes BULK                                    */\r
185         64,                                     /* wMaxPacketSize                                               */\r
186         0x00,\r
187         0x00,                           /* bInterval                                                    */\r
188 \r
189         /* CDC Data - Endpoint 2 descriptor */\r
190         0x07,                           /* bLength                                                              */\r
191         0x05,                           /* bDescriptorType                                              */\r
192         0x82,                           /* bEndPointAddress, Endpoint 02 - IN   */\r
193         0x02,                           /* bmAttributes BULK                                    */\r
194         64,                                     /* wMaxPacketSize                                               */\r
195         0x00,\r
196         0x00                            /* bInterval                                                    */\r
197 };\r
198 \r