| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dfuutil_programming_dfu_usbdesc.c
Go to the documentation of this file.
1 /*
2 * @brief DFU Utility USB descriptors
3 *
4 * @note
5 * Copyright(C) NXP Semiconductors, 2012
6 * All rights reserved.
7 *
8 * @par
9 * Software that is described herein is for illustrative purposes only
10 * which provides customers with programming information regarding the
11 * LPC products. This software is supplied "AS IS" without any warranties of
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
13 * all warranties, express or implied, including all implied warranties of
14 * merchantability, fitness for a particular purpose and non-infringement of
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
16 * or liability for the use of the software, conveys no license or rights under any
17 * patent, copyright, mask work right, or any other intellectual property rights in
18 * or to any products. NXP Semiconductors reserves the right to make changes
19 * in the software without notification. NXP Semiconductors also makes no
20 * representation or warranty that such application will be suitable for the
21 * specified use without further testing or modification.
22 *
23 * @par
24 * Permission to use, copy, modify, and distribute this software and its
25 * documentation is hereby granted, under NXP Semiconductors' and its
26 * licensor's relevant copyrights in the software, without fee, provided that it
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
28 * copyright, permission, and disclaimer notice must appear in all copies of
29 * this code.
30 */
31
32 #include "board.h"
33 #include "app_usbd_cfg.h"
34 #include "usbd_desc.h"
35 #include "usbd.h"
36 #include "usbd_core.h"
37 #include "usbd_msc.h"
38 #include "usbd_dfu.h"
39
40 /*****************************************************************************
41 * Private types/enumerations/variables
42 ****************************************************************************/
43
44 /*****************************************************************************
45 * Public types/enumerations/variables
46 ****************************************************************************/
47
51 ALIGNED(4) uint8_t USB_DeviceDescriptor[] = {
52 USB_DEVICE_DESC_SIZE, /* bLength */
53 USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
54 WBVAL(0x0200), /* 2.00 */ /* bcdUSB */
55 0x00, /* bDeviceClass */
56 0x00, /* bDeviceSubClass */
57 0x00, /* bDeviceProtocol */
58 USB_MAX_PACKET0, /* bMaxPacketSize0 */
59 WBVAL(0x1FC9), /* idVendor */
60 WBVAL(0x000C), /* idProduct */
61 WBVAL(0x0100), /* 1.00 */ /* bcdDevice */
62 0x01, /* iManufacturer */
63 0x02, /* iProduct */
64 0x03, /* iSerialNumber */
65 0x01 /* bNumConfigurations */
66 };
67
72 ALIGNED(4) uint8_t USB_FsConfigDescriptor[] = {
73 /* Configuration 1 */
74 USB_CONFIGUARTION_DESC_SIZE, /* bLength */
75 USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
76 WBVAL( /* wTotalLength */
77 1 * USB_CONFIGUARTION_DESC_SIZE +
78 1 * USB_INTERFACE_DESC_SIZE +
79 DFU_FUNC_DESC_SIZE
80 ),
81 0x01, /* bNumInterfaces */
82 0x01, /* bConfigurationValue */
83 0x00, /* iConfiguration */
84 USB_CONFIG_SELF_POWERED, /* bmAttributes */
85 USB_CONFIG_POWER_MA(100), /* bMaxPower */
86 /* Interface 0, Alternate Setting 0, DFU Class */
87 USB_INTERFACE_DESC_SIZE, /* bLength */
88 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
89 0x00, /* bInterfaceNumber */
90 0x00, /* bAlternateSetting */
91 0x00, /* bNumEndpoints */
92 USB_DEVICE_CLASS_APP, /* bInterfaceClass */
93 USB_DFU_SUBCLASS, /* bInterfaceSubClass */
94 0x01, /* bInterfaceProtocol */
95 0x04, /* iInterface */
96 /* DFU RunTime/DFU Mode Functional Descriptor */
97 DFU_FUNC_DESC_SIZE, /* bLength */
98 USB_DFU_DESCRIPTOR_TYPE, /* bDescriptorType */
99 USB_DFU_CAN_DOWNLOAD | USB_DFU_CAN_UPLOAD | USB_DFU_MANIFEST_TOL, // | USB_DFU_WILL_DETACH, /* bmAttributes */
100 WBVAL(0xFF00), /* wDetachTimeout */
101 WBVAL(USB_DFU_XFER_SIZE), /* wTransferSize */
102 WBVAL(0x100), /* bcdDFUVersion */
103 /* Terminator */
104 0 /* bLength */
105 };
106
111 ALIGNED(4) uint8_t USB_HsConfigDescriptor[] = {
112 /* Configuration 1 */
113 USB_CONFIGUARTION_DESC_SIZE, /* bLength */
114 USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
115 WBVAL( /* wTotalLength */
116 1 * USB_CONFIGUARTION_DESC_SIZE +
117 1 * USB_INTERFACE_DESC_SIZE +
118 DFU_FUNC_DESC_SIZE
119 ),
120 0x01, /* bNumInterfaces */
121 0x01, /* bConfigurationValue */
122 0x00, /* iConfiguration */
123 USB_CONFIG_SELF_POWERED, /* bmAttributes */
124 USB_CONFIG_POWER_MA(100), /* bMaxPower */
125 /* Interface 0, Alternate Setting 0, DFU Class */
126 USB_INTERFACE_DESC_SIZE, /* bLength */
127 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
128 0x00, /* bInterfaceNumber */
129 0x00, /* bAlternateSetting */
130 0x00, /* bNumEndpoints */
131 USB_DEVICE_CLASS_APP, /* bInterfaceClass */
132 USB_DFU_SUBCLASS, /* bInterfaceSubClass */
133 0x01, /* bInterfaceProtocol */
134 0x04, /* iInterface */
135 /* DFU RunTime/DFU Mode Functional Descriptor */
136 DFU_FUNC_DESC_SIZE, /* bLength */
137 USB_DFU_DESCRIPTOR_TYPE, /* bDescriptorType */
138 USB_DFU_CAN_DOWNLOAD | USB_DFU_CAN_UPLOAD | USB_DFU_MANIFEST_TOL, // | USB_DFU_WILL_DETACH, /* bmAttributes */
139 WBVAL(0xFF00), /* wDetachTimeout */
140 WBVAL(USB_DFU_XFER_SIZE), /* wTransferSize */
141 WBVAL(0x100), /* bcdDFUVersion */
142 /* Terminator */
143 0 /* bLength */
144 };
145
149 ALIGNED(4) uint8_t USB_StringDescriptor[] = {
150 /* Index 0x00: LANGID Codes */
151 0x04, /* bLength */
152 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
153 WBVAL(0x0409), /* US English */ /* wLANGID */
154 /* Index 0x01: Manufacturer */
155 (3 * 2 + 2), /* bLength (13 Char + Type + lenght) */
156 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
157 'N', 0,
158 'X', 0,
159 'P', 0,
160 /* Index 0x02: Product */
161 (3 * 2 + 2), /* bLength (13 Char + Type + lenght) */
162 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
163 'L', 0,
164 'P', 0,
165 'C', 0,
166 /* Index 0x03: Serial Number */
167 (4 * 2 + 2), /* bLength (13 Char + Type + lenght) */
168 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
169 '4', 0,
170 '3', 0,
171 '5', 0,
172 '0', 0,
173 /* Index 0x04: Interface 0, Alternate Setting 0 */
174 (3 * 2 + 2), /* bLength (3 Char + Type + lenght) */
175 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
176 'D', 0,
177 'F', 0,
178 'U', 0,
179 /* Index 0x05: Interface 1, Alternate Setting 0 */
180 };
181
185 ALIGNED(4) uint8_t USB_DeviceQualifier[] = {
186 USB_DEVICE_QUALI_SIZE, /* bLength */
187 USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE, /* bDescriptorType */
188 WBVAL(0x0200), /* 2.00 */ /* bcdUSB */
189 0x00, /* bDeviceClass */
190 0x00, /* bDeviceSubClass */
191 0x00, /* bDeviceProtocol */
192 USB_MAX_PACKET0, /* bMaxPacketSize0 */
193 0x01, /* bNumOtherSpeedConfigurations */
194 0x00 /* bReserved */
195 };
196
197 /*****************************************************************************
198 * Private functions
199 ****************************************************************************/
200
201 /*****************************************************************************
202 * Public functions
203 ****************************************************************************/