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