Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
tusb_config.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2019 Ha Thach (tinyusb.org)
3
* 2022 Gunar Schorcht
4
*
5
* Permission is hereby granted, free of charge, to any person obtaining a copy
6
* of this software and associated documentation files (the "Software"), to deal
7
* in the Software without restriction, including without limitation the rights
8
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
* copies of the Software, and to permit persons to whom the Software is
10
* furnished to do so, subject to the following conditions:
11
*
12
* The above copyright notice and this permission notice shall be included in
13
* all copies or substantial portions of the Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
* THE SOFTWARE.
22
*/
23
34
#ifndef TUSB_CONFIG_H
35
#define TUSB_CONFIG_H
36
37
/* defined by the application */
38
#if __has_include("tinyusb_app_config.h")
39
#include "tinyusb_app_config.h"
40
#endif
41
#include "
tinyusb.h
"
42
43
#if MODULE_TINYUSB_CLASS_NET
44
#include "
net/ethernet.h
"
45
#endif
46
47
#if !DOXYGEN
48
49
#if MODULE_TINYUSB_CLASS_NET_CDC_NCM && (MODULE_TINYUSB_CLASS_NET_CDC_ECM || MODULE_TINYUSB_CLASS_NET_RNDIS)
50
#error "CDC NCM device class cannot be used together with CDC ECM or RNDIS device class"
51
#endif
52
53
#ifndef CONFIG_TUSBD_AUDIO_NUMOF
54
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_AUDIO
55
#define CONFIG_TUSBD_AUDIO_NUMOF 1
56
#else
57
#define CONFIG_TUSBD_AUDIO_NUMOF 0
58
#endif
59
#endif
60
61
#ifndef CONFIG_TUSBD_BTH_NUMOF
62
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_BTH
63
#define CONFIG_TUSBD_BTH_NUMOF 1
64
#else
65
#define CONFIG_TUSBD_BTH_NUMOF 0
66
#endif
67
#endif
68
69
#ifndef CONFIG_TUSBD_CDC_NUMOF
70
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_CDC
71
#define CONFIG_TUSBD_CDC_NUMOF 1
72
#else
73
#define CONFIG_TUSBD_CDC_NUMOF 0
74
#endif
75
#endif
76
77
#ifndef CONFIG_TUSBD_DFU_NUMOF
78
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_DFU
79
#define CONFIG_TUSBD_DFU_NUMOF 1
80
#else
81
#define CONFIG_TUSBD_DFU_NUMOF 0
82
#endif
83
#endif
84
85
#ifndef CONFIG_TUSBD_DFU_RT_NUMOF
86
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_DFU_RUNTIME
87
#define CONFIG_TUSBD_DFU_RT_NUMOF 1
88
#else
89
#define CONFIG_TUSBD_DFU_RT_NUMOF 0
90
#endif
91
#endif
92
93
#ifndef CONFIG_TUSBD_HID_NUMOF
94
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_HID
95
#define CONFIG_TUSBD_HID_NUMOF 1
96
#else
97
#define CONFIG_TUSBD_HID_NUMOF 0
98
#endif
99
#endif
100
101
#ifndef CONFIG_TUSBD_MIDI_NUMOF
102
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_MIDI
103
#define CONFIG_TUSBD_MIDI_NUMOF 1
104
#else
105
#define CONFIG_TUSBD_MIDI_NUMOF 0
106
#endif
107
#endif
108
109
#ifndef CONFIG_TUSBD_MSC_NUMOF
110
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_MSC
111
#define CONFIG_TUSBD_MSC_NUMOF 1
112
#else
113
#define CONFIG_TUSBD_MSC_NUMOF 0
114
#endif
115
#endif
116
117
#ifndef CONFIG_TUSBD_USBTMC_NUMOF
118
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_USBTMC
119
#define CONFIG_TUSBD_USBTMC_NUMOF 1
120
#else
121
#define CONFIG_TUSBD_USBTMC_NUMOF 0
122
#endif
123
#endif
124
125
#ifndef CONFIG_TUSBD_VENDOR_NUMOF
126
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_VENDOR
127
#define CONFIG_TUSBD_VENDOR_NUMOF 1
128
#else
129
#define CONFIG_TUSBD_VENDOR_NUMOF 0
130
#endif
131
#endif
132
133
#ifndef CONFIG_TUSBD_VIDEO_NUMOF
134
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_VIDEO
135
#define CONFIG_TUSBD_VIDEO_NUMOF 1
136
#else
137
#define CONFIG_TUSBD_VIDEO_NUMOF 0
138
#endif
139
#endif
140
141
#ifndef CONFIG_TUSBH_CDC_NUMOF
142
#if MODULE_TINYUSB_HOST && MODULE_TINYUSB_CLASS_CDC
143
#define CONFIG_TUSBH_CDC_NUMOF 1
144
#else
145
#define CONFIG_TUSBH_CDC_NUMOF 0
146
#endif
147
#endif
148
149
#ifndef CONFIG_TUSBH_HID_NUMOF
150
#if MODULE_TINYUSB_HOST && MODULE_TINYUSB_CLASS_HID
151
#define CONFIG_TUSBH_HID_NUMOF 1
152
#else
153
#define CONFIG_TUSBH_HID_NUMOF 0
154
#endif
155
#endif
156
157
#ifndef CONFIG_TUSBH_HUB_NUMOF
158
#if MODULE_TINYUSB_HOST && MODULE_TINYUSB_CLASS_HUB
159
#define CONFIG_TUSBH_HUB_NUMOF 1
160
#else
161
#define CONFIG_TUSBH_HUB_NUMOF 0
162
#endif
163
#endif
164
165
#ifndef CONFIG_TUSBH_MSC_NUMOF
166
#if MODULE_TINYUSB_HOST && MODULE_TINYUSB_CLASS_MSC
167
#define CONFIG_TUSBH_MSC_NUMOF 1
168
#else
169
#define CONFIG_TUSBH_MSC_NUMOF 0
170
#endif
171
#endif
172
173
#ifndef CONFIG_TUSBH_VENDOR_NUMOF
174
#if MODULE_TINYUSB_HOST && MODULE_TINYUSB_CLASS_VENDOR
175
#define CONFIG_TUSBH_VENDOR_NUMOF 1
176
#else
177
#define CONFIG_TUSBH_VENDOR_NUMOF 0
178
#endif
179
#endif
180
181
#ifndef CONFIG_TUSBD_EP0_SIZE
182
#define CONFIG_TUSBD_EP0_SIZE 64
183
#endif
184
185
#ifndef CONFIG_TUSBD_FS_EP_SIZE
186
#define CONFIG_TUSBD_FS_EP_SIZE 64
187
#endif
188
189
#ifndef CONFIG_TUSBD_HS_EP_SIZE
190
#define CONFIG_TUSBD_HS_EP_SIZE 512
191
#endif
192
193
#ifndef CONFIG_TUSBD_CDC_NOTIF_EP_SIZE
194
#define CONFIG_TUSBD_CDC_NOTIF_EP_SIZE 8
195
#endif
196
197
#ifndef CONFIG_TUSBD_CDC_FS_EP_SIZE
198
#define CONFIG_TUSBD_CDC_FS_EP_SIZE CONFIG_TUSBD_FS_EP_SIZE
199
#endif
200
201
#ifndef CONFIG_TUSBD_CDC_HS_EP_SIZE
202
#define CONFIG_TUSBD_CDC_HS_EP_SIZE CONFIG_TUSBD_HS_EP_SIZE
203
#endif
204
205
#ifndef CONFIG_TUSBD_DFU_ATTR
206
#define CONFIG_TUSBD_DFU_ATTR (DFU_ATTR_CAN_DOWNLOAD | \
207
DFU_ATTR_WILL_DETACH | \
208
DFU_ATTR_MANIFESTATION_TOLERANT)
209
#endif
210
211
#ifndef CONFIG_TUSBD_DFU_DETACH_TIMEOUT
212
#define CONFIG_TUSBD_DFU_DETACH_TIMEOUT 1000
213
#endif
214
215
#ifndef CONFIG_TUSBD_DFU_POLL_TIMEOUT
216
#define CONFIG_TUSBD_DFU_POLL_TIMEOUT 1
217
#endif
218
219
#ifndef CONFIG_TUSBD_DFU_RESET_DELAY
220
#define CONFIG_TUSBD_DFU_RESET_DELAY 2
221
#endif
222
223
#ifndef CONFIG_TUSBD_DFU_FS_XFER_SIZE
224
#define CONFIG_TUSBD_DFU_FS_XFER_SIZE CONFIG_TUSBD_FS_EP_SIZE
225
#endif
226
227
#ifndef CONFIG_TUSBD_DFU_HS_XFER_SIZE
228
#define CONFIG_TUSBD_DFU_HS_XFER_SIZE CONFIG_TUSBD_HS_EP_SIZE
229
#endif
230
231
#ifndef CONFIG_TUSBD_HID_EP_SIZE
232
#define CONFIG_TUSBD_HID_EP_SIZE CONFIG_TUSBD_FS_EP_SIZE
233
#endif
234
235
#ifndef CONFIG_TUSBD_DFU_RT_DETACH_TIMEOUT
236
#define CONFIG_TUSBD_DFU_RT_DETACH_TIMEOUT 1000
237
#endif
238
239
#ifndef CONFIG_TUSBD_DFU_RT_FS_XFER_SIZE
240
#define CONFIG_TUSBD_DFU_RT_FS_XFER_SIZE CONFIG_TUSBD_FS_EP_SIZE
241
#endif
242
243
#ifndef CONFIG_TUSBD_DFU_RT_HS_XFER_SIZE
244
#define CONFIG_TUSBD_DFU_RT_HS_XFER_SIZE CONFIG_TUSBD_HS_EP_SIZE
245
#endif
246
247
#ifndef CONFIG_TUSBD_HID_EP_SIZE
248
#define CONFIG_TUSBD_HID_EP_SIZE CONFIG_TUSBD_FS_EP_SIZE
249
#endif
250
251
#ifndef CONFIG_TUSBD_HID_0_POLL_INTERVALL
252
#define CONFIG_TUSBD_HID_0_POLL_INTERVALL 10
253
#endif
254
255
#ifndef CONFIG_TUSBD_HID_1_POLL_INTERVALL
256
#define CONFIG_TUSBD_HID_1_POLL_INTERVALL 10
257
#endif
258
259
#ifndef CONFIG_TUSBD_MSC_FS_EP_SIZE
260
#define CONFIG_TUSBD_MSC_FS_EP_SIZE CONFIG_TUSBD_FS_EP_SIZE
261
#endif
262
263
#ifndef CONFIG_TUSBD_MSC_HS_EP_SIZE
264
#define CONFIG_TUSBD_MSC_HS_EP_SIZE CONFIG_TUSBD_HS_EP_SIZE
265
#endif
266
267
#ifndef CONFIG_TUSBD_NET_FS_EP_SIZE
268
#define CONFIG_TUSBD_NET_FS_EP_SIZE CONFIG_TUSBD_FS_EP_SIZE
269
#endif
270
271
#ifndef CONFIG_TUSBD_NET_HS_EP_SIZE
272
#define CONFIG_TUSBD_NET_HS_EP_SIZE CONFIG_TUSBD_HS_EP_SIZE
273
#endif
274
275
#ifndef CONFIG_TUSBD_VENDOR_FS_EP_SIZE
276
#define CONFIG_TUSBD_VENDOR_FS_EP_SIZE CONFIG_TUSBD_FS_EP_SIZE
277
#endif
278
279
#ifndef CONFIG_TUSBD_VENDOR_HS_EP_SIZE
280
#define CONFIG_TUSBD_VENDOR_HS_EP_SIZE CONFIG_TUSBD_HS_EP_SIZE
281
#endif
282
283
#ifndef CONFIG_TUSBD_NET_NOTIF_EP_SIZE
284
#define CONFIG_TUSBD_NET_NOTIF_EP_SIZE 64
285
#endif
286
287
#ifndef CONFIG_TUSBD_NET_MTU_SIZE
288
#define CONFIG_TUSBD_NET_MTU_SIZE ETHERNET_FRAME_LEN
289
#endif
290
291
#if MODULE_TINYUSB_CLASS_NET_CDC_ECM
292
#define CONFIG_TUSBD_NET_CDC_ECM 1
293
#else
294
#define CONFIG_TUSBD_NET_CDC_ECM 0
295
#endif
296
297
#if MODULE_TINYUSB_CLASS_NET_CDC_NCM
298
#define CONFIG_TUSBD_NET_CDC_NCM 1
299
#else
300
#define CONFIG_TUSBD_NET_CDC_NCM 0
301
#endif
302
303
#if MODULE_TINYUSB_CLASS_NET_RNDIS
304
#define CONFIG_TUSBD_NET_RNDIS 1
305
#else
306
#define CONFIG_TUSBD_NET_RNDIS 0
307
#endif
308
309
#if CONFIG_TUSBD_NET_CDC_ECM || CONFIG_TUSBD_NET_CDC_NCM || CONFIG_TUSBD_NET_RNDIS
310
#define CONFIG_TUSBD_NET_NUMOF 1
311
#else
312
#define CONFIG_TUSBD_NET_NUMOF 0
313
#endif
314
315
#ifndef CONFIG_TUSBH_ENUM_SIZE
316
#define CONFIG_TUSBH_ENUM_SIZE 256
317
#endif
318
319
#ifndef CONFIG_TUSBH_HID_EPIN_SIZE
320
#define CONFIG_TUSBH_HID_EPIN_SIZE CONFIG_TUSBD_HID_EP_SIZE
321
#endif
322
323
#ifndef CONFIG_TUSBH_HID_EPOUT_SIZE
324
#define CONFIG_TUSBH_HID_EPOUT_SIZE CONFIG_TUSBD_HID_EP_SIZE
325
#endif
326
332
#ifndef CFG_TUSB_MCU
333
#error CFG_TUSB_MCU must be defined
334
#endif
335
337
#define CFG_TUSB_OS OPT_OS_CUSTOM
338
340
#ifndef CFG_TUSB_DEBUG
341
#define CFG_TUSB_DEBUG 0
342
#endif
343
352
#define CFG_TUSB_MEM_SECTION
353
#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
354
361
#define CFG_TUD_ENABLED MODULE_TINYUSB_DEVICE
362
363
#define CFG_TUD_ENDPOINT0_SIZE CONFIG_TUSBD_EP0_SIZE
364
365
#define CFG_TUD_AUDIO CONFIG_TUSBD_AUDIO_NUMOF
366
#define CFG_TUD_BTH CONFIG_TUSBD_BTH_NUMOF
367
#define CFG_TUD_CDC CONFIG_TUSBD_CDC_NUMOF
368
#define CFG_TUD_ECM_RNDIS (CONFIG_TUSBD_NET_CDC_ECM || CONFIG_TUSBD_NET_RNDIS)
369
#define CFG_TUD_DFU CONFIG_TUSBD_DFU_NUMOF
370
#define CFG_TUD_DFU_RUNTIME CONFIG_TUSBD_DFU_RT_NUMOF
371
#define CFG_TUD_HID CONFIG_TUSBD_HID_NUMOF
372
#define CFG_TUD_MIDI CONFIG_TUSBD_MIDI_NUMOF
373
#define CFG_TUD_MSC CONFIG_TUSBD_MSC_NUMOF
374
#define CFG_TUD_NCM CONFIG_TUSBD_NET_CDC_NCM
375
#define CFG_TUD_USBTMC CONFIG_TUSBD_USBTMC_NUMOF
376
#define CFG_TUD_VENDOR CONFIG_TUSBD_VENDOR_NUMOF
377
#define CFG_TUD_VIDEO CONFIG_TUSBD_VIDEO_NUMOF
378
385
#define CFG_TUH_ENABLED MODULE_TINYUSB_HOST
386
387
#define CFG_TUH_MAX_SPEED OPT_MODE_DEFAULT_SPEED
388
389
#define CFG_TUH_ENUMERATION_BUFSIZE CONFIG_TUSBH_ENUM_SIZE
390
392
#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1)
393
394
#define CFG_TUH_CDC CONFIG_TUSBH_CDC_NUMOF
395
#define CFG_TUH_HID CONFIG_TUSBH_HID_NUMOF
396
#define CFG_TUH_HUB CONFIG_TUSBH_HUB_NUMOF
397
#define CFG_TUH_MSC CONFIG_TUSBH_MSC_NUMOF
398
#define CFG_TUH_VENDOR CONFIG_TUSBH_VENDOR_NUMOF
399
406
#define CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? CONFIG_TUSBD_CDC_HS_EP_SIZE \
407
: CONFIG_TUSBD_CDC_FS_EP_SIZE)
408
#define CFG_TUD_CDC_RX_BUFSIZE CFG_TUD_CDC_EP_BUFSIZE
409
#define CFG_TUD_CDC_TX_BUFSIZE CFG_TUD_CDC_EP_BUFSIZE
410
417
#define CFG_TUD_DFU_XFER_BUFSIZE (TUD_OPT_HIGH_SPEED ? CONFIG_TUSBD_DFU_HS_XFER_SIZE \
418
: CONFIG_TUSBD_DFU_FS_XFER_SIZE)
425
#define CFG_TUD_HID_EP_BUFSIZE CONFIG_TUSBD_HID_EP_SIZE
432
#define CFG_TUD_MIDI_RX_BUFSIZE CFG_TUD_MIDI_EP_BUFSIZE
433
#define CFG_TUD_MIDI_TX_BUFSIZE CFG_TUD_MIDI_EP_BUFSIZE
440
#define CFG_TUD_MSC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? CONFIG_TUSBD_MSC_HS_EP_SIZE \
441
: CONFIG_TUSBD_MSC_FS_EP_SIZE)
448
#define CFG_TUD_NET_MTU CONFIG_TUSBD_NET_MTU_SIZE
449
454
#define CFG_TUH_HID_EPIN_BUFSIZE CONFIG_TUSBH_HID_EPIN_SIZE
455
#define CFG_TUH_HID_EPOUT_BUFSIZE CONFIG_TUSBH_HID_EPOUT_SIZE
458
#ifdef __cplusplus
459
extern
"C"
{
460
#endif
461
462
#ifdef __cplusplus
463
}
464
#endif
465
466
#endif
/* !DOXYGEN */
467
#endif
/* TUSB_CONFIG_H */
ethernet.h
Definitions for Ethernet.
tinyusb.h
TinyUSB API.
Generated on Sat Nov 23 2024 19:57:24 by
1.9.8