no-OS
maxim_usb_uart_descriptors.h
Go to the documentation of this file.
1 /***************************************************************************/
34 /* Define to prevent redundant inclusion */
35 #ifndef MAXIM_USB_CDCACM_DESCRIPTORS_H_
36 #define MAXIM_USB_CDCACM_DESCRIPTORS_H_
37 
38 /* **** Includes **** */
39 #include <stdint.h>
40 #include "usb.h"
41 #include "hid_kbd.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /* **** Definitions **** */
48 
49 MXC_USB_device_descriptor_t __attribute__((aligned(4))) device_descriptor = {
50  0x12, /* bLength = 18 */
51  0x01, /* bDescriptorType = Device */
52  0x0200, /* bcdUSB USB spec rev (BCD) */
53  0x02, /* bDeviceClass = comm class (2) */
54  0x00, /* bDeviceSubClass */
55  0x00, /* bDeviceProtocol */
56  0x40, /* bMaxPacketSize0 is 64 bytes */
57  0x0B6A, /* idVendor (Maxim Integrated) */
58  0x003C, /* idProduct */
59  0x0100, /* bcdDevice */
60  0x01, /* iManufacturer Descriptor ID */
61  0x02, /* iProduct Descriptor ID */
62  0x00, /* iSerialNumber = (0) No string */
63  0x01 /* bNumConfigurations */
64 };
65 
66 /* Device qualifier needed for high-speed operation */
67 MXC_USB_device_qualifier_descriptor_t __attribute__((aligned(
69  0x0A, /* bLength = 10 */
70  0x06, /* bDescriptorType = Device Qualifier */
71  0x0200, /* bcdUSB USB spec rev (BCD) */
72  0x02, /* bDeviceClass = Unspecified */
73  0x00, /* bDeviceSubClass */
74  0x00, /* bDeviceProtocol */
75  0x40, /* bMaxPacketSize0 is 64 bytes */
76  0x01, /* bNumConfigurations */
77  0x00 /* Reserved, must be 0 */
78 };
79 
80 __attribute__((aligned(4))) struct __attribute__((packed))
81 {
82  MXC_USB_configuration_descriptor_t config_descriptor;
83  /* Interface #1 CDCACM Device */
84  MXC_USB_interface_descriptor_t comm_interface_descriptor;
89  /* Interface #2 CDC Data*/
90  MXC_USB_endpoint_descriptor_t endpoint_descriptor_3;
91  MXC_USB_interface_descriptor_t data_interface_descriptor;
92  MXC_USB_endpoint_descriptor_t endpoint_descriptor_4;
93  MXC_USB_endpoint_descriptor_t endpoint_descriptor_5;
94 }
95 
97  {
98  0x09, /* bLength = 9 */
99  0x02, /* bDescriptorType = Config (2) */
100  0x0043, /* wTotalLength(L/H) */
101  0x02, /* bNumInterfaces */
102  0x01, /* bConfigValue */
103  0x02, /* iConfiguration */
104  0xE0, /* bmAttributes (self-powered, remote wakeup) */
105  0x01, /* MaxPower is 2ma (units are 2ma/bit) */
106  },
107  /********** Interface #1 : COMM Interface **********/
108  {
109  /* First Interface Descriptor For Comm Class Interface */
110  0x09, /* bLength = 9 */
111  0x04, /* bDescriptorType = Interface (4) */
112  0x00, /* bInterfaceNumber */
113  0x00, /* bAlternateSetting */
114  0x01, /* bNumEndpoints (one for OUT) */
115  0x02, /* bInterfaceClass = Communications Interface Class (2) */
116  0x02, /* bInterfaceSubClass = Abstract Control Model (2) */
117  0x01, /* bInterfaceProtocol = Common "AT" commands (1), no class specific protocol (0) */
118  0x04, /* iInterface */
119  },
120  {
121  /* Header Functional Descriptor */
122  0x05, /* bFunctionalLength = 5 */
123  0x24, /* bDescriptorType */
124  0x00, /* bDescriptorSubtype */
125  0x10, 0x01, /* bcdCDC */
126  },
127  {
128  /* Call Management Descriptor */
129  0x05, /* bFunctionalLength = 5 */
130  0x24, /* bDescriptorType */
131  0x01, /* bDescriptorSubtype */
132  0x03, /* bmCapabilities = Device handles call management itself (0x01), management over data class (0x02) */
133  0x01, /* bmDataInterface */
134  },
135  {
136  /* Abstract Control Management Functional Descriptor */
137  0x04, /* bFunctionalLength = 4 */
138  0x24, /* bDescriptorType */
139  0x02, /* bDescriptorSubtype */
140  0x02, /* bmCapabilities */
141  },
142  {
143  /* Union Functional Descriptor */
144  0x05, /* bFunctionalLength = 5 */
145  0x24, /* bDescriptorType */
146  0x06, /* bDescriptorSubtype */
147  0x00, /* bmMasterInterface */
148  0x01, /* bmSlaveInterface0 */
149  },
150  {
151  /* IN Endpoint 3 (Descriptor #1) */
152  0x07, /* bLength */
153  0x05, /* bDescriptorType (Endpoint) */
154  0x84, /* bEndpointAddress (EP3-IN) */
155  0x03, /* bmAttributes (interrupt) */
156  0x0040, /* wMaxPacketSize */
157  0xff, /* bInterval (milliseconds) */
158  },
159  {
160  /* Second Interface Descriptor For Data Interface */
161  0x09, /* bLength */
162  0x04, /* bDescriptorType (Interface) */
163  0x01, /* bInterfaceNumber */
164  0x00, /* bAlternateSetting */
165  0x02, /* bNumEndpoints */
166  0x0a, /* bInterfaceClass = Data Interface (10) */
167  0x00, /* bInterfaceSubClass = none (0) */
168  0x00, /* bInterfaceProtocol = No class specific protocol (0) */
169  0x04, /* biInterface = No Text String (0) */
170  },
171  {
172  /* OUT Endpoint 1 (Descriptor #2) */
173  0x07, /* bLength */
174  0x05, /* bDescriptorType (Endpoint) */
175  0x05, /* bEndpointAddress (EP1-OUT) */
176  0x02, /* bmAttributes (bulk) */
177  0x0040, /* wMaxPacketSize */
178  0x00, /* bInterval (N/A) */
179  },
180  {
181  /* IN Endpoint 2 (Descriptor #3) */
182  0x07, /* bLength */
183  0x05, /* bDescriptorType (Endpoint) */
184  0x83, /* bEndpointAddress (EP2-IN) */
185  0x02, /* bmAttributes (bulk) */
186  0x0040, /* wMaxPacketSize */
187  0x00 /* bInterval (N/A) */
188  }
189 };
190 
191 __attribute__((aligned(4))) struct __attribute__((packed))
192 {
193  MXC_USB_configuration_descriptor_t config_descriptor;
194  /* Interface #1 CDCACM Device */
195  MXC_USB_interface_descriptor_t comm_interface_descriptor;
196  uint8_t header_functional_descriptor[5];
197  uint8_t call_management_descriptor[5];
198  uint8_t acm_functional_descriptor[4];
199  uint8_t union_functional_descriptor[5];
200  MXC_USB_endpoint_descriptor_t endpoint_descriptor_3;
201  /* Interface #2 CDCACM Data */
202  MXC_USB_interface_descriptor_t data_interface_descriptor;
203  MXC_USB_endpoint_descriptor_t endpoint_descriptor_4;
204  MXC_USB_endpoint_descriptor_t endpoint_descriptor_5;
205 }
206 
208  {
209  0x09, /* bLength */
210  0x02, /* bDescriptorType = Config */
211  0x0043, /* wTotalLength(L/H) */
212  0x02, /* bNumInterfaces */
213  0x01, /* bConfigurationValue */
214  0x02, /* iConfiguration */
215  0xE0, /* bmAttributes (bus-powered, remote wakeup) */
216  0x32, /* MaxPower is 100ma (units are 2ma/bit) */
217  },
218  /********** Interface #1 : COMM Interface **********/
219  {
220  /* First Interface Descriptor For Comm Class Interface */
221  0x09, /* bLength = 9 */
222  0x04, /* bDescriptorType = Interface (4) */
223  0x00, /* bInterfaceNumber */
224  0x00, /* bAlternateSetting */
225  0x01, /* bNumEndpoints (one for OUT) */
226  0x02, /* bInterfaceClass = Communications Interface Class (2) */
227  0x02, /* bInterfaceSubClass = Abstract Control Model (2) */
228  0x01, /* bInterfaceProtocol = Common "AT" commands (1), no class specific protocol (0) */
229  0x04, /* iInterface */
230  },
231  {
232  /* Header Functional Descriptor */
233  0x05, /* bFunctionalLength = 5 */
234  0x24, /* bDescriptorType */
235  0x00, /* bDescriptorSubtype */
236  0x10, 0x01, /* bcdCDC */
237  },
238  {
239  /* Call Management Descriptor */
240  0x05, /* bFunctionalLength = 5 */
241  0x24, /* bDescriptorType */
242  0x01, /* bDescriptorSubtype */
243  0x03, /* bmCapabilities = Device handles call management itself (0x01), management over data class (0x02) */
244  0x01, /* bmDataInterface */
245  },
246  {
247  /* Abstract Control Management Functional Descriptor */
248  0x04, /* bFunctionalLength = 4 */
249  0x24, /* bDescriptorType */
250  0x02, /* bDescriptorSubtype */
251  0x02, /* bmCapabilities */
252  },
253  {
254  /* Union Functional Descriptor */
255  0x05, /* bFunctionalLength = 5 */
256  0x24, /* bDescriptorType */
257  0x06, /* bDescriptorSubtype */
258  0x00, /* bmMasterInterface */
259  0x01, /* bmSlaveInterface0 */
260  },
261  {
262  /* IN Endpoint 3 (Descriptor #1) */
263  0x07, /* bLength */
264  0x05, /* bDescriptorType (Endpoint) */
265  0x84, /* bEndpointAddress (EP3-IN) */
266  0x03, /* bmAttributes (interrupt) */
267  0x0200, /* wMaxPacketSize */
268  0xff, /* bInterval (milliseconds) */
269  },
270  {
271  /* Second Interface Descriptor For Data Interface */
272  0x09, /* bLength */
273  0x04, /* bDescriptorType (Interface) */
274  0x01, /* bInterfaceNumber */
275  0x00, /* bAlternateSetting */
276  0x02, /* bNumEndpoints */
277  0x0a, /* bInterfaceClass = Data Interface (10) */
278  0x00, /* bInterfaceSubClass = none (0) */
279  0x00, /* bInterfaceProtocol = No class specific protocol (0) */
280  0x04, /* biInterface = No Text String (0) */
281  },
282  {
283  /* OUT Endpoint 1 (Descriptor #2) */
284  0x07, /* bLength */
285  0x05, /* bDescriptorType (Endpoint) */
286  0x05, /* bEndpointAddress (EP1-OUT) */
287  0x02, /* bmAttributes (bulk) */
288  0x0200, /* wMaxPacketSize */
289  0x00, /* bInterval (N/A) */
290  },
291  {
292  /* IN Endpoint 2 (Descriptor #3) */
293  0x07, /* bLength */
294  0x05, /* bDescriptorType (Endpoint) */
295  0x83, /* bEndpointAddress (EP2-IN) */
296  0x02, /* bmAttributes (bulk) */
297  0x0200, /* wMaxPacketSize */
298  0x00, /* bInterval (N/A) */
299  },
300 };
301 
302 __attribute__((aligned(4))) uint8_t lang_id_desc[] = {
303  0x04, /* bLength */
304  0x03, /* bDescriptorType */
305  0x09, 0x04 /* bString = wLANGID (see usb_20.pdf 9.6.7 String) */
306 };
307 
308 __attribute__((aligned(4))) uint8_t mfg_id_desc[] = {
309  0x22, /* bLength */
310  0x03, /* bDescriptorType */
311  'M', 0, 'a', 0, 'x', 0, 'i', 0, 'm', 0, ' ', 0, 'I', 0, 'n', 0,
312  't', 0, 'e', 0, 'g', 0, 'r', 0, 'a', 0, 't', 0, 'e', 0, 'd', 0,
313 };
314 
315 __attribute__((aligned(4))) uint8_t prod_id_desc[] = {
316  0x22, /* bLength */
317  0x03, /* bDescriptorType */
318  'M', 0, 'A', 0, 'X', 0, '3', 0, '2', 0, '6', 0, '5', 0, '0', 0,
319  ' ', 0, 'C', 0, 'D', 0, 'C', 0, '-', 0, 'A', 0, 'C', 0, 'M', 0,
320 };
321 
322 /* Not currently used (see device descriptor), but could be enabled if desired */
323 __attribute__((aligned(4))) uint8_t serial_id_desc[] = { 0x14, /* bLength */
324  0x03, /* bDescriptorType */
325  '0', 0, '0', 0, '0', 0, '0', 0, '0', 0,
326  '0', 0, '0', 0, '0', 0, '1', 0
327  };
328 
329 __attribute__((aligned(4))) uint8_t cdcacm_func_desc[] = {
330  0x20, /* bLength */
331  0x03, /* bDescriptorType */
332  'M', 0, 'A', 0, 'X', 0, '3', 0, '2', 0, '6', 0, '5', 0, '0',
333  0, ' ', 0, 'C', 0, 'D', 0, 'C', 0, 'A', 0, 'C', 0, 'M', 0,
334 };
335 
336 #ifdef __cplusplus
337 }
338 #endif
339 
340 #endif // MAXIM_USB_CDCACM_DESCRIPTORS_H_
serial_id_desc
uint8_t serial_id_desc[]
Definition: maxim_usb_uart_descriptors.h:323
acm_functional_descriptor
uint8_t acm_functional_descriptor[4]
Definition: maxim_usb_uart_descriptors.h:87
cdcacm_func_desc
uint8_t cdcacm_func_desc[]
Definition: maxim_usb_uart_descriptors.h:329
mfg_id_desc
uint8_t mfg_id_desc[]
Definition: maxim_usb_uart_descriptors.h:308
prod_id_desc
uint8_t prod_id_desc[]
Definition: maxim_usb_uart_descriptors.h:315
endpoint_descriptor_3
MXC_USB_endpoint_descriptor_t endpoint_descriptor_3
Definition: maxim_usb_uart_descriptors.h:90
union_functional_descriptor
uint8_t union_functional_descriptor[5]
Definition: maxim_usb_uart_descriptors.h:88
call_management_descriptor
uint8_t call_management_descriptor[5]
Definition: maxim_usb_uart_descriptors.h:86
device_descriptor
MXC_USB_device_descriptor_t device_descriptor
Definition: maxim_usb_uart_descriptors.h:49
config_descriptor
MXC_USB_configuration_descriptor_t config_descriptor
Definition: maxim_usb_uart_descriptors.h:82
config_descriptor_hs
struct @13 config_descriptor_hs
data_interface_descriptor
MXC_USB_interface_descriptor_t data_interface_descriptor
Definition: maxim_usb_uart_descriptors.h:91
device_qualifier_descriptor
MXC_USB_device_qualifier_descriptor_t device_qualifier_descriptor
Definition: maxim_usb_uart_descriptors.h:68
endpoint_descriptor_5
MXC_USB_endpoint_descriptor_t endpoint_descriptor_5
Definition: maxim_usb_uart_descriptors.h:93
lang_id_desc
uint8_t lang_id_desc[]
Definition: maxim_usb_uart_descriptors.h:302
comm_interface_descriptor
MXC_USB_interface_descriptor_t comm_interface_descriptor
Definition: maxim_usb_uart_descriptors.h:84
header_functional_descriptor
uint8_t header_functional_descriptor[5]
Definition: maxim_usb_uart_descriptors.h:85
endpoint_descriptor_4
MXC_USB_endpoint_descriptor_t endpoint_descriptor_4
Definition: maxim_usb_uart_descriptors.h:92