|
@@ -1,302 +0,0 @@
|
1
|
|
-/**
|
2
|
|
- * \file
|
3
|
|
- *
|
4
|
|
- * \brief USB configuration file
|
5
|
|
- *
|
6
|
|
- * Copyright (c) 2011-2015 Atmel Corporation. All rights reserved.
|
7
|
|
- *
|
8
|
|
- * \asf_license_start
|
9
|
|
- *
|
10
|
|
- * \page License
|
11
|
|
- *
|
12
|
|
- * Redistribution and use in source and binary forms, with or without
|
13
|
|
- * modification, are permitted provided that the following conditions are met:
|
14
|
|
- *
|
15
|
|
- * 1. Redistributions of source code must retain the above copyright notice,
|
16
|
|
- * this list of conditions and the following disclaimer.
|
17
|
|
- *
|
18
|
|
- * 2. Redistributions in binary form must reproduce the above copyright notice,
|
19
|
|
- * this list of conditions and the following disclaimer in the documentation
|
20
|
|
- * and/or other materials provided with the distribution.
|
21
|
|
- *
|
22
|
|
- * 3. The name of Atmel may not be used to endorse or promote products derived
|
23
|
|
- * from this software without specific prior written permission.
|
24
|
|
- *
|
25
|
|
- * 4. This software may only be redistributed and used in connection with an
|
26
|
|
- * Atmel microcontroller product.
|
27
|
|
- *
|
28
|
|
- * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
29
|
|
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
30
|
|
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
31
|
|
- * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
|
32
|
|
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
33
|
|
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
34
|
|
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
35
|
|
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
36
|
|
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
37
|
|
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
38
|
|
- * POSSIBILITY OF SUCH DAMAGE.
|
39
|
|
- *
|
40
|
|
- * \asf_license_stop
|
41
|
|
- *
|
42
|
|
- */
|
43
|
|
-/*
|
44
|
|
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
|
45
|
|
- */
|
46
|
|
-
|
47
|
|
-#ifndef _CONF_USB_H_
|
48
|
|
-#define _CONF_USB_H_
|
49
|
|
-
|
50
|
|
-#undef UNUSED /* To avoid a macro clash as macros.h already defines it */
|
51
|
|
-#include "../../../core/macros.h" /* For ENABLED()/DISABLED() */
|
52
|
|
-#include "../../../../Configuration.h" /* For CUSTOM_MACHINE_NAME definition - We just need the name, no C++ allowed! */
|
53
|
|
-#include "compiler.h"
|
54
|
|
-
|
55
|
|
-
|
56
|
|
-/**
|
57
|
|
- * USB Device Configuration
|
58
|
|
- * @{
|
59
|
|
- */
|
60
|
|
-
|
61
|
|
-//! Device definition (mandatory)
|
62
|
|
-#define USB_DEVICE_VENDOR_ID 0x03EB /* ATMEL VID */
|
63
|
|
-#define USB_DEVICE_PRODUCT_ID 0x2424 /* MSC / CDC */
|
64
|
|
-#define USB_DEVICE_MAJOR_VERSION 1
|
65
|
|
-#define USB_DEVICE_MINOR_VERSION 0
|
66
|
|
-#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA)
|
67
|
|
-#define USB_DEVICE_ATTR \
|
68
|
|
- (USB_CONFIG_ATTR_SELF_POWERED)
|
69
|
|
-// (USB_CONFIG_ATTR_BUS_POWERED)
|
70
|
|
-// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED)
|
71
|
|
-// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED)
|
72
|
|
-
|
73
|
|
-//! USB Device string definitions (Optional)
|
74
|
|
-#define USB_DEVICE_MANUFACTURE_NAME "marlinfw.org"
|
75
|
|
-#ifdef CUSTOM_MACHINE_NAME
|
76
|
|
- #define USB_DEVICE_PRODUCT_NAME CUSTOM_MACHINE_NAME
|
77
|
|
-#else
|
78
|
|
- #define USB_DEVICE_PRODUCT_NAME "3D Printer"
|
79
|
|
-#endif
|
80
|
|
-#define USB_DEVICE_SERIAL_NAME "123985739853"
|
81
|
|
-
|
82
|
|
-/**
|
83
|
|
- * Device speeds support
|
84
|
|
- * Low speed not supported by CDC and MSC
|
85
|
|
- * @{
|
86
|
|
- */
|
87
|
|
-
|
88
|
|
-//! To define a Low speed device
|
89
|
|
-//#define USB_DEVICE_LOW_SPEED
|
90
|
|
-
|
91
|
|
-//! To define a Full speed device
|
92
|
|
-//#define USB_DEVICE_FULL_SPEED
|
93
|
|
-
|
94
|
|
-
|
95
|
|
-//! To authorize the High speed
|
96
|
|
-#ifndef USB_DEVICE_FULL_SPEED
|
97
|
|
- #if (UC3A3||UC3A4)
|
98
|
|
- //# define USB_DEVICE_HS_SUPPORT
|
99
|
|
- #elif (SAM3XA||SAM3U)
|
100
|
|
- //# define USB_DEVICE_HS_SUPPORT
|
101
|
|
- #endif
|
102
|
|
-#endif
|
103
|
|
-//@}
|
104
|
|
-
|
105
|
|
-
|
106
|
|
-/**
|
107
|
|
- * USB Device Callbacks definitions (Optional)
|
108
|
|
- * @{
|
109
|
|
- */
|
110
|
|
-#define UDC_VBUS_EVENT(b_vbus_high)
|
111
|
|
-#define UDC_SOF_EVENT()
|
112
|
|
-#define UDC_SUSPEND_EVENT()
|
113
|
|
-#define UDC_RESUME_EVENT()
|
114
|
|
-#define UDC_GET_EXTRA_STRING() usb_task_extra_string()
|
115
|
|
-#define USB_DEVICE_SPECIFIC_REQUEST() usb_task_other_requests()
|
116
|
|
-//@}
|
117
|
|
-
|
118
|
|
-/**
|
119
|
|
- * USB Device low level configuration
|
120
|
|
- * When only one interface is used, these configurations are defined by the class module.
|
121
|
|
- * For composite device, these configuration must be defined here
|
122
|
|
- * @{
|
123
|
|
- */
|
124
|
|
-//! Control endpoint size
|
125
|
|
-#define USB_DEVICE_EP_CTRL_SIZE 64
|
126
|
|
-
|
127
|
|
-//! Two interfaces for this device (CDC COM + CDC DATA + MSC)
|
128
|
|
-#define USB_DEVICE_NB_INTERFACE 3
|
129
|
|
-
|
130
|
|
-//! 5 endpoints used by CDC and MSC interfaces
|
131
|
|
-#if SAM3U
|
132
|
|
-// (3 | USB_EP_DIR_IN) // CDC Notify endpoint
|
133
|
|
-// (6 | USB_EP_DIR_IN) // CDC TX
|
134
|
|
-// (5 | USB_EP_DIR_OUT) // CDC RX
|
135
|
|
-// (1 | USB_EP_DIR_IN) // MSC IN
|
136
|
|
-// (2 | USB_EP_DIR_OUT) // MSC OUT
|
137
|
|
-# define USB_DEVICE_MAX_EP 6
|
138
|
|
-# if defined(USB_DEVICE_HS_SUPPORT)
|
139
|
|
-// In HS mode, size of bulk endpoints are 512
|
140
|
|
-// If CDC and MSC endpoints all uses 2 banks, DPRAM is not enough: 4 bulk
|
141
|
|
-// endpoints requires 4K bytes. So reduce the number of banks of CDC bulk
|
142
|
|
-// endpoints to use less DPRAM. Keep MSC setting to keep MSC performance.
|
143
|
|
-# define UDD_BULK_NB_BANK(ep) ((ep == 5 || ep== 6) ? 1 : 2)
|
144
|
|
-#endif
|
145
|
|
-#else
|
146
|
|
-// (3 | USB_EP_DIR_IN) // CDC Notify endpoint
|
147
|
|
-// (4 | USB_EP_DIR_IN) // CDC TX
|
148
|
|
-// (5 | USB_EP_DIR_OUT) // CDC RX
|
149
|
|
-// (1 | USB_EP_DIR_IN) // MSC IN
|
150
|
|
-// (2 | USB_EP_DIR_OUT) // MSC OUT
|
151
|
|
-# define USB_DEVICE_MAX_EP 5
|
152
|
|
-# if SAM3XA && defined(USB_DEVICE_HS_SUPPORT)
|
153
|
|
-// In HS mode, size of bulk endpoints are 512
|
154
|
|
-// If CDC and MSC endpoints all uses 2 banks, DPRAM is not enough: 4 bulk
|
155
|
|
-// endpoints requires 4K bytes. So reduce the number of banks of CDC bulk
|
156
|
|
-// endpoints to use less DPRAM. Keep MSC setting to keep MSC performance.
|
157
|
|
-# define UDD_BULK_NB_BANK(ep) ((ep == 4 || ep== 5) ? 1 : 2)
|
158
|
|
-# endif
|
159
|
|
-#endif
|
160
|
|
-//@}
|
161
|
|
-
|
162
|
|
-//@}
|
163
|
|
-
|
164
|
|
-
|
165
|
|
-/**
|
166
|
|
- * USB Interface Configuration
|
167
|
|
- * @{
|
168
|
|
- */
|
169
|
|
-/**
|
170
|
|
- * Configuration of CDC interface
|
171
|
|
- * @{
|
172
|
|
- */
|
173
|
|
-
|
174
|
|
-//! Define one USB communication ports
|
175
|
|
-#define UDI_CDC_PORT_NB 1
|
176
|
|
-
|
177
|
|
-//! Interface callback definition
|
178
|
|
-#define UDI_CDC_ENABLE_EXT(port) usb_task_cdc_enable(port)
|
179
|
|
-#define UDI_CDC_DISABLE_EXT(port) usb_task_cdc_disable(port)
|
180
|
|
-#define UDI_CDC_RX_NOTIFY(port) usb_task_cdc_rx_notify(port)
|
181
|
|
-#define UDI_CDC_TX_EMPTY_NOTIFY(port)
|
182
|
|
-#define UDI_CDC_SET_CODING_EXT(port,cfg) usb_task_cdc_config(port,cfg)
|
183
|
|
-#define UDI_CDC_SET_DTR_EXT(port,set) usb_task_cdc_set_dtr(port,set)
|
184
|
|
-#define UDI_CDC_SET_RTS_EXT(port,set)
|
185
|
|
-
|
186
|
|
-//! Define it when the transfer CDC Device to Host is a low rate (<512000 bauds)
|
187
|
|
-//! to reduce CDC buffers size
|
188
|
|
-//#define UDI_CDC_LOW_RATE
|
189
|
|
-
|
190
|
|
-//! Default configuration of communication port
|
191
|
|
-#define UDI_CDC_DEFAULT_RATE 115200
|
192
|
|
-#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1
|
193
|
|
-#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE
|
194
|
|
-#define UDI_CDC_DEFAULT_DATABITS 8
|
195
|
|
-
|
196
|
|
-//! Enable id string of interface to add an extra USB string
|
197
|
|
-#define UDI_CDC_IAD_STRING_ID 4
|
198
|
|
-
|
199
|
|
-/**
|
200
|
|
- * USB CDC low level configuration
|
201
|
|
- * In standalone these configurations are defined by the CDC module.
|
202
|
|
- * For composite device, these configuration must be defined here
|
203
|
|
- * @{
|
204
|
|
- */
|
205
|
|
-//! Endpoint numbers definition
|
206
|
|
-#if SAM3U
|
207
|
|
-# define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint
|
208
|
|
-# define UDI_CDC_DATA_EP_IN_0 (6 | USB_EP_DIR_IN) // TX
|
209
|
|
-# define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT)// RX
|
210
|
|
-#else
|
211
|
|
-# define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint
|
212
|
|
-# define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX
|
213
|
|
-# define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT)// RX
|
214
|
|
-#endif
|
215
|
|
-
|
216
|
|
-//! Interface numbers
|
217
|
|
-#define UDI_CDC_COMM_IFACE_NUMBER_0 0
|
218
|
|
-#define UDI_CDC_DATA_IFACE_NUMBER_0 1
|
219
|
|
-//@}
|
220
|
|
-//@}
|
221
|
|
-
|
222
|
|
-
|
223
|
|
-/**
|
224
|
|
- * Configuration of MSC interface
|
225
|
|
- * @{
|
226
|
|
- */
|
227
|
|
-//! Vendor name and Product version of MSC interface
|
228
|
|
-#define UDI_MSC_GLOBAL_VENDOR_ID \
|
229
|
|
- 'M', 'A', 'R', 'L', 'I', 'N', '3', 'D'
|
230
|
|
-#define UDI_MSC_GLOBAL_PRODUCT_VERSION \
|
231
|
|
- '1', '.', '0', '0'
|
232
|
|
-
|
233
|
|
-//! Interface callback definition
|
234
|
|
-#define UDI_MSC_ENABLE_EXT() usb_task_msc_enable()
|
235
|
|
-#define UDI_MSC_DISABLE_EXT() usb_task_msc_disable()
|
236
|
|
-
|
237
|
|
-//! Enable id string of interface to add an extra USB string
|
238
|
|
-#define UDI_MSC_STRING_ID 5
|
239
|
|
-
|
240
|
|
-/**
|
241
|
|
- * USB MSC low level configuration
|
242
|
|
- * In standalone these configurations are defined by the MSC module.
|
243
|
|
- * For composite device, these configuration must be defined here
|
244
|
|
- * @{
|
245
|
|
- */
|
246
|
|
-//! Endpoint numbers definition
|
247
|
|
-#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN)
|
248
|
|
-#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT)
|
249
|
|
-
|
250
|
|
-//! Interface number
|
251
|
|
-#define UDI_MSC_IFACE_NUMBER 2
|
252
|
|
-//@}
|
253
|
|
-//@}
|
254
|
|
-
|
255
|
|
-//@}
|
256
|
|
-
|
257
|
|
-
|
258
|
|
-/**
|
259
|
|
- * Description of Composite Device
|
260
|
|
- * @{
|
261
|
|
- */
|
262
|
|
-//! USB Interfaces descriptor structure
|
263
|
|
-#define UDI_COMPOSITE_DESC_T \
|
264
|
|
- usb_iad_desc_t udi_cdc_iad; \
|
265
|
|
- udi_cdc_comm_desc_t udi_cdc_comm; \
|
266
|
|
- udi_cdc_data_desc_t udi_cdc_data; \
|
267
|
|
- udi_msc_desc_t udi_msc
|
268
|
|
-
|
269
|
|
-//! USB Interfaces descriptor value for Full Speed
|
270
|
|
-#define UDI_COMPOSITE_DESC_FS \
|
271
|
|
- .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \
|
272
|
|
- .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \
|
273
|
|
- .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \
|
274
|
|
- .udi_msc = UDI_MSC_DESC_FS
|
275
|
|
-
|
276
|
|
-//! USB Interfaces descriptor value for High Speed
|
277
|
|
-#define UDI_COMPOSITE_DESC_HS \
|
278
|
|
- .udi_cdc_iad = UDI_CDC_IAD_DESC_0, \
|
279
|
|
- .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \
|
280
|
|
- .udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \
|
281
|
|
- .udi_msc = UDI_MSC_DESC_HS
|
282
|
|
-
|
283
|
|
-//! USB Interface APIs
|
284
|
|
-#define UDI_COMPOSITE_API \
|
285
|
|
- &udi_api_cdc_comm, \
|
286
|
|
- &udi_api_cdc_data, \
|
287
|
|
- &udi_api_msc
|
288
|
|
-//@}
|
289
|
|
-
|
290
|
|
-
|
291
|
|
-/**
|
292
|
|
- * USB Device Driver Configuration
|
293
|
|
- * @{
|
294
|
|
- */
|
295
|
|
-//@}
|
296
|
|
-
|
297
|
|
-//! The includes of classes and other headers must be done at the end of this file to avoid compile error
|
298
|
|
-#include "udi_cdc.h"
|
299
|
|
-#include "udi_msc.h"
|
300
|
|
-#include "usb_task.h"
|
301
|
|
-
|
302
|
|
-#endif // _CONF_USB_H_
|